@@ -244,12 +244,12 @@ SnapshotGenerator.prototype.generate = function (options) {
244244}
245245
246246SnapshotGenerator . prototype . getSnapshotToolCommand = function ( snapshotToolPath , inputFilePath , outputPath , toolParams ) {
247- return `${ snapshotToolPath } ${ inputFilePath } --startup_blob ${ join ( outputPath , ` ${ SNAPSHOT_BLOB_NAME } .blob` ) } ${ toolParams } ` ;
247+ return `${ snapshotToolPath } ${ inputFilePath } --startup_blob ${ outputPath } ${ toolParams } ` ;
248248}
249249
250250SnapshotGenerator . prototype . getXxdCommand = function ( srcOutputDir , xxdLocation ) {
251251 // https://github.com/NativeScript/docker-images/tree/master/v8-snapshot/bin
252- return `${ xxdLocation || "" } xxd -i ${ SNAPSHOT_BLOB_NAME } .blob > ${ join ( srcOutputDir , ` ${ SNAPSHOT_BLOB_NAME } .c` ) } ` ;
252+ return `${ xxdLocation || "" } xxd -i ${ SNAPSHOT_BLOB_NAME } .blob > ${ srcOutputDir } ` ;
253253}
254254
255255SnapshotGenerator . prototype . getPathInDocker = function ( mappedLocalDir , mappedDockerDir , targetPath ) {
@@ -309,11 +309,12 @@ SnapshotGenerator.prototype.buildCSource = function (androidArch, blobInputDir,
309309 if ( snapshotInDocker ) {
310310 const blobsInputInDocker = `/blobs/${ androidArch } `
311311 const srcOutputDirInDocker = `/dist/src/${ androidArch } ` ;
312- const buildCSourceCommand = this . getXxdCommand ( srcOutputDirInDocker , "/bin/" ) ;
312+ const outputPathInDocker = this . getPathInDocker ( srcOutputDir , srcOutputDirInDocker , join ( srcOutputDir , `${ SNAPSHOT_BLOB_NAME } .c` ) ) ;
313+ const buildCSourceCommand = this . getXxdCommand ( outputPathInDocker , "/bin/" ) ;
313314 command = `docker run --rm -v "${ blobInputDir } :${ blobsInputInDocker } " -v "${ srcOutputDir } :${ srcOutputDirInDocker } " ${ SNAPSHOTS_DOCKER_IMAGE } /bin/sh -c "cd ${ blobsInputInDocker } && ${ buildCSourceCommand } "` ;
314315 }
315316 else {
316- command = this . getXxdCommand ( srcOutputDir ) ;
317+ command = this . getXxdCommand ( join ( srcOutputDir , ` ${ SNAPSHOT_BLOB_NAME } .c` ) ) ;
317318 }
318319 shellJsExecuteInDir ( blobInputDir , function ( ) {
319320 shelljs . exec ( command ) ;
@@ -345,11 +346,11 @@ SnapshotGenerator.prototype.runMksnapshotTool = function (tool, mksnapshotParams
345346 const toolPathInAppDir = this . copySnapshotTool ( snapshotToolsPath , toolPath , toolsTempFolder ) ;
346347 const toolPathInDocker = this . getPathInDocker ( inputFileDir , appDirInDocker , toolPathInAppDir ) ;
347348 const inputFilePathInDocker = this . getPathInDocker ( inputFileDir , appDirInDocker , inputFile ) ;
348- const outputPathInDocker = this . getPathInDocker ( blobOutputDir , blobOutputDirInDocker , blobOutputDir ) ;
349+ const outputPathInDocker = this . getPathInDocker ( blobOutputDir , blobOutputDirInDocker , join ( blobOutputDir , ` ${ SNAPSHOT_BLOB_NAME } .blob` ) ) ;
349350 const toolCommandInDocker = this . getSnapshotToolCommand ( toolPathInDocker , inputFilePathInDocker , outputPathInDocker , toolParams ) ;
350351 command = `docker run --rm -v "${ inputFileDir } :${ appDirInDocker } " -v "${ blobOutputDir } :${ blobOutputDirInDocker } " ${ SNAPSHOTS_DOCKER_IMAGE } /bin/sh -c "${ toolCommandInDocker } "` ;
351352 } else {
352- command = this . getSnapshotToolCommand ( toolPath , inputFile , blobOutputDir , toolParams ) ;
353+ command = this . getSnapshotToolCommand ( toolPath , inputFile , join ( blobOutputDir , ` ${ SNAPSHOT_BLOB_NAME } .blob` ) , toolParams ) ;
353354 }
354355
355356 // Generate .blob file
@@ -370,6 +371,12 @@ SnapshotGenerator.prototype.runMksnapshotTool = function (tool, mksnapshotParams
370371 if ( buildCSource ) {
371372 this . buildCSource ( androidArch , blobOutputDir , snapshotInDocker )
372373 }
374+
375+ /*
376+ Rename TNSSnapshot.blob files to snapshot.blob files. The xxd tool uses the file name for the name of the static array.
377+ This is why the *.blob files are initially named TNSSnapshot.blob.
378+ After the xxd step, they must be renamed to snapshot.blob, because this is the filename that the Android runtime is looking for.
379+ */
380+ shelljs . mv ( join ( blobOutputDir , `${ SNAPSHOT_BLOB_NAME } .blob` ) , join ( blobOutputDir , `snapshot.blob` ) ) ;
373381 } ) ;
374382}
375-
0 commit comments