@@ -6,6 +6,8 @@ const semver = require("semver");
6
6
7
7
const SnapshotGenerator = require ( "./snapshot-generator" ) ;
8
8
const TnsJavaClassesGenerator = require ( "./tns-java-classes-generator" ) ;
9
+ const { resolveAndroidAppPath } = require ( "../../projectHelpers" ) ;
10
+
9
11
const {
10
12
CONSTANTS ,
11
13
createDirectory,
@@ -27,7 +29,6 @@ const resolveRelativePath = (path) => {
27
29
28
30
function ProjectSnapshotGenerator ( options ) {
29
31
this . options = options = options || { } ;
30
-
31
32
options . projectRoot = resolveRelativePath ( options . projectRoot ) || process . cwd ( ) ;
32
33
33
34
console . log ( "Project root: " + options . projectRoot ) ;
@@ -58,7 +59,8 @@ ProjectSnapshotGenerator.cleanSnapshotArtefacts = function (projectRoot) {
58
59
ProjectSnapshotGenerator . installSnapshotArtefacts = function ( projectRoot ) {
59
60
const buildPath = ProjectSnapshotGenerator . calculateBuildPath ( projectRoot ) ;
60
61
const platformPath = join ( projectRoot , "platforms/android" ) ;
61
- const assetsPath = join ( platformPath , "src/main/assets" ) ;
62
+
63
+ const appPath = resolveAndroidAppPath ( projectRoot ) ;
62
64
const configDestinationPath = join ( platformPath , "configurations" , SnapshotGenerator . SNAPSHOT_PACKAGE_NANE ) ;
63
65
64
66
// Remove build folder to make sure that the apk will be fully rebuild
@@ -70,7 +72,7 @@ ProjectSnapshotGenerator.installSnapshotArtefacts = function (projectRoot) {
70
72
71
73
// Copy tns-java-classes.js
72
74
if ( shelljs . test ( "-e" , join ( buildPath , "tns-java-classes.js" ) ) ) {
73
- shelljs . cp ( join ( buildPath , "tns-java-classes.js" ) , join ( assetsPath , "app/ tns-java-classes.js" ) ) ;
75
+ shelljs . cp ( join ( buildPath , "tns-java-classes.js" ) , join ( appPath , "tns-java-classes.js" ) ) ;
74
76
}
75
77
76
78
if ( shelljs . test ( "-e" , join ( buildPath , "ndk-build/libs" ) ) ) {
@@ -84,11 +86,11 @@ ProjectSnapshotGenerator.installSnapshotArtefacts = function (projectRoot) {
84
86
else {
85
87
// useLibs = false
86
88
const blobsSrcPath = join ( buildPath , "snapshots/blobs" ) ;
87
- const blobsDestinationPath = join ( assetsPath , "snapshots" ) ;
88
- const appPackageJsonPath = join ( assetsPath , "app/ package.json" ) ;
89
+ const blobsDestinationPath = resolve ( appPath , "../ snapshots" ) ;
90
+ const appPackageJsonPath = join ( appPath , "package.json" ) ;
89
91
90
92
// Copy the blobs in the prepared app folder
91
- shelljs . cp ( "-R" , blobsSrcPath + "/" , join ( assetsPath , "snapshots" ) ) ;
93
+ shelljs . cp ( "-R" , blobsSrcPath + "/" , resolve ( appPath , "../ snapshots" ) ) ;
92
94
93
95
/*
94
96
Rename TNSSnapshot.blob files to snapshot.blob files. The xxd tool uses the file name for the name of the static array. This is why the *.blob files are initially named TNSSnapshot.blob. After the xxd step, they must be renamed to snapshot.blob, because this is the filename that the Android runtime is looking for.
@@ -146,7 +148,7 @@ ProjectSnapshotGenerator.prototype.getV8Version = function (generationOptions) {
146
148
return resolve ( maybeV8Version ) ;
147
149
}
148
150
149
- const runtimeVersion = this . getAndroidRuntimeVersion ( this . options . projectRoot ) ;
151
+ const runtimeVersion = getAndroidRuntimeVersion ( this . options . projectRoot ) ;
150
152
getV8VersionsMap ( runtimeVersion )
151
153
. then ( ( { versionsMap, latest } ) => {
152
154
const v8Version = findV8Version ( runtimeVersion , versionsMap ) ;
0 commit comments