@@ -96,23 +96,21 @@ ProjectSnapshotGenerator.installSnapshotArtefacts = function(projectRoot) {
96
96
}
97
97
98
98
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" ;
116
114
}
117
115
}
118
116
@@ -133,6 +131,16 @@ ProjectSnapshotGenerator.prototype.validateAndroidRuntimeVersion = function() {
133
131
}
134
132
}
135
133
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
+
136
144
ProjectSnapshotGenerator . prototype . generateTnsJavaClassesFile = function ( generationOptions ) {
137
145
const tnsJavaClassesGenerator = new TnsJavaClassesGenerator ( ) ;
138
146
return tnsJavaClassesGenerator . generate ( {
0 commit comments