Unverified Commit 581a343b authored by Stanislav Baranov's avatar Stanislav Baranov Committed by GitHub

Fix gradle dependency for gen_snapshot in AOT builds. (#18322)

parent 4db7daf7
...@@ -36,6 +36,11 @@ class SnapshotType { ...@@ -36,6 +36,11 @@ class SnapshotType {
class GenSnapshot { class GenSnapshot {
const GenSnapshot(); const GenSnapshot();
static String getSnapshotterPath(SnapshotType snapshotType) {
return artifacts.getArtifactPath(
Artifact.genSnapshot, snapshotType.platform, snapshotType.mode);
}
Future<int> run({ Future<int> run({
@required SnapshotType snapshotType, @required SnapshotType snapshotType,
@required String packagesPath, @required String packagesPath,
...@@ -50,7 +55,8 @@ class GenSnapshot { ...@@ -50,7 +55,8 @@ class GenSnapshot {
'--dependencies=$depfilePath', '--dependencies=$depfilePath',
'--print_snapshot_sizes', '--print_snapshot_sizes',
]..addAll(additionalArgs); ]..addAll(additionalArgs);
final String snapshotterPath = artifacts.getArtifactPath(Artifact.genSnapshot, snapshotType.platform, snapshotType.mode);
final String snapshotterPath = getSnapshotterPath(snapshotType);
// iOS gen_snapshot is a multi-arch binary. Running as an i386 binary will // iOS gen_snapshot is a multi-arch binary. Running as an i386 binary will
// generate armv7 code. Running as an x86_64 binary will generate arm64 // generate armv7 code. Running as an x86_64 binary will generate arm64
...@@ -195,8 +201,9 @@ class AOTSnapshotter { ...@@ -195,8 +201,9 @@ class AOTSnapshotter {
return 0; return 0;
} }
final SnapshotType snapshotType = new SnapshotType(platform, buildMode);
final int genSnapshotExitCode = await genSnapshot.run( final int genSnapshotExitCode = await genSnapshot.run(
snapshotType: new SnapshotType(platform, buildMode), snapshotType: snapshotType,
packagesPath: packageMap.packagesPath, packagesPath: packageMap.packagesPath,
depfilePath: depfilePath, depfilePath: depfilePath,
additionalArgs: genSnapshotArgs, additionalArgs: genSnapshotArgs,
...@@ -209,7 +216,8 @@ class AOTSnapshotter { ...@@ -209,7 +216,8 @@ class AOTSnapshotter {
// Write path to gen_snapshot, since snapshots have to be re-generated when we roll // Write path to gen_snapshot, since snapshots have to be re-generated when we roll
// the Dart SDK. // the Dart SDK.
await outputDir.childFile('gen_snapshot.d').writeAsString('snapshot.d: $genSnapshot\n'); final String genSnapshotPath = GenSnapshot.getSnapshotterPath(snapshotType);
await outputDir.childFile('gen_snapshot.d').writeAsString('snapshot.d: $genSnapshotPath\n');
// On iOS, we use Xcode to compile the snapshot into a dynamic library that the // On iOS, we use Xcode to compile the snapshot into a dynamic library that the
// end-developer can link into their app. // end-developer can link into their app.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment