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

Unified Diff: lib/src/options.dart

Issue 1130093007: Create html if needed in server mode (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Address comments Created 5 years, 7 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 | « lib/src/in_memory.dart ('k') | lib/src/testing.dart » ('j') | 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 50282e321f9f23995255417043f0b90b7e01bc3f..77748c350e9065b65ef62c55533e61302b8a1729 100644
--- a/lib/src/options.dart
+++ b/lib/src/options.dart
@@ -51,11 +51,19 @@ class ResolverOptions {
final bool onlyInferConstsAndFinalFields;
static const onlyInferConstAndFinalFieldsDefault = false;
+ /// File where to start compilation from.
+ final String entryPointFile;
+
+ // True if the resolver should implicitly provide an html entry point.
+ final bool useImplicitHtml;
+ static const String implicitHtmlFile = 'index.html';
+
ResolverOptions({this.useMultiPackage: false, this.packageRoot: 'packages/',
this.packagePaths: const <String>[],
this.inferFromOverrides: inferFromOverridesDefault,
this.inferTransitively: inferTransitivelyDefault,
- this.onlyInferConstsAndFinalFields: onlyInferConstAndFinalFieldsDefault});
+ this.onlyInferConstsAndFinalFields: onlyInferConstAndFinalFieldsDefault,
+ this.entryPointFile: null, this.useImplicitHtml: false});
}
// TODO(vsm): Merge RulesOptions and TypeOptions
@@ -151,6 +159,9 @@ class CompilerOptions implements RulesOptions, ResolverOptions, JSCodeOptions {
/// Whether to run as a development server.
final bool serverMode;
+ /// Whether to create an implicit HTML entry file in server mode.
+ final bool useImplicitHtml;
+
/// Whether to enable hash-based caching of files.
final bool enableHashing;
@@ -235,8 +246,9 @@ class CompilerOptions implements RulesOptions, ResolverOptions, JSCodeOptions {
this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false,
this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE,
this.emitSourceMaps: true, this.entryPointFile: null,
- this.serverMode: false, this.enableHashing: false, this.host: 'localhost',
- this.port: 8080, this.runtimeDir});
+ this.serverMode: false, this.useImplicitHtml: false,
+ this.enableHashing: false, this.host: 'localhost', this.port: 8080,
+ this.runtimeDir});
}
/// Parses options from the command-line
@@ -270,6 +282,8 @@ CompilerOptions parseOptions(List<String> argv) {
var dumpInfo = args['dump-info'];
if (dumpInfo == null) dumpInfo = serverMode;
+ var entryPointFile = args.rest.length == 0 ? null : args.rest.first;
+
return new CompilerOptions(
allowConstCasts: args['allow-const-casts'],
checkSdk: args['sdk-check'],
@@ -299,8 +313,9 @@ CompilerOptions parseOptions(List<String> argv) {
dartSdkPath: sdkPath,
logLevel: logLevel,
emitSourceMaps: args['source-maps'],
- entryPointFile: args.rest.length == 0 ? null : args.rest.first,
+ entryPointFile: entryPointFile,
serverMode: serverMode,
+ useImplicitHtml: serverMode && entryPointFile.endsWith('.dart'),
enableHashing: enableHashing,
host: args['host'],
port: int.parse(args['port']),
« no previous file with comments | « lib/src/in_memory.dart ('k') | lib/src/testing.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698