Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: tools/patch_sdk.dart

Issue 2940473002: Generate vmservice_io.dill along with platform.dill. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 /// Command line tool to merge the SDK libraries and our patch files. 6 /// Command line tool to merge the SDK libraries and our patch files.
7 /// This is currently designed as an offline tool, but we could automate it. 7 /// This is currently designed as an offline tool, but we could automate it.
8 8
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:isolate' show RawReceivePort; 10 import 'dart:isolate' show RawReceivePort;
11 import 'dart:async'; 11 import 'dart:async';
12 import 'dart:math' as math; 12 import 'dart:math' as math;
13 import 'dart:convert' show JSON; 13 import 'dart:convert' show JSON;
14 14
15 import 'package:analyzer/analyzer.dart'; 15 import 'package:analyzer/analyzer.dart';
16 import 'package:analyzer/src/generated/sdk.dart'; 16 import 'package:analyzer/src/generated/sdk.dart';
17 import 'package:path/path.dart' as path; 17 import 'package:path/path.dart' as path;
18 18
19 import 'package:front_end/src/fasta/fasta.dart' as fasta 19 import 'package:front_end/src/fasta/fasta.dart' as fasta
20 show compilePlatform, writeDepsFile; 20 show compile, compilePlatform, writeDepsFile;
21 21
22 import 'package:compiler/src/kernel/fasta_support.dart' as dart2js 22 import 'package:compiler/src/kernel/fasta_support.dart' as dart2js
23 show compilePlatform; 23 show compilePlatform;
24 24
25 /// Set of input files that were read by this script to generate patched SDK. 25 /// Set of input files that were read by this script to generate patched SDK.
26 /// We will dump it out into the depfile for ninja to use. 26 /// We will dump it out into the depfile for ninja to use.
27 /// 27 ///
28 /// For more information see GN and Ninja references: 28 /// For more information see GN and Ninja references:
29 /// https://chromium.googlesource.com/chromium/src/+/56807c6cb383140af0c03da8 f6731d77785d7160/tools/gn/docs/reference.md#depfile_string_File-name-for-input-d ependencies-for-actions 29 /// https://chromium.googlesource.com/chromium/src/+/56807c6cb383140af0c03da8 f6731d77785d7160/tools/gn/docs/reference.md#depfile_string_File-name-for-input-d ependencies-for-actions
30 /// https://ninja-build.org/manual.html#_depfile 30 /// https://ninja-build.org/manual.html#_depfile
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 for (SdkLibrary library in sdkLibraries) { 102 for (SdkLibrary library in sdkLibraries) {
103 if (forDart2js && library.isVmLibrary) continue; 103 if (forDart2js && library.isVmLibrary) continue;
104 if (forVm && library.isDart2JsLibrary) continue; 104 if (forVm && library.isDart2JsLibrary) continue;
105 _applyPatch(library, sdkLibIn, patchIn, sdkOut, locations); 105 _applyPatch(library, sdkLibIn, patchIn, sdkOut, locations);
106 } 106 }
107 107
108 if (forVm) _copyExtraVmLibraries(sdkOut, locations); 108 if (forVm) _copyExtraVmLibraries(sdkOut, locations);
109 109
110 Uri platform = outDirUri.resolve('platform.dill.tmp'); 110 Uri platform = outDirUri.resolve('platform.dill.tmp');
111 Uri outline = outDirUri.resolve('outline.dill'); 111 Uri outline = outDirUri.resolve('outline.dill');
112 Uri vmserviceIo = outDirUri.resolve('vmservice_io.dill');
112 Uri librariesJson = outDirUri.resolve("lib/libraries.json"); 113 Uri librariesJson = outDirUri.resolve("lib/libraries.json");
113 Uri packages = Uri.base.resolveUri(new Uri.file(packagesFile)); 114 Uri packages = Uri.base.resolveUri(new Uri.file(packagesFile));
114 115
115 await _writeSync( 116 await _writeSync(
116 librariesJson.toFilePath(), JSON.encode({"libraries": locations})); 117 librariesJson.toFilePath(), JSON.encode({"libraries": locations}));
117 118
118 if (forVm) { 119 if (forVm) {
119 await fasta.compilePlatform(outDirUri, platform, 120 await fasta.compilePlatform(outDirUri, platform,
120 packages: packages, outlineOutput: outline); 121 packages: packages, outlineOutput: outline);
122 await fasta.compile([
123 "--sdk=${outDirUri.toString()}",
124 "--platform=${outline.toString()}",
125 "--packages=${packages.toString()}",
126 "dart:vmservice_io",
127 "-o",
128 vmserviceIo.toString()
129 ]);
121 } else { 130 } else {
122 await dart2js.compilePlatform(outDirUri, platform, 131 await dart2js.compilePlatform(outDirUri, platform,
123 packages: packages, outlineOutput: outline); 132 packages: packages, outlineOutput: outline);
124 } 133 }
125 134
126 Uri platformFinalLocation = outDirUri.resolve('platform.dill'); 135 Uri platformFinalLocation = outDirUri.resolve('platform.dill');
127 136
128 // To properly regenerate the patched_sdk, patched_dart2js_sdk, and 137 // To properly regenerate the patched_sdk, patched_dart2js_sdk, and
129 // platform.dill only when necessary, we track dependencies as follows: 138 // platform.dill only when necessary, we track dependencies as follows:
130 // - inputs like the sdk libraries and patch files are covered by the 139 // - inputs like the sdk libraries and patch files are covered by the
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 if (diff != 0) return diff; 631 if (diff != 0) return diff;
623 return end - other.end; 632 return end - other.end;
624 } 633 }
625 } 634 }
626 635
627 List<SdkLibrary> _getSdkLibraries(String contents, bool useDart2js) { 636 List<SdkLibrary> _getSdkLibraries(String contents, bool useDart2js) {
628 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(useDart2js); 637 var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(useDart2js);
629 parseCompilationUnit(contents).accept(libraryBuilder); 638 parseCompilationUnit(contents).accept(libraryBuilder);
630 return libraryBuilder.librariesMap.sdkLibraries; 639 return libraryBuilder.librariesMap.sdkLibraries;
631 } 640 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698