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

Unified Diff: tools/precompilation/precompiler.dart

Issue 1507943002: Add ./tools/test.py -c precompiler -r dart_precompiled. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/utils/utils.status ('k') | tools/testing/dart/compiler_configuration.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/precompilation/precompiler.dart
diff --git a/tools/precompilation/precompiler.dart b/tools/precompilation/precompiler.dart
new file mode 100755
index 0000000000000000000000000000000000000000..419875a449e837bb761e758a34b0a5d84110cd3a
--- /dev/null
+++ b/tools/precompilation/precompiler.dart
@@ -0,0 +1,64 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library precompiler;
+
+import 'dart:io';
+
+void run(String executable, String arguments, [String workingDirectory]) {
+ print("+ $executable ${arguments.join(' ')}");
+ var result = Process.runSync(executable, arguments,
+ workingDirectory: workingDirectory);
+ stdout.write(result.stdout);
+ stderr.write(result.stderr);
+ if (result.exitCode != 0) {
+ exit(result.exitCode);
+ }
+}
+
+void main(List<String> args) {
+ var configuration = Platform.environment["DART_CONFIGURATION"];
+
+ var cc, cc_flags, shared, libname;
+ if (Platform.isLinux) {
+ cc = 'gcc';
+ shared = '-shared';
+ libname = 'libprecompiled.so';
+ } else if (Platform.isMacOS) {
+ cc = 'clang';
+ shared = '-dynamiclib';
+ libname = 'libprecompiled.dylib';
+ } else {
+ print("Test only supports Linux and Mac");
+ return;
+ }
+
+ if (configuration.endsWith("X64")) {
+ cc_flags = "-m64";
+ } else if (configuration.endsWith("SIMARM64")) {
+ cc_flags = "-m64";
+ } else if (configuration.endsWith("SIMARM")) {
+ cc_flags = "-m32";
+ } else if (configuration.endsWith("SIMMIPS")) {
+ cc_flags = "-m32";
+ } else if (configuration.endsWith("ARM")) {
+ cc_flags = "";
+ } else if (configuration.endsWith("MIPS")) {
+ cc_flags = "-EL";
+ } else {
+ print("Architecture not supported: $configuration");
+ return;
+ }
+
+ var tmpDir;
+ for (var arg in args) {
+ if (arg.startsWith("--gen-precompiled-snapshot")) {
+ tmpDir = arg.substring("--gen-precompiled-snapshot".length + 1);
+ }
+ }
+ print("Using directory $tmpDir");
+
+ run(args[0], args.sublist(1));
+ run(cc, [shared, cc_flags, "-o", libname, "precompiled.S"], tmpDir);
+}
« no previous file with comments | « tests/utils/utils.status ('k') | tools/testing/dart/compiler_configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698