diff --git a/pkg/dev_compiler/bin/devrun.dart b/pkg/dev_compiler/bin/devrun.dart index 38a1318e0a2b..18e8456c5cc9 100755 --- a/pkg/dev_compiler/bin/devrun.dart +++ b/pkg/dev_compiler/bin/devrun.dart @@ -10,13 +10,12 @@ import 'dart:io'; import 'package:dev_compiler/src/compiler.dart' show validateOptions, compile; import 'package:dev_compiler/src/options.dart'; -import 'package:dev_compiler/src/runner/runtime_utils.dart' show - listOutputFiles, getMainModuleName; +import 'package:dev_compiler/src/runner/runtime_utils.dart' + show listOutputFiles, getMainModuleName; import 'package:dev_compiler/src/runner/v8_runner.dart' show V8Runner; import 'package:path/path.dart'; - void _showUsageAndExit() { print('usage: dartdevrun [] \n'); print(' is a single Dart file to run.\n'); @@ -26,7 +25,9 @@ void _showUsageAndExit() { } main(List args) async { - args = []..add('--arrow-fn-bind-this')..addAll(args); + args = [] + ..add('--arrow-fn-bind-this') + ..addAll(args); CompilerOptions options = validateOptions(args, forceOutDir: true); if (options == null || options.help) { @@ -55,8 +56,8 @@ main(List args) async { } /// Generates an HTML file that can be used to run the output with Chrome Dev. -_writeHtmlRunner(CompilerOptions options, List files, - String startStatement) async { +_writeHtmlRunner( + CompilerOptions options, List files, String startStatement) async { String outputDir = options.codegenOptions.outputDir; String htmlOutput = join(outputDir, "run.html"); await new File(htmlOutput).writeAsString(''' @@ -67,7 +68,7 @@ _writeHtmlRunner(CompilerOptions options, List files, '''); - + stderr.writeln( 'Wrote $htmlOutput. It can be opened in Chrome Dev with the following flags:\n' '--js-flags="--harmony-arrow-functions ' diff --git a/pkg/dev_compiler/lib/src/codegen/html_codegen.dart b/pkg/dev_compiler/lib/src/codegen/html_codegen.dart index d7e57422d9c4..6e0f0ece7a10 100644 --- a/pkg/dev_compiler/lib/src/codegen/html_codegen.dart +++ b/pkg/dev_compiler/lib/src/codegen/html_codegen.dart @@ -41,13 +41,10 @@ String generateEntryHtml(HtmlSourceNode root, AbstractCompiler compiler) { var libraries = []; var resources = new Set(); - visitInPostOrder( - root, - (n) { - if (n is DartSourceNode) libraries.add(n); - if (n is ResourceSourceNode) resources.add(n); - }, - includeParts: false); + visitInPostOrder(root, (n) { + if (n is DartSourceNode) libraries.add(n); + if (n is ResourceSourceNode) resources.add(n); + }, includeParts: false); root.htmlResourceNodes.forEach((element, resource) { // Make sure we don't try and add this node again. diff --git a/pkg/dev_compiler/lib/src/runner/runtime_utils.dart b/pkg/dev_compiler/lib/src/runner/runtime_utils.dart index 29cbd3e28fff..1b126624a98f 100644 --- a/pkg/dev_compiler/lib/src/runner/runtime_utils.dart +++ b/pkg/dev_compiler/lib/src/runner/runtime_utils.dart @@ -26,7 +26,8 @@ const _ALIASED_RUNTIME_FILES = const { /// returns null. String getRuntimeFileAlias(CompilerOptions options, File file) => file.absolute.path.startsWith(_getRuntimeDir(options).absolute.path) - ? _ALIASED_RUNTIME_FILES[basename(file.path)] : null; + ? _ALIASED_RUNTIME_FILES[basename(file.path)] + : null; Directory _getRuntimeDir(CompilerOptions options) => new Directory( join(options.codegenOptions.outputDir, 'dev_compiler', 'runtime')); @@ -44,11 +45,11 @@ Future> listOutputFiles(CompilerOptions options) async { int i = defaultRuntimeFiles.indexOf(basename(file.path)); return i < 0 ? maxIndex : i; } - return files..sort((File a, File b) { - int pa = getPriorityIndex(a), - pb = getPriorityIndex(b); - return pa != pb ? (pa - pb) : a.path.compareTo(b.path); - }); + return files + ..sort((File a, File b) { + int pa = getPriorityIndex(a), pb = getPriorityIndex(b); + return pa != pb ? (pa - pb) : a.path.compareTo(b.path); + }); } /// TODO(ochafik): Split / reuse [AbstractCompiler.getModuleName]. diff --git a/pkg/dev_compiler/lib/src/runner/v8_runner.dart b/pkg/dev_compiler/lib/src/runner/v8_runner.dart index ee7a32f79348..dde6eb8784c3 100644 --- a/pkg/dev_compiler/lib/src/runner/v8_runner.dart +++ b/pkg/dev_compiler/lib/src/runner/v8_runner.dart @@ -50,7 +50,8 @@ abstract class V8Runner { String get _v8Binary => _options.runnerOptions.v8Binary; Future start(List files, String startStatement) => - Process.start(_v8Binary, + Process.start( + _v8Binary, [ "--harmony_arrow_functions", "--harmony_classes", @@ -59,7 +60,8 @@ abstract class V8Runner { "--harmony_object_literals", "--harmony_rest_parameters", "--harmony_spreadcalls", - "-e", _GLOBALS + _getLoadStatements(files).join() + startStatement + "-e", + _GLOBALS + _getLoadStatements(files).join() + startStatement ], workingDirectory: _options.codegenOptions.outputDir); @@ -100,7 +102,8 @@ class _NodeRunner extends V8Runner { @override _getLoadStatements(List files) => files.map((file) { - String alias = getRuntimeFileAlias(_options, file); - return (alias != null ? 'var $alias = ' : '') + 'require("${file.path}");'; - }); + String alias = getRuntimeFileAlias(_options, file); + return (alias != null ? 'var $alias = ' : '') + + 'require("${file.path}");'; + }); } diff --git a/pkg/dev_compiler/lib/src/server/dependency_graph.dart b/pkg/dev_compiler/lib/src/server/dependency_graph.dart index 4a591bc9b2fd..71152506d43d 100644 --- a/pkg/dev_compiler/lib/src/server/dependency_graph.dart +++ b/pkg/dev_compiler/lib/src/server/dependency_graph.dart @@ -459,31 +459,28 @@ rebuild(SourceNode start, bool build(SourceNode node)) { .any((i) => apiChangeDetected.contains(i)); } - visitInPostOrder( - start, - (n) { - if (n.structureChanged) htmlNeedsRebuild = true; - if (shouldBuildNode(n)) { - var oldHash = n.cachingHash; - if (build(n)) apiChangeDetected.add(n); - if (oldHash != n.cachingHash) htmlNeedsRebuild = true; - } else if (n is DartSourceNode && - n.exports.any((e) => apiChangeDetected.contains(e))) { - apiChangeDetected.add(n); - } - n.needsRebuild = false; - n.structureChanged = false; - if (n is DartSourceNode) { - // Note: clearing out flags in the parts could be a problem if someone - // tries to use a file both as a part and a library at the same time. - // In that case, we might not correctly propagate changes in the - // places where it is used as a library. - // Technically it's not allowed to have a file as a part and a library - // at once, and the analyzer should report an error in that case. - n.parts.forEach((p) => p.needsRebuild = p.structureChanged = false); - } - }, - includeParts: false); + visitInPostOrder(start, (n) { + if (n.structureChanged) htmlNeedsRebuild = true; + if (shouldBuildNode(n)) { + var oldHash = n.cachingHash; + if (build(n)) apiChangeDetected.add(n); + if (oldHash != n.cachingHash) htmlNeedsRebuild = true; + } else if (n is DartSourceNode && + n.exports.any((e) => apiChangeDetected.contains(e))) { + apiChangeDetected.add(n); + } + n.needsRebuild = false; + n.structureChanged = false; + if (n is DartSourceNode) { + // Note: clearing out flags in the parts could be a problem if someone + // tries to use a file both as a part and a library at the same time. + // In that case, we might not correctly propagate changes in the + // places where it is used as a library. + // Technically it's not allowed to have a file as a part and a library + // at once, and the analyzer should report an error in that case. + n.parts.forEach((p) => p.needsRebuild = p.structureChanged = false); + } + }, includeParts: false); } /// Helper that runs [action] on nodes reachable from [start] in pre-order. diff --git a/pkg/dev_compiler/pubspec.yaml b/pkg/dev_compiler/pubspec.yaml index 1f60159f9adc..e697cbdca8c4 100644 --- a/pkg/dev_compiler/pubspec.yaml +++ b/pkg/dev_compiler/pubspec.yaml @@ -22,7 +22,7 @@ dev_dependencies: # We pin a specific version to ensure everyone is formatting the code exactly # the same way. This is because any change in dart_style, even non-breaking # changes, may change the output format. - dart_style: 0.2.0-rc.3 + dart_style: 0.2.0 pub_semver: ^1.1.0 test: ^0.12.0 environment: diff --git a/pkg/dev_compiler/test/checker/self_host_test.dart b/pkg/dev_compiler/test/checker/self_host_test.dart index 261eb55140d9..a909d06fac92 100644 --- a/pkg/dev_compiler/test/checker/self_host_test.dart +++ b/pkg/dev_compiler/test/checker/self_host_test.dart @@ -11,11 +11,8 @@ import 'package:test/test.dart'; import '../testing.dart' show testDirectory, realSdkContext; void main() { - test( - 'checker can run on itself ', - () { - new BatchCompiler(realSdkContext, new CompilerOptions()) - .compileFromUriString('$testDirectory/all_tests.dart'); - }, - skip: 'test is very slow'); + test('checker can run on itself ', () { + new BatchCompiler(realSdkContext, new CompilerOptions()) + .compileFromUriString('$testDirectory/all_tests.dart'); + }, skip: 'test is very slow'); } diff --git a/pkg/dev_compiler/test/testing.dart b/pkg/dev_compiler/test/testing.dart index 46e926cd6063..71c22fc4f953 100644 --- a/pkg/dev_compiler/test/testing.dart +++ b/pkg/dev_compiler/test/testing.dart @@ -86,10 +86,12 @@ void testChecker(Map testFiles, var provider = createTestResourceProvider(testFiles); var uriResolver = new TestUriResolver(provider); var context = AnalysisEngine.instance.createAnalysisContext(); - context.sourceFactory = createSourceFactory(new SourceResolverOptions( - customUrlMappings: customUrlMappings, - useMockSdk: sdkDir == null, - dartSdkPath: sdkDir), fileResolvers: [uriResolver]); + context.sourceFactory = createSourceFactory( + new SourceResolverOptions( + customUrlMappings: customUrlMappings, + useMockSdk: sdkDir == null, + dartSdkPath: sdkDir), + fileResolvers: [uriResolver]); var checker = new StrongChecker( context,