Skip to content

Commit 528fc24

Browse files
author
Dimitar Tachev
authored
Merge pull request #5028 from NativeScript/tachev/fix-skip-native-prepare
fix: skip snapshot tools based on skipNativePrepare
2 parents 505e019 + 1e17777 commit 528fc24

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/controllers/deploy-controller.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export class DeployController {
1111

1212
const executeAction = async (device: Mobile.IDevice) => {
1313
const deviceDescriptor = _.find(deviceDescriptors, dd => dd.identifier === device.deviceInfo.identifier);
14-
await this.$prepareController.prepare(deviceDescriptor.buildData);
14+
const prepareData = {
15+
...deviceDescriptor.buildData,
16+
nativePrepare: { skipNativePrepare: !!deviceDescriptor.skipNativePrepare }
17+
};
18+
await this.$prepareController.prepare(prepareData);
1519
const packageFilePath = await deviceDescriptor.buildAction();
1620
await this.$deviceInstallAppService.installOnDevice(device, { ...deviceDescriptor.buildData, buildForDevice: !device.isEmulator }, packageFilePath);
1721
};

lib/services/webpack/webpack-compiler-service.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,18 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
174174

175175
Object.assign(envData,
176176
appPath && { appPath },
177-
appResourcesPath && { appResourcesPath },
177+
appResourcesPath && { appResourcesPath }
178178
);
179179

180180
envData.verbose = envData.verbose || this.$logger.isVerbose();
181181
envData.production = envData.production || prepareData.release;
182+
// The snapshot generation is wrongly located in the Webpack plugin.
183+
// It should be moved in the Native Prepare of the CLI or a Gradle task in the Runtime.
184+
// As a workaround, we skip the mksnapshot, xxd and android-ndk calls based on skipNativePrepare.
185+
// In this way the plugin will prepare only the snapshot JS entry without any native prepare and
186+
// we will able to execute cloud builds with snapshot without having any local snapshot or Docker setup.
187+
// TODO: Remove this flag when we remove the native part from the plugin.
188+
envData.skipSnapshotTools = prepareData.nativePrepare && prepareData.nativePrepare.skipNativePrepare;
182189

183190
if (prepareData.env && (prepareData.env.sourceMap === false || prepareData.env.sourceMap === 'false')) {
184191
delete envData.sourceMap;

0 commit comments

Comments
 (0)