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

Unified Diff: lib/devc.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 | « no previous file | lib/src/checker/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/devc.dart
diff --git a/lib/devc.dart b/lib/devc.dart
index 8ab4257675a499d9f31465f2fb025f0636ebccce..540eb733c02ff4bbd9e0133d86f252a91b23617a 100644
--- a/lib/devc.dart
+++ b/lib/devc.dart
@@ -55,7 +55,7 @@ class Compiler {
bool _failure = false;
factory Compiler(CompilerOptions options,
- [TypeResolver resolver, CheckerReporter reporter]) {
+ {TypeResolver resolver, CheckerReporter reporter}) {
if (resolver == null) {
resolver = options.useMockSdk
? new TypeResolver.fromMock(mockSdkSources, options)
@@ -71,12 +71,15 @@ class Compiler {
var rules =
new RestrictedRules(resolver.context.typeProvider, options: options);
var checker = new CodeChecker(rules, reporter, options);
+
var inputFile = options.entryPointFile;
- var uri = inputFile.startsWith('dart:') || inputFile.startsWith('package:')
+ var inputUri = inputFile.startsWith('dart:') ||
+ inputFile.startsWith('package:')
? Uri.parse(inputFile)
- : new Uri.file(path.absolute(inputFile));
- var entryNode = graph.nodeFromUri(uri);
-
+ : new Uri.file(path.absolute(options.useImplicitHtml
+ ? ResolverOptions.implicitHtmlFile
+ : inputFile));
+ var entryNode = graph.nodeFromUri(inputUri);
var outputDir = options.outputDir;
var generators = <CodeGenerator>[];
if (options.dumpSrcDir != null) {
@@ -247,8 +250,9 @@ class CompilerServer {
factory CompilerServer(CompilerOptions options) {
var entryPath = path.basename(options.entryPointFile);
- if (path.extension(entryPath) != '.html') {
- print('error: devc in server mode requires an HTML entry point.');
+ var extension = path.extension(entryPath);
+ if (extension != '.html' && !options.useImplicitHtml) {
+ print('error: devc in server mode requires an HTML or Dart entry point.');
exit(1);
}
@@ -266,7 +270,11 @@ class CompilerServer {
}
CompilerServer._(
- this.compiler, this.outDir, this.host, this.port, this._entryPath);
+ Compiler compiler, this.outDir, this.host, this.port, String entryPath)
+ : this.compiler = compiler,
+ this._entryPath = compiler._options.useImplicitHtml
+ ? ResolverOptions.implicitHtmlFile
+ : entryPath;
Future start() async {
// Create output directory if needed. shelf_static will fail otherwise.
« no previous file with comments | « no previous file | lib/src/checker/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698