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

Side by Side Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/frog/FrogCompiler.java

Issue 10414077: Change the default Dart-to-JavaScript compiler in the editor to be dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « client/dart.js ('k') | 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 /* 1 /*
2 * Copyright 2012 Dart project authors. 2 * Copyright 2012 Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 FrogCompiler compiler; 110 FrogCompiler compiler;
111 111
112 final CountDownLatch latch; 112 final CountDownLatch latch;
113 113
114 if (DartCoreDebug.ENABLE_DOUBLE_COMPILATION) { 114 if (DartCoreDebug.ENABLE_DOUBLE_COMPILATION) {
115 latch = new CountDownLatch(1); 115 latch = new CountDownLatch(1);
116 } else { 116 } else {
117 latch = new CountDownLatch(0); 117 latch = new CountDownLatch(0);
118 } 118 }
119 119
120 compiler = new FrogCompiler(); 120 compiler = new Dart2JSCompiler();
121 121
122 console.clear(); 122 console.clear();
123 console.println("Generating JavaScript..."); 123 console.println("Generating JavaScript...");
124 124
125 try { 125 try {
126 if (DartCoreDebug.ENABLE_DOUBLE_COMPILATION) { 126 if (DartCoreDebug.ENABLE_DOUBLE_COMPILATION) {
127 new Thread(new Runnable() { 127 new Thread(new Runnable() {
128 @Override 128 @Override
129 public void run() { 129 public void run() {
130 try { 130 try {
131 runDart2JSCompile(inputPath, outputPath, console); 131 runFrogCompile(inputPath, outputPath, console);
132 } finally { 132 } finally {
133 latch.countDown(); 133 latch.countDown();
134 } 134 }
135 } 135 }
136 }).start(); 136 }).start();
137 } 137 }
138 138
139 CompilationResult result = compiler.compile(inputPath, outputPath, monitor ); 139 CompilationResult result = compiler.compile(inputPath, outputPath, monitor );
140 140
141 refreshResources(library.getCorrespondingResource()); 141 refreshResources(library.getCorrespondingResource());
142 142
143 displayCompilationResult(compiler, result, outputPath, startTime, console) ; 143 displayCompilationResult(compiler, result, outputPath, startTime, console) ;
144 144
145 try { 145 try {
146 latch.await(); 146 latch.await();
147 } catch (InterruptedException ex) { 147 } catch (InterruptedException ex) {
148 148
149 } 149 }
150 150
151 return result; 151 return result;
152 } catch (IOException ioe) { 152 } catch (IOException ioe) {
153 throw new CoreException(new Status(IStatus.ERROR, DartCore.PLUGIN_ID, ioe. toString(), ioe)); 153 throw new CoreException(new Status(IStatus.ERROR, DartCore.PLUGIN_ID, ioe. toString(), ioe));
154 } 154 }
155 } 155 }
156 156
157 protected static void runDart2JSCompile(IPath inputPath, IPath outputPath, Mes sageConsole console) { 157 protected static void runFrogCompile(IPath inputPath, IPath outputPath, Messag eConsole console) {
158 long startTime = System.currentTimeMillis(); 158 long startTime = System.currentTimeMillis();
159 159
160 String outName = outputPath.lastSegment() + "_"; 160 String outName = outputPath.lastSegment() + "_";
161 161
162 outputPath = outputPath.removeLastSegments(1).append(outName); 162 outputPath = outputPath.removeLastSegments(1).append(outName);
163 163
164 FrogCompiler compiler = new Dart2JSCompiler(); 164 FrogCompiler compiler = new FrogCompiler();
165 165
166 try { 166 try {
167 CompilationResult result = compiler.compile(inputPath, outputPath, new Nul lProgressMonitor()); 167 CompilationResult result = compiler.compile(inputPath, outputPath, new Nul lProgressMonitor());
168 168
169 displayCompilationResult(compiler, result, outputPath, startTime, console) ; 169 displayCompilationResult(compiler, result, outputPath, startTime, console) ;
170 } catch (IOException ioe) { 170 } catch (IOException ioe) {
171 DartCore.logError(ioe); 171 DartCore.logError(ioe);
172 } 172 }
173 } 173 }
174 174
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (packageRoot != null) { 286 if (packageRoot != null) {
287 args.add("--package-root=" + packageRoot); 287 args.add("--package-root=" + packageRoot);
288 } 288 }
289 args.add("--out=" + outputPath.toOSString()); 289 args.add("--out=" + outputPath.toOSString());
290 args.add(inputPath.toOSString()); 290 args.add(inputPath.toOSString());
291 291
292 return args; 292 return args;
293 } 293 }
294 294
295 } 295 }
OLDNEW
« no previous file with comments | « client/dart.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698