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

Side by Side Diff: utils/compiler/build_helper.dart

Issue 10809035: Several new features and improvements for dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 8 years, 5 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 | « utils/apidoc/html_diff.dart ('k') | utils/compiler/compiler.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import('dart:io'); 5 #import('dart:io');
6 #import('dart:uri'); 6 #import('dart:uri');
7 7
8 #import('../../lib/compiler/implementation/util/uri_extras.dart'); 8 #import('../../lib/compiler/implementation/util/uri_extras.dart');
9 #import('../../lib/compiler/implementation/filenames.dart'); 9 #import('../../lib/compiler/implementation/filenames.dart');
10 10
11 main() { 11 main() {
12 List<String> arguments = new Options().arguments; 12 List<String> arguments = new Options().arguments;
13 Uri cwd = getCurrentDirectory(); 13 Uri cwd = getCurrentDirectory();
14 String productDir = appendSlash(nativeToUriPath(arguments[0])); 14 String productDir = appendSlash(nativeToUriPath(arguments[0]));
15 String dartVmPath = nativeToUriPath(arguments[1]); 15 String dartVmPath = nativeToUriPath(arguments[1]);
16 String productionName = nativeToUriPath(arguments[2]); 16 String productionName = nativeToUriPath(arguments[2]);
17 String developerName = nativeToUriPath(arguments[3]); 17 String developerName = nativeToUriPath(arguments[3]);
18 String dartDir = appendSlash(nativeToUriPath(arguments[4])); 18 String dartdocName = nativeToUriPath(arguments[4]);
19 String dartDir = appendSlash(nativeToUriPath(arguments[5]));
19 20
20 Uri dartUri = cwd.resolve(dartDir); 21 Uri dartUri = cwd.resolve(dartDir);
21 Uri productUri = cwd.resolve(productDir); 22 Uri productUri = cwd.resolve(productDir);
22 23
23 Uri dartVmUri = productUri.resolve(dartVmPath); 24 Uri dartVmUri = productUri.resolve(dartVmPath);
24 Uri productionUri = productUri.resolve(arguments[2]); 25 Uri productionUri = productUri.resolve(arguments[2]);
25 Uri developerUri = productUri.resolve(arguments[3]); 26 Uri developerUri = productUri.resolve(arguments[3]);
26 List<String> productionScript = buildScript(dartUri, dartVmUri, ''); 27 Uri dartdocUri = productUri.resolve(arguments[4]);
27 List<String> developerScript = buildScript(dartUri, dartVmUri,
28 ' --enable_checked_mode');
29 28
29 List<String> productionScript = buildScript(
30 'dart2js-production',
31 dartUri, dartVmUri,
32 'lib/compiler/implementation/dart2js.dart', '');
30 writeScript(productionUri, productionScript); 33 writeScript(productionUri, productionScript);
34
35 List<String> developerScript = buildScript(
36 'dart2js-developer',
37 dartUri, dartVmUri,
38 'lib/compiler/implementation/dart2js.dart', ' --enable_checked_mode');
31 writeScript(developerUri, developerScript); 39 writeScript(developerUri, developerScript);
40
41 List<String> dartdocScript = buildScript(
42 'dartdoc',
43 dartUri, dartVmUri,
44 'lib/dartdoc/dartdoc.dart', '');
45 writeScript(dartdocUri, dartdocScript);
32 } 46 }
33 47
34 writeScript(Uri uri, List<String> scripts) { 48 writeScript(Uri uri, List<String> scripts) {
35 String unixScript = scripts[0]; 49 String unixScript = scripts[0];
36 String batFile = scripts[1]; 50 String batFile = scripts[1];
37 var f = new File(uriPathToNative(uri.path)); 51 var f = new File(uriPathToNative(uri.path));
38 var stream = f.openSync(FileMode.WRITE); 52 var stream = f.openSync(FileMode.WRITE);
39 try { 53 try {
40 stream.writeStringSync(unixScript); 54 stream.writeStringSync(unixScript);
41 } finally { 55 } finally {
(...skipping 13 matching lines...) Expand all
55 if (result.exitCode != 0) { 69 if (result.exitCode != 0) {
56 print(result.stdout); 70 print(result.stdout);
57 print(result.stderr); 71 print(result.stderr);
58 exit(result.exitCode); 72 exit(result.exitCode);
59 } 73 }
60 } 74 }
61 Process.run('/bin/chmod', ['+x', uri.path]).then(onExit); 75 Process.run('/bin/chmod', ['+x', uri.path]).then(onExit);
62 } 76 }
63 } 77 }
64 78
65 List<String> buildScript(Uri dartUri, Uri dartVmLocation, String options) { 79 List<String> buildScript(String name,
66 Uri dart2jsUri = dartUri.resolve('lib/compiler/implementation/dart2js.dart'); 80 Uri dartUri, Uri dartVmLocation,
67 String dart2jsPath = relativize(dartVmLocation, dart2jsUri); 81 String entrypoint, String options) {
68 String dart2jsPathWin = dart2jsPath.replaceAll("/", "\\"); 82 Uri uri = dartUri.resolve(entrypoint);
83 String path = relativize(dartVmLocation, uri);
84 String pathWin = path.replaceAll("/", "\\");
69 85
70 print('dartUri = $dartUri'); 86 print('dartUri = $dartUri');
71 print('dartVmLocation = $dartVmLocation'); 87 print('dartVmLocation = $dartVmLocation');
72 print('dart2jsUri = $dart2jsUri'); 88 print('${name}Uri = $uri');
73 print('dart2jsPath = $dart2jsPath'); 89 print('${name}Path = $path');
74 print('dart2jsPathWin = $dart2jsPathWin'); 90 print('${name}PathWin = $pathWin');
75 91
76 // Tell the VM to grow the heap more aggressively. This should only 92 // Tell the VM to grow the heap more aggressively. This should only
77 // be necessary temporarily until the VM is better at detecting how 93 // be necessary temporarily until the VM is better at detecting how
78 // applications use memory. 94 // applications use memory.
79 // TODO(ahe): Remove this option. 95 // TODO(ahe): Remove this option.
80 options = ' --heap_growth_rate=32$options'; 96 options = ' --heap_growth_rate=32$options';
81 97
82 return [ 98 return [
83 ''' 99 '''
84 #!/bin/sh 100 #!/bin/sh
85 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 101 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
86 # for details. All rights reserved. Use of this source code is governed by a 102 # for details. All rights reserved. Use of this source code is governed by a
87 # BSD-style license that can be found in the LICENSE file. 103 # BSD-style license that can be found in the LICENSE file.
88 104
89 BIN_DIR=`dirname \$0` 105 BIN_DIR=`dirname \$0`
90 exec \$BIN_DIR/dart$options \$BIN_DIR/$dart2jsPath "\$@" 106 exec \$BIN_DIR/dart$options \$BIN_DIR/$path "\$@"
91 ''', 107 ''',
92 ''' 108 '''
93 @echo off 109 @echo off
94 REM Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 110 REM Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
95 REM for details. All rights reserved. Use of this source code is governed by a 111 REM for details. All rights reserved. Use of this source code is governed by a
96 REM BSD-style license that can be found in the LICENSE file. 112 REM BSD-style license that can be found in the LICENSE file.
97 113
98 set SCRIPTPATH=%~dp0 114 set SCRIPTPATH=%~dp0
99 115
100 REM Does the path have a trailing slash? If so, remove it. 116 REM Does the path have a trailing slash? If so, remove it.
101 if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1% 117 if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1%
102 118
103 set arguments=%* 119 set arguments=%*
104 120
105 "%SCRIPTPATH%\dart.exe"$options "%SCRIPTPATH%$dart2jsPathWin" %arguments% 121 "%SCRIPTPATH%\dart.exe"$options "%SCRIPTPATH%$pathWin" %arguments%
106 '''.replaceAll('\n', '\r\n')]; 122 '''.replaceAll('\n', '\r\n')];
107 } 123 }
OLDNEW
« no previous file with comments | « utils/apidoc/html_diff.dart ('k') | utils/compiler/compiler.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698