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

Side by Side Diff: options.dart

Issue 8437081: Frog changes (in experimental) to get frog integrated into the test infrastructure. (Closed) Base URL: http://dart.googlecode.com/svn/experimental/frog/
Patch Set: '' Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** General options used by the compiler. */ 5 /** General options used by the compiler. */
6 Options options; 6 Options options;
7 7
8 /** Extracts options from command-line arguments. */ 8 /** Extracts options from command-line arguments. */
9 void parseOptions(String homedir, List<String> args) { 9 void parseOptions(String homedir, List<String> args, FileSystem files) {
10 assert(options == null); 10 assert(options == null);
11 options = new Options(homedir, args); 11 options = new Options(homedir, args, files);
12 } 12 }
13 13
14 // TODO(sigmund): make into a generic option parser... 14 // TODO(sigmund): make into a generic option parser...
15 class Options { 15 class Options {
16 /** Location of corelib and other special dart libraries. */ 16 /** Location of corelib and other special dart libraries. */
17 String libDir; 17 String libDir;
18 18
19 /* The top-level dart script to compile. */ 19 /* The top-level dart script to compile. */
20 String dartScript; 20 String dartScript;
21 21
(...skipping 15 matching lines...) Expand all
37 bool throwOnFatal = false; 37 bool throwOnFatal = false;
38 bool showInfo = false; 38 bool showInfo = false;
39 bool showWarnings = true; 39 bool showWarnings = true;
40 40
41 /** 41 /**
42 * Options to be used later for passing to the generated code. These are all 42 * Options to be used later for passing to the generated code. These are all
43 * the arguments after the first dart script, if any. 43 * the arguments after the first dart script, if any.
44 */ 44 */
45 List<String> childArgs; 45 List<String> childArgs;
46 46
47 Options(String homedir, List<String> args) { 47 Options(String homedir, List<String> args, FileSystem files) {
48 libDir = homedir + '/lib'; // Default value for --libdir. 48 libDir = homedir + '/lib'; // Default value for --libdir.
49 bool ignoreUnrecognizedFlags = false; 49 bool ignoreUnrecognizedFlags = false;
50 bool passedLibDir = false;
51 childArgs = [];
50 52
51 // Start from 2 to skip arguments representing the compiler command 53 // Start from 2 to skip arguments representing the compiler command
52 // (node/python followed by frogsh/frog.py). 54 // (node/python followed by frogsh/frog.py).
53 // TODO(jimhug): break on switch cases seems broken? 55 // TODO(jimhug): break on switch cases seems broken?
54 loop: for (int i = 2; i < args.length; i++) { 56 loop: for (int i = 2; i < args.length; i++) {
55 var arg = args[i]; 57 var arg = args[i];
56 58
57 switch (arg) { 59 switch (arg) {
58 case '--enable_leg': 60 case '--enable_leg':
59 enableLeg = true; 61 enableLeg = true;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 101
100 case '--compile-only': 102 case '--compile-only':
101 // As opposed to compiling and running, the default behavior. 103 // As opposed to compiling and running, the default behavior.
102 compileOnly = true; 104 compileOnly = true;
103 continue loop; 105 continue loop;
104 106
105 default: 107 default:
106 if (arg.endsWith('.dart')) { 108 if (arg.endsWith('.dart')) {
107 dartScript = arg; 109 dartScript = arg;
108 childArgs = args.getRange(i + 1, args.length - i - 1); 110 childArgs = args.getRange(i + 1, args.length - i - 1);
109 return; 111 break loop;
110 } else if (arg.startsWith('--out=')) { 112 } else if (arg.startsWith('--out=')) {
111 outfile = arg.substring('--out='.length); 113 outfile = arg.substring('--out='.length);
112 } else if (arg.startsWith('--libdir=')) { 114 } else if (arg.startsWith('--libdir=')) {
113 libDir = arg.substring('--libdir='.length); 115 libDir = arg.substring('--libdir='.length);
116 passedLibDir = true;
114 } else { 117 } else {
115 if (!ignoreUnrecognizedFlags) { 118 if (!ignoreUnrecognizedFlags) {
116 print('unrecognized flag: "$arg"'); 119 print('unrecognized flag: "$arg"');
117 } 120 }
118 } 121 }
119 } 122 }
120 } 123 }
121 childArgs = []; 124
125 if (!passedLibDir && !files.fileExists(libDir)) {
126 // Try locally
127 var temp = 'frog/lib';
128 if (files.fileExists(temp)) {
129 libDir = temp;
130 } else {
131 libDir = 'lib';
132 }
133 }
122 } 134 }
123 } 135 }
OLDNEW
« no previous file with comments | « frogsh ('k') | presubmit.py » ('j') | scripts/buildbot_annotated_steps.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698