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

Side by Side Diff: pkg/polymer/lib/src/compiler_options.dart

Issue 23445009: Prune the old deploy code. This CL does a few changes: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | « pkg/polymer/lib/src/compiler.dart ('k') | pkg/polymer/lib/src/css_emitters.dart » ('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 library polymer.src.compiler_options; 5 library polymer.src.compiler_options;
6 6
7 import 'package:args/args.dart'; 7 import 'package:args/args.dart';
8 8
9 class CompilerOptions { 9 class CompilerOptions {
10 /** Report warnings as errors. */ 10 /** Report warnings as errors. */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 * Dart editor. 49 * Dart editor.
50 */ 50 */
51 final bool jsonFormat; 51 final bool jsonFormat;
52 52
53 /** Emulate scoped styles using a CSS polyfill. */ 53 /** Emulate scoped styles using a CSS polyfill. */
54 final bool emulateScopedCss; 54 final bool emulateScopedCss;
55 55
56 /** Use CSS file for CSS Reset. */ 56 /** Use CSS file for CSS Reset. */
57 final String resetCssFile; 57 final String resetCssFile;
58 58
59 /** Whether to analyze the input for warnings without generating any code. */
60 final bool analysisOnly;
61
62 // We could make this faster, if it ever matters. 59 // We could make this faster, if it ever matters.
63 factory CompilerOptions() => parse(['']); 60 factory CompilerOptions() => parse(['']);
64 61
65 CompilerOptions.fromArgs(ArgResults args) 62 CompilerOptions.fromArgs(ArgResults args)
66 : warningsAsErrors = args['warnings_as_errors'], 63 : warningsAsErrors = args['warnings_as_errors'],
67 verbose = args['verbose'], 64 verbose = args['verbose'],
68 clean = args['clean'], 65 clean = args['clean'],
69 useColors = args['colors'], 66 useColors = args['colors'],
70 baseDir = args['basedir'], 67 baseDir = args['basedir'],
71 outputDir = args['out'], 68 outputDir = args['out'],
72 packageRoot = args['package-root'], 69 packageRoot = args['package-root'],
73 rewriteUrls = args['rewrite-urls'], 70 rewriteUrls = args['rewrite-urls'],
74 forceMangle = args['unique_output_filenames'], 71 forceMangle = args['unique_output_filenames'],
75 jsonFormat = args['json_format'], 72 jsonFormat = args['json_format'],
76 componentsOnly = args['components_only'], 73 componentsOnly = args['components_only'],
77 emulateScopedCss = args['scoped-css'], 74 emulateScopedCss = args['scoped-css'],
78 resetCssFile = args['css-reset'], 75 resetCssFile = args['css-reset'],
79 analysisOnly = !args['deploy'],
80 inputFile = args.rest.length > 0 ? args.rest[0] : null; 76 inputFile = args.rest.length > 0 ? args.rest[0] : null;
81 77
82 /** 78 /**
83 * Returns the compiler options parsed from [arguments]. Set [checkUsage] to 79 * Returns the compiler options parsed from [arguments]. Set [checkUsage] to
84 * false to suppress checking of correct usage or printing help messages. 80 * false to suppress checking of correct usage or printing help messages.
85 */ 81 */
86 // TODO(sigmund): convert all flags to use dashes instead of underscores 82 // TODO(sigmund): convert all flags to use dashes instead of underscores
87 static CompilerOptions parse(List<String> arguments, 83 static CompilerOptions parse(List<String> arguments,
88 {bool checkUsage: true}) { 84 {bool checkUsage: true}) {
89 var parser = new ArgParser() 85 var parser = new ArgParser()
(...skipping 19 matching lines...) Expand all
109 help: 'Print error messsages in a json format easy to parse by tools,' 105 help: 'Print error messsages in a json format easy to parse by tools,'
110 ' such as the Dart editor', 106 ' such as the Dart editor',
111 defaultsTo: false, negatable: false) 107 defaultsTo: false, negatable: false)
112 ..addFlag('components_only', 108 ..addFlag('components_only',
113 help: 'Generate only the code for component classes, do not generate ' 109 help: 'Generate only the code for component classes, do not generate '
114 'HTML files or the main bootstrap code.', 110 'HTML files or the main bootstrap code.',
115 defaultsTo: false, negatable: false) 111 defaultsTo: false, negatable: false)
116 ..addFlag('scoped-css', help: 'Emulate scoped styles with CSS polyfill', 112 ..addFlag('scoped-css', help: 'Emulate scoped styles with CSS polyfill',
117 defaultsTo: false) 113 defaultsTo: false)
118 ..addOption('css-reset', abbr: 'r', help: 'CSS file used to reset CSS') 114 ..addOption('css-reset', abbr: 'r', help: 'CSS file used to reset CSS')
119 ..addFlag('deploy', help: 'Emit code used for deploying a polymer app,' 115 // TODO(sigmund): remove this flag
120 ' if false just show warnings and errors (default)', 116 ..addFlag('deploy', help: '(deprecated) currently a noop',
121 defaultsTo: false, negatable: false) 117 defaultsTo: false, negatable: false)
122 ..addOption('out', abbr: 'o', help: 'Directory where to generate files' 118 ..addOption('out', abbr: 'o', help: 'Directory where to generate files'
123 ' (defaults to the same directory as the source file)') 119 ' (defaults to the same directory as the source file)')
124 ..addOption('basedir', help: 'Base directory where to find all source ' 120 ..addOption('basedir', help: 'Base directory where to find all source '
125 'files (defaults to the source file\'s directory)') 121 'files (defaults to the source file\'s directory)')
126 ..addOption('package-root', help: 'Where to find "package:" imports' 122 ..addOption('package-root', help: 'Where to find "package:" imports'
127 '(defaults to the "packages/" subdirectory next to the source file)') 123 '(defaults to the "packages/" subdirectory next to the source file)')
128 ..addFlag('help', abbr: 'h', help: 'Displays this help message', 124 ..addFlag('help', abbr: 'h', help: 'Displays this help message',
129 defaultsTo: false, negatable: false); 125 defaultsTo: false, negatable: false);
130 try { 126 try {
131 var results = parser.parse(arguments); 127 var results = parser.parse(arguments);
132 if (checkUsage && (results['help'] || results.rest.length == 0)) { 128 if (checkUsage && (results['help'] || results.rest.length == 0)) {
133 showUsage(parser); 129 showUsage(parser);
134 return null; 130 return null;
135 } 131 }
136 return new CompilerOptions.fromArgs(results); 132 return new CompilerOptions.fromArgs(results);
137 } on FormatException catch (e) { 133 } on FormatException catch (e) {
138 print(e.message); 134 print(e.message);
139 showUsage(parser); 135 showUsage(parser);
140 return null; 136 return null;
141 } 137 }
142 } 138 }
143 139
144 static showUsage(parser) { 140 static showUsage(parser) {
145 print('Usage: dwc [options...] input.html'); 141 print('Usage: dwc [options...] input.html');
146 print(parser.getUsage()); 142 print(parser.getUsage());
147 } 143 }
148 } 144 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/compiler.dart ('k') | pkg/polymer/lib/src/css_emitters.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698