Commit d5b502bb authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

use new --print-deps option (#8577)

parent 25714747
...@@ -69,10 +69,6 @@ class _GenSnapshotDartDependencySetBuilder implements DartDependencySetBuilder { ...@@ -69,10 +69,6 @@ class _GenSnapshotDartDependencySetBuilder implements DartDependencySetBuilder {
Artifacts.instance.getArtifactPath(Artifact.isolateSnapshotData); Artifacts.instance.getArtifactPath(Artifact.isolateSnapshotData);
assert(fs.path.isAbsolute(this.projectRootPath)); assert(fs.path.isAbsolute(this.projectRootPath));
// TODO(goderbauer): Implement --print-deps in gen_snapshot so we don't have to parse the Makefile
final Directory tempDir = fs.systemTempDirectory.createTempSync('dart_dependency_set_builder_');
final String depfilePath = fs.path.join(tempDir.path, 'snapshot_blob.bin.d');
final List<String> args = <String>[ final List<String> args = <String>[
snapshotterPath, snapshotterPath,
'--snapshot_kind=script', '--snapshot_kind=script',
...@@ -80,24 +76,15 @@ class _GenSnapshotDartDependencySetBuilder implements DartDependencySetBuilder { ...@@ -80,24 +76,15 @@ class _GenSnapshotDartDependencySetBuilder implements DartDependencySetBuilder {
'--vm_snapshot_data=$vmSnapshotData', '--vm_snapshot_data=$vmSnapshotData',
'--isolate_snapshot_data=$isolateSnapshotData', '--isolate_snapshot_data=$isolateSnapshotData',
'--packages=$packagesFilePath', '--packages=$packagesFilePath',
'--dependencies=$depfilePath', '--print-dependencies',
'--script_snapshot=snapshot_blob.bin', '--script_snapshot=snapshot_blob.bin',
mainScriptPath mainScriptPath
]; ];
runSyncAndThrowStdErrOnError(args); final String output = runSyncAndThrowStdErrOnError(args);
String output = fs.file(depfilePath).readAsStringSync();
tempDir.deleteSync(recursive: true);
final int splitIndex = output.indexOf(':');
if (splitIndex == -1)
throw new Exception('Unexpected output $output');
output = output.substring(splitIndex + 1); return new Set<String>.from(LineSplitter.split(output).map(
// Note: next line means we cannot process anything with spaces in the path (String path) => fs.path.canonicalize(path))
// because Makefiles don't support spaces in paths :( );
return new Set<String>.from(output.trim().split(' ').map(
(String path) => fs.path.canonicalize(path)
));
} }
} }
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