Add a vmservice_sdk directory in runtime/bin.

This directory has a libraries.json file pointing to vmservice_io and
_vmservice in the source tree. The script tools/patch_sdk.dart has been
updated to use this new directory as the sdk directory when compiling
dart:vmservice_io. This way, to build vmservice_io.dill, we
do not need to copy the dart files pertaining to vmservice_io and
_vmservice.

Fixes #29859

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2938903003 .
This commit is contained in:
Siva Chandra 2017-06-15 13:08:06 -07:00
parent 114ac0bbd9
commit 65a5707189
2 changed files with 22 additions and 18 deletions

View file

@ -0,0 +1,6 @@
{
"libraries": {
"vmservice_io": "../../vmservice/vmservice_io.dart",
"_vmservice": "../../../../sdk/lib/vmservice/vmservice.dart"
}
}

View file

@ -120,25 +120,33 @@ Future _main(List<String> argv) async {
librariesJson.toFilePath(), JSON.encode({"libraries": locations}));
if (forVm || forFlutter) {
var vmserviceName = forVm ? 'vmservice_io' : 'vmservice_sky';
var targetName = forVm ? 'vm_fasta' : 'flutter_fasta';
Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill');
await fasta.compilePlatform(outDirUri, platform,
packages: packages,
outlineOutput: outline,
backendTarget: forVm ? 'vm_fasta' : 'flutter_fasta');
} else {
await dart2js.compilePlatform(outDirUri, platform,
packages: packages, outlineOutput: outline);
}
if (forVm) {
var base = path.fromUri(Platform.script);
Uri repositoryDir =
new Uri.directory(path.dirname(path.dirname(path.absolute(base))));
var vmserviceName = 'vmservice_io';
Uri vmserviceSdk = repositoryDir.resolve('runtime/bin/vmservice_sdk/');
Uri vmserviceUri = outDirUri.resolve('$vmserviceName.dill');
// TODO(sigmundch): Specify libraries.json directly instead of "--sdk"
// after #29882 is fixed.
await fasta.compile([
"--sdk=$outDirUri",
"--sdk=$vmserviceSdk",
"--platform=$outline",
"--target=$targetName",
"--target=vm_fasta",
"--packages=$packages",
"dart:$vmserviceName",
"-o",
"$vmserviceUri",
]);
} else {
await dart2js.compilePlatform(outDirUri, platform,
packages: packages, outlineOutput: outline);
}
Uri platformFinalLocation = outDirUri.resolve('platform.dill');
@ -243,16 +251,6 @@ _copyExtraLibraries(String sdkOut, Map<String, String> locations) {
_writeSync(builtinLibraryOut, readInputFile(builtinLibraryIn));
locations['_builtin'] = path.join('_builtin', '_builtin.dart');
for (var file in ['loader.dart', 'server.dart', 'vmservice_io.dart']) {
var libraryIn = path.join(dartDir, 'runtime', 'bin', 'vmservice', file);
var libraryOut = path.join(sdkOut, 'vmservice_io', file);
_writeSync(libraryOut, readInputFile(libraryIn));
}
locations[forVm ? "vmservice_io" : "vmservice_sky"] =
path.join('vmservice_io', 'vmservice_io.dart');
locations["_vmservice"] = path.join('vmservice', 'vmservice.dart');
if (forFlutter) {
// Flutter repo has this layout:
// engine/src/