Skip to content

Commit b5e4a91

Browse files
committed
Add flag to disable hashing
[email protected] Review URL: https://codereview.chromium.org/1088703003
1 parent cafe427 commit b5e4a91

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

pkg/dev_compiler/lib/devc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Compiler {
9191
return new Compiler._(options, resolver, reporter, rules, checker, graph,
9292
entryNode, generators,
9393
// TODO(sigmund): refactor to support hashing of the dart output?
94-
options.serverMode && generators.length == 1 && !options.outputDart);
94+
options.enableHashing && generators.length == 1 && !options.outputDart);
9595
}
9696

9797
Compiler._(this._options, this._resolver, this._reporter, this._rules,

pkg/dev_compiler/lib/src/options.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ class CompilerOptions implements RulesOptions, ResolverOptions, JSCodeOptions {
151151
/// Whether to run as a development server.
152152
final bool serverMode;
153153

154+
/// Whether to enable hash-based caching of files.
155+
final bool enableHashing;
156+
154157
/// Port used for the HTTP server when [serverMode] is on.
155158
final int port;
156159

@@ -232,14 +235,18 @@ class CompilerOptions implements RulesOptions, ResolverOptions, JSCodeOptions {
232235
this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false,
233236
this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE,
234237
this.emitSourceMaps: true, this.entryPointFile: null,
235-
this.serverMode: false, this.host: 'localhost', this.port: 8080,
236-
this.runtimeDir});
238+
this.serverMode: false, this.enableHashing: false, this.host: 'localhost',
239+
this.port: 8080, this.runtimeDir});
237240
}
238241

239242
/// Parses options from the command-line
240243
CompilerOptions parseOptions(List<String> argv) {
241244
ArgResults args = argParser.parse(argv);
242245
var serverMode = args['server'];
246+
var enableHashing = args['hashing'];
247+
if (enableHashing == null) {
248+
enableHashing = serverMode;
249+
}
243250
var logLevel = serverMode ? Level.ALL : Level.SEVERE;
244251
var levelName = args['log'];
245252
if (levelName != null) {
@@ -294,6 +301,7 @@ CompilerOptions parseOptions(List<String> argv) {
294301
emitSourceMaps: args['source-maps'],
295302
entryPointFile: args.rest.length == 0 ? null : args.rest.first,
296303
serverMode: serverMode,
304+
enableHashing: enableHashing,
297305
host: args['host'],
298306
port: int.parse(args['port']),
299307
runtimeDir: runtimeDir);
@@ -360,6 +368,8 @@ final ArgParser argParser = new ArgParser()
360368
// general options
361369
..addFlag('help', abbr: 'h', help: 'Display this message')
362370
..addFlag('server', help: 'Run as a development server.', defaultsTo: false)
371+
..addFlag('hashing',
372+
help: 'Enable hash-based file caching.', defaultsTo: null)
363373
..addOption('host',
364374
help: 'Host name or address to serve files from, e.g. --host=0.0.0.0\n'
365375
'to listen on all interfaces (used only when --serve is on)',

pkg/dev_compiler/test/codegen_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ main(arguments) {
8080
entryPointFile: entryPoint,
8181
dartSdkPath: sdkPath,
8282
runtimeDir: runtimeDir,
83-
serverMode: serverMode);
83+
serverMode: serverMode,
84+
enableHashing: serverMode);
8485
return new Compiler(options).run();
8586
}
8687
var realSdk = getSdkDir(arguments).path;

0 commit comments

Comments
 (0)