Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 210648f

Browse files
authored
refactor: hardcode android runtime - v8 versions (#240)
- remove dependency to adm-zip
1 parent 2d411dc commit 210648f

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

‎package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"generate-android-snapshot": "./bin/generate-android-snapshot"
2727
},
2828
"dependencies": {
29-
"adm-zip": "^0.4.7",
3029
"shelljs": "^0.6.0"
3130
},
3231
"devDependencies": {}

‎snapshot/android/project-snapshot-generator.js‎

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,21 @@ ProjectSnapshotGenerator.installSnapshotArtefacts = function(projectRoot) {
9696
}
9797

9898
ProjectSnapshotGenerator.prototype.getV8Version = function() {
99-
const nativescriptLibraryPath = join(this.options.projectRoot, "platforms/android/libs/runtime-libs/nativescript-regular.aar");
100-
if (!fs.existsSync(nativescriptLibraryPath)) {
101-
nativescriptLibraryPath = join(options.projectRoot, "platforms/android/libs/runtime-libs/nativescript.aar");
102-
}
103-
104-
const zip = new require("adm-zip")(nativescriptLibraryPath);
105-
const config = zip.readAsText("config.json");
106-
return config ? JSON.parse(config)["v8-version"] : "4.7.80";
107-
}
108-
109-
ProjectSnapshotGenerator.prototype.getAndroidRuntimeVersion = function() {
110-
try {
111-
const projectPackageJSON = getPackageJson(this.options.projectRoot);
112-
113-
return projectPackageJSON["nativescript"]["tns-android"]["version"];
114-
} catch(e) {
115-
return null;
99+
const runtimeVersion = this.getAndroidRuntimeVersion();
100+
101+
if (!runtimeVersion) {
102+
return;
103+
} else if (
104+
VALID_ANDROID_RUNTIME_TAGS.includes(runtimeVersion) ||
105+
isVersionGte(runtimeVersion, "3.2.0")
106+
) {
107+
return "5.9.211";
108+
} else if (isVersionGte(runtimeVersion, "3.1.0")) {
109+
return "5.5.372";
110+
} else if (isVersionGte(runtimeVersion, "2.4.0")) {
111+
return "5.2.361";
112+
} else if (isVersionGte(runtimeVersion, "2.0.0")) {
113+
return "4.7.80";
116114
}
117115
}
118116

@@ -133,6 +131,16 @@ ProjectSnapshotGenerator.prototype.validateAndroidRuntimeVersion = function() {
133131
}
134132
}
135133

134+
ProjectSnapshotGenerator.prototype.getAndroidRuntimeVersion = function() {
135+
try {
136+
const projectPackageJSON = getPackageJson(this.options.projectRoot);
137+
138+
return projectPackageJSON["nativescript"]["tns-android"]["version"];
139+
} catch(e) {
140+
return null;
141+
}
142+
}
143+
136144
ProjectSnapshotGenerator.prototype.generateTnsJavaClassesFile = function(generationOptions) {
137145
const tnsJavaClassesGenerator = new TnsJavaClassesGenerator();
138146
return tnsJavaClassesGenerator.generate({

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /