@@ -244,12 +244,12 @@ SnapshotGenerator.prototype.generate = function (options) {
244
244
}
245
245
246
246
SnapshotGenerator . 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 } ` ;
248
248
}
249
249
250
250
SnapshotGenerator . prototype . getXxdCommand = function ( srcOutputDir , xxdLocation ) {
251
251
// 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 `/bin/ xxd -i ${ SNAPSHOT_BLOB_NAME } .blob > ${ srcOutputDir } ` ;
253
253
}
254
254
255
255
SnapshotGenerator . prototype . getPathInDocker = function ( mappedLocalDir , mappedDockerDir , targetPath ) {
@@ -309,11 +309,12 @@ SnapshotGenerator.prototype.buildCSource = function (androidArch, blobInputDir,
309
309
if ( snapshotInDocker ) {
310
310
const blobsInputInDocker = `/blobs/${ androidArch } `
311
311
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 ) ;
313
314
command = `docker run --rm -v "${ blobInputDir } :${ blobsInputInDocker } " -v "${ srcOutputDir } :${ srcOutputDirInDocker } " ${ SNAPSHOTS_DOCKER_IMAGE } /bin/sh -c "cd ${ blobsInputInDocker } && ${ buildCSourceCommand } "` ;
314
315
}
315
316
else {
316
- command = this . getXxdCommand ( srcOutputDir ) ;
317
+ command = this . getXxdCommand ( join ( srcOutputDir , ` ${ SNAPSHOT_BLOB_NAME } .c` ) ) ;
317
318
}
318
319
shellJsExecuteInDir ( blobInputDir , function ( ) {
319
320
shelljs . exec ( command ) ;
@@ -345,11 +346,11 @@ SnapshotGenerator.prototype.runMksnapshotTool = function (tool, mksnapshotParams
345
346
const toolPathInAppDir = this . copySnapshotTool ( snapshotToolsPath , toolPath , toolsTempFolder ) ;
346
347
const toolPathInDocker = this . getPathInDocker ( inputFileDir , appDirInDocker , toolPathInAppDir ) ;
347
348
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` ) ) ;
349
350
const toolCommandInDocker = this . getSnapshotToolCommand ( toolPathInDocker , inputFilePathInDocker , outputPathInDocker , toolParams ) ;
350
351
command = `docker run --rm -v "${ inputFileDir } :${ appDirInDocker } " -v "${ blobOutputDir } :${ blobOutputDirInDocker } " ${ SNAPSHOTS_DOCKER_IMAGE } /bin/sh -c "${ toolCommandInDocker } "` ;
351
352
} else {
352
- command = this . getSnapshotToolCommand ( toolPath , inputFile , blobOutputDir , toolParams ) ;
353
+ command = this . getSnapshotToolCommand ( toolPath , inputFile , join ( blobOutputDir , ` ${ SNAPSHOT_BLOB_NAME } .blob` ) , toolParams ) ;
353
354
}
354
355
355
356
// Generate .blob file
@@ -370,6 +371,12 @@ SnapshotGenerator.prototype.runMksnapshotTool = function (tool, mksnapshotParams
370
371
if ( buildCSource ) {
371
372
this . buildCSource ( androidArch , blobOutputDir , snapshotInDocker )
372
373
}
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` ) ) ;
373
381
} ) ;
374
382
}
375
-
0 commit comments