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

Unified Diff: lib/src/options.dart

Issue 1007703004: Change defaults in server mode (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/options.dart
diff --git a/lib/src/options.dart b/lib/src/options.dart
index 238dafa74180c63a47300da2df84a6ee126b8aa0..33be8d97fa942c6f7daf28d8202a9fa6f6604bc6 100644
--- a/lib/src/options.dart
+++ b/lib/src/options.dart
@@ -218,7 +218,14 @@ class CompilerOptions implements RulesOptions, ResolverOptions, JSCodeOptions {
/// Parses options from the command-line
CompilerOptions parseOptions(List<String> argv) {
ArgResults args = argParser.parse(argv);
- var levelName = args['log'].toUpperCase();
+ var serverMode = args['server'];
+ var logLevel = serverMode ? Level.ALL : Level.SEVERE;
+ var levelName = args['log'];
+ if (levelName != null) {
+ levelName = levelName.toUpperCase();
+ logLevel = Level.LEVELS.firstWhere((l) => l.name == levelName,
+ orElse: () => logLevel);
+ }
var useColors = stdioType(stdout) == StdioType.TERMINAL;
var sdkPath = args['dart-sdk'];
if (sdkPath == null && !args['mock-sdk']) {
@@ -228,17 +235,21 @@ CompilerOptions parseOptions(List<String> argv) {
if (runtimeDir == null) {
runtimeDir = _computeRuntimeDir();
}
+ var outputDir = args['out'];
+ if (outputDir == null && serverMode) {
+ outputDir = Directory.systemTemp.createTempSync("dev_compiler_out_").path;
+ }
return new CompilerOptions(
allowConstCasts: args['allow-const-casts'],
checkSdk: args['sdk-check'],
- dumpInfo: args['dump-info'],
+ dumpInfo: args['dump-info'] || serverMode,
dumpInfoFile: args['dump-info-file'],
dumpSrcDir: args['dump-src-to'],
- forceCompile: args['force-compile'],
+ forceCompile: args['force-compile'] || serverMode,
formatOutput: args['dart-gen-fmt'],
ignoreTypes: args['ignore-types'],
outputDart: args['dart-gen'],
- outputDir: args['out'],
+ outputDir: outputDir,
covariantGenerics: args['covariant-generics'],
relaxedCasts: args['relaxed-casts'],
useColors: useColors,
@@ -253,11 +264,10 @@ CompilerOptions parseOptions(List<String> argv) {
help: args['help'],
useMockSdk: args['mock-sdk'],
dartSdkPath: sdkPath,
- logLevel: Level.LEVELS.firstWhere((Level l) => l.name == levelName,
- orElse: () => Level.SEVERE),
+ logLevel: logLevel,
emitSourceMaps: args['source-maps'],
entryPointFile: args.rest.length == 0 ? null : args.rest.first,
- serverMode: args['server'],
+ serverMode: serverMode,
port: int.parse(args['port']),
runtimeDir: runtimeDir);
}
@@ -321,7 +331,7 @@ final ArgParser argParser = new ArgParser()
defaultsTo: '8080')
..addFlag('force-compile',
help: 'Compile code with static errors', defaultsTo: false)
- ..addOption('log', abbr: 'l', help: 'Logging level', defaultsTo: 'severe')
+ ..addOption('log', abbr: 'l', help: 'Logging level (defaults to severe)')
..addFlag('dump-info',
abbr: 'i', help: 'Dump summary information', defaultsTo: false)
Jennifer Messerly 2015/03/19 22:32:22 do we need to fix this option to?
Siggi Cherem (dart-lang) 2015/03/19 22:44:50 Unfortunately we can't with 'flags'. Boolean flags
Jennifer Messerly 2015/03/19 22:47:59 just have --server imply it?
Siggi Cherem (dart-lang) 2015/03/19 22:50:12 Done.
..addOption('dump-info-file',
« 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