Skip to content

fix: skip snapshot tools based on skipNativePrepare #5028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/controllers/deploy-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export class DeployController {

const executeAction = async (device: Mobile.IDevice) => {
const deviceDescriptor = _.find(deviceDescriptors, dd => dd.identifier === device.deviceInfo.identifier);
await this.$prepareController.prepare(deviceDescriptor.buildData);
const prepareData = {
...deviceDescriptor.buildData,
nativePrepare: { skipNativePrepare: !!deviceDescriptor.skipNativePrepare }
};
await this.$prepareController.prepare(prepareData);
const packageFilePath = await deviceDescriptor.buildAction();
await this.$deviceInstallAppService.installOnDevice(device, { ...deviceDescriptor.buildData, buildForDevice: !device.isEmulator }, packageFilePath);
};
Expand Down
9 changes: 8 additions & 1 deletion lib/services/webpack/webpack-compiler-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,18 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp

Object.assign(envData,
appPath && { appPath },
appResourcesPath && { appResourcesPath },
appResourcesPath && { appResourcesPath }
);

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

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