Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 9e99683

Browse files
committed
feat: snapshot in Docker on macOS with Android runtime 6.3.0 or higher as it will not contain snapshot tools for macOS anymore
1 parent 70d8545 commit 9e99683

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Diff for: snapshot/android/project-snapshot-generator.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ ProjectSnapshotGenerator.prototype.generate = function (generationOptions) {
179179
androidNdkPath: generationOptions.androidNdkPath,
180180
mksnapshotParams: mksnapshotParams,
181181
snapshotInDocker: generationOptions.snapshotInDocker,
182-
recommendedAndroidNdkRevision
182+
recommendedAndroidNdkRevision,
183+
runtimeVersion
183184
};
184185

185186
return generator.generate(options).then(() => {

Diff for: snapshot/android/snapshot-generator.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { dirname, relative, join, EOL } = require("path");
33
const child_process = require("child_process");
44
const { convertToUnixPath, warn } = require("../../lib/utils");
55
const PropertiesReader = require('properties-reader');
6+
const semver = require("semver");
67
const shelljs = require("shelljs");
78

89
const { createDirectory, downloadFile, getHostOS, getHostOSArch, CONSTANTS, has32BitArch, isMacOSCatalinaOrHigher, isSubPath } = require("./utils");
@@ -36,12 +37,16 @@ module.exports = SnapshotGenerator;
3637

3738
SnapshotGenerator.SNAPSHOT_PACKAGE_NANE = "nativescript-android-snapshot";
3839

39-
SnapshotGenerator.prototype.shouldSnapshotInDocker = function (hostOS, targetArchs) {
40+
SnapshotGenerator.prototype.shouldSnapshotInDocker = function (hostOS, targetArchs, currentRuntimeVersion) {
4041
let shouldSnapshotInDocker = false;
42+
const minRuntimeWithoutMacOSSnapshotTools = "6.3.0";
4143
const generateInDockerMessage = "The snapshots will be generated in a docker container.";
42-
if (hostOS == CONSTANTS.WIN_OS_NAME) {
44+
if (hostOS === CONSTANTS.WIN_OS_NAME) {
4345
console.log(`The V8 snapshot tools are not supported on Windows. ${generateInDockerMessage}`);
4446
shouldSnapshotInDocker = true;
47+
} else if (hostOS === CONSTANTS.MAC_OS_NAME && semver.gte(currentRuntimeVersion, minRuntimeWithoutMacOSSnapshotTools)) {
48+
console.log(`Starting from Android Runtime 6.3.0, the Snapshot tools are no longer supported on macOS. ${generateInDockerMessage}`);
49+
shouldSnapshotInDocker = true;
4550
} else if (isMacOSCatalinaOrHigher() && has32BitArch(targetArchs)) {
4651
console.log(`Starting from macOS Catalina, the 32-bit processes are no longer supported. ${generateInDockerMessage}`);
4752
shouldSnapshotInDocker = true;
@@ -295,7 +300,7 @@ SnapshotGenerator.prototype.generate = function (options) {
295300

296301
this.preprocessInputFiles(options.inputFiles, preprocessedInputFile);
297302
const hostOS = getHostOS();
298-
const snapshotInDocker = options.snapshotInDocker || this.shouldSnapshotInDocker(hostOS, options.targetArchs);
303+
const snapshotInDocker = options.snapshotInDocker || this.shouldSnapshotInDocker(hostOS, options.targetArchs, options.runtimeVersion);
299304

300305
// generates the actual .blob and .c files
301306
return this.generateSnapshots(

0 commit comments

Comments
 (0)