diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a44966d852..9c33a3ce9d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ yet in the issue tracker, start by opening an issue. Thanks! 1. `grind` is needed to run dartdoc integration tests, see installed via `pub global activate grinder`. 2. When a change is user-facing, please add a new entry to the [changelog](https://github.com/dart-lang/dartdoc/blob/master/CHANGELOG.md) 3. Please include a test for your change. `dartdoc` has both `package:test`-style unittests as well as integration tests. To run the unittests, use `dart test/all.dart`. Most changes can be tested via a unittest, but some require modifying the [test_package](https://github.com/dart-lang/dartdoc/tree/master/testing/test_package) and regenerating its docs via `grind update-test-package-docs`. -4. For major changes, run `grind compare-sdk-warnings` and include the summary results in your pull request. +4. For major changes, run `grind compare-sdk-warnings` and `grind compare-flutter-warnings`, and include the summary results in your pull request. 5. Be sure to format your Dart code using `dartfmt -w`, otherwise travis will complain. 6. Post your change via a pull request for review and integration! diff --git a/lib/dartdoc.dart b/lib/dartdoc.dart index acbf0c95c9..a9b7e90cf0 100644 --- a/lib/dartdoc.dart +++ b/lib/dartdoc.dart @@ -107,7 +107,8 @@ class DartDoc extends PackageBuilder { // That seems wrong. dart-lang/dartdoc#1547 for (Source source in sources) { ErrorsResult errorsResult = await driver.getErrors(source.fullName); - AnalysisErrorInfo info = new AnalysisErrorInfoImpl(errorsResult.errors, errorsResult.lineInfo); + AnalysisErrorInfo info = + new AnalysisErrorInfoImpl(errorsResult.errors, errorsResult.lineInfo); List<_Error> errors = [info] .expand((AnalysisErrorInfo info) { return info.errors.map((error) => @@ -133,7 +134,9 @@ class DartDoc extends PackageBuilder { }) .where((_Error error) => error.isError) // TODO(jcollins-g): remove after conversion to analysis driver - .where((_Error error) => error.error.errorCode != CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED) + .where((_Error error) => + error.error.errorCode != + CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED) .toList() ..sort(); diff --git a/lib/src/io_utils.dart b/lib/src/io_utils.dart index e422bdf598..6554c1b22b 100644 --- a/lib/src/io_utils.dart +++ b/lib/src/io_utils.dart @@ -88,8 +88,8 @@ class SubprocessLauncher { }); } - SubprocessLauncher(this.context, [Map environment]) : - this.environment = environment ?? {}; + SubprocessLauncher(this.context, [Map environment]) + : this.environment = environment ?? {}; /// A wrapper around start/await process.exitCode that will display the /// output of the executable continuously and fail on non-zero exit codes. @@ -165,52 +165,3 @@ class SubprocessLauncher { return jsonObjects; } } - -/// Output formatter for comparing warnings. -String printWarningDelta(String title, String dartdocOriginalBranch, - Map original, Map current) { - StringBuffer printBuffer = new StringBuffer(); - Set quantityChangedOuts = new Set(); - Set onlyOriginal = new Set(); - Set onlyCurrent = new Set(); - Set allKeys = - new Set.from([]..addAll(original.keys)..addAll(current.keys)); - - for (String key in allKeys) { - if (original.containsKey(key) && !current.containsKey(key)) { - onlyOriginal.add(key); - } else if (!original.containsKey(key) && current.containsKey(key)) { - onlyCurrent.add(key); - } else if (original.containsKey(key) && - current.containsKey(key) && - original[key] != current[key]) { - quantityChangedOuts.add(key); - } - } - - if (onlyOriginal.isNotEmpty) { - printBuffer.writeln( - '*** $title : ${onlyOriginal.length} warnings from original ($dartdocOriginalBranch) missing in current:'); - onlyOriginal.forEach((warning) => printBuffer.writeln(warning)); - } - if (onlyCurrent.isNotEmpty) { - printBuffer.writeln( - '*** $title : ${onlyCurrent.length} new warnings not in original ($dartdocOriginalBranch)'); - onlyCurrent.forEach((warning) => printBuffer.writeln(warning)); - } - if (quantityChangedOuts.isNotEmpty) { - printBuffer.writeln('*** $title : Identical warning quantity changed'); - for (String key in quantityChangedOuts) { - printBuffer.writeln( - "* Appeared ${original[key]} times in original ($dartdocOriginalBranch), now ${current[key]}:"); - printBuffer.writeln(key); - } - } - if (onlyOriginal.isEmpty && - onlyCurrent.isEmpty && - quantityChangedOuts.isEmpty) { - printBuffer.writeln( - '*** $title : No difference in warning output from original ($dartdocOriginalBranch)${allKeys.isEmpty ? "" : " (${allKeys.length} warnings found)"}'); - } - return printBuffer.toString(); -} diff --git a/test/grind_test.dart b/test/grind_test.dart new file mode 100644 index 0000000000..f4b8bece10 --- /dev/null +++ b/test/grind_test.dart @@ -0,0 +1,82 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library dartdoc.io_utils_test; + +import 'package:test/test.dart'; + +import '../tool/grind.dart' hide test; + +void main() { + group('printWarningDelta', () { + WarningsCollection original, current; + WarningsCollection originalWithDirs, currentWithDirs; + setUp(() { + original = + new WarningsCollection('/a/tempdir', '/pubcache/path', 'oldbranch'); + original.add('originalwarning'); + original.add('morewarning'); + original.add('duplicateoriginalwarning'); + original.add('duplicateoriginalwarning'); + current = + new WarningsCollection('/a/tempdir2', '/pubcache/path2', 'current'); + current.add('newwarning'); + current.add('morewarning'); + current.add('duplicateoriginalwarning'); + originalWithDirs = new WarningsCollection( + '/a/tempdirFOO', '/pubcache/pathFOO', 'DirsOriginal'); + originalWithDirs.add( + 'originalWarning found in /a/tempdirFOO/some/subdir/program.dart!!!!'); + originalWithDirs.add( + 'another originalWarning found in /pubcache/pathFOO/some/package/lib/thingy.dart!!!'); + originalWithDirs.add( + 'insufficent exclamation mark warning found in /pubcache/pathFOO/some/package/lib/thingy.dart.'); + originalWithDirs.add( + 'another originalWarning found in /a/tempdirFOO/some/subdir/program.dart'); + currentWithDirs = new WarningsCollection( + '/a/tempdirBAR', '/pubcache/pathBAR', 'DirsCurrent'); + currentWithDirs.add( + 'originalWarning found in /a/tempdirBAR/some/subdir/program.dart!!!!'); + currentWithDirs.add( + 'another originalWarning found in /pubcache/pathBAR/some/package/lib/thingy.dart!!!'); + currentWithDirs.add( + 'insufficent exclamation mark warning found in /pubcache/pathBAR/some/package/lib/thingy.dart.'); + currentWithDirs.add( + 'another originalWarning found in /a/tempdirBAR/some/other/subdir/program.dart'); + }); + + test('verify that paths are substituted when comparing warnings', () { + expect( + originalWithDirs.getPrintableWarningDelta( + 'Dirs diff title', currentWithDirs), + equals( + '*** Dirs diff title : 1 warnings from DirsOriginal, missing in DirsCurrent:\n' + 'another originalWarning found in /a/tempdirFOO/some/subdir/program.dart\n' + '*** Dirs diff title : 1 new warnings in DirsCurrent, missing in DirsOriginal\n' + 'another originalWarning found in /a/tempdirBAR/some/other/subdir/program.dart\n' + '*** Dirs diff title : Difference in warning output found for 2 warnings (5 warnings found)"\n')); + }); + + test('verify output of printWarningDelta', () { + expect( + original.getPrintableWarningDelta('Diff Title', current), + equals( + '*** Diff Title : 1 warnings from oldbranch, missing in current:\n' + 'originalwarning\n' + '*** Diff Title : 1 new warnings in current, missing in oldbranch\n' + 'newwarning\n' + '*** Diff Title : Identical warning quantity changed\n' + '* Appeared 2 times in oldbranch, 1 in current:\n' + 'duplicateoriginalwarning\n' + '*** Diff Title : Difference in warning output found for 3 warnings (4 warnings found)"\n')); + }); + + test('verify output when nothing changes', () { + expect( + original.getPrintableWarningDelta('Diff Title 2', original), + equals( + '*** Diff Title 2 : No difference in warning output from oldbranch to oldbranch (3 warnings found)\n')); + }); + }); +} diff --git a/test/io_utils_test.dart b/test/io_utils_test.dart index a550e249fe..5b0548c4ca 100644 --- a/test/io_utils_test.dart +++ b/test/io_utils_test.dart @@ -17,36 +17,4 @@ void main() { expect(getFileNameFor('dartdoc.generator'), 'dartdoc-generator.html'); }); }); - - group('printWarningDelta', () { - Map original; - Map current; - setUp(() { - original = new Map.fromIterables( - ["originalwarning", "morewarning", "duplicateoriginalwarning"], - [1, 1, 2]); - current = new Map.fromIterables( - ["newwarning", "morewarning", "duplicateoriginalwarning"], [1, 1, 1]); - }); - - test('verify output of printWarningDelta', () { - expect( - printWarningDelta('Diff Title', 'oldbranch', original, current), - equals( - '*** Diff Title : 1 warnings from original (oldbranch) missing in current:\n' - 'originalwarning\n' - '*** Diff Title : 1 new warnings not in original (oldbranch)\n' - 'newwarning\n' - '*** Diff Title : Identical warning quantity changed\n' - '* Appeared 2 times in original (oldbranch), now 1:\n' - 'duplicateoriginalwarning\n')); - }); - - test('verify output when nothing changes', () { - expect( - printWarningDelta('Diff Title 2', 'oldbranch2', original, original), - equals( - '*** Diff Title 2 : No difference in warning output from original (oldbranch2) (3 warnings found)\n')); - }); - }); } diff --git a/test/model_test.dart b/test/model_test.dart index e88e0551bf..3e3593f4d0 100644 --- a/test/model_test.dart +++ b/test/model_test.dart @@ -320,10 +320,10 @@ void main() { dog.allInstanceMethods.firstWhere((m) => m.name == 'withMacro'); withMacro2 = dog.allInstanceMethods.firstWhere((m) => m.name == 'withMacro2'); - withPrivateMacro = - dog.allInstanceMethods.firstWhere((m) => m.name == 'withPrivateMacro'); - withUndefinedMacro = - dog.allInstanceMethods.firstWhere((m) => m.name == 'withUndefinedMacro'); + withPrivateMacro = dog.allInstanceMethods + .firstWhere((m) => m.name == 'withPrivateMacro'); + withUndefinedMacro = dog.allInstanceMethods + .firstWhere((m) => m.name == 'withUndefinedMacro'); package.allModelElements.forEach((m) => m.documentation); }); @@ -342,7 +342,10 @@ void main() { }); test("a warning is generated for unknown macros", () { - expect(package.packageWarningCounter.hasWarning(withUndefinedMacro, PackageWarning.unknownMacro, 'ThatDoesNotExist'), isTrue); + expect( + package.packageWarningCounter.hasWarning(withUndefinedMacro, + PackageWarning.unknownMacro, 'ThatDoesNotExist'), + isTrue); }); }); @@ -1908,7 +1911,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, deprecated = exLibrary.constants.firstWhere((c) => c.name == 'deprecated'); Class Dog = exLibrary.allClasses.firstWhere((c) => c.name == 'Dog'); - customClassPrivate = fakeLibrary.constants.firstWhere((c) => c.name == 'CUSTOM_CLASS_PRIVATE'); + customClassPrivate = fakeLibrary.constants + .firstWhere((c) => c.name == 'CUSTOM_CLASS_PRIVATE'); aStaticConstField = Dog.allFields.firstWhere((f) => f.name == 'aStaticConstField'); aName = Dog.allFields.firstWhere((f) => f.name == 'aName'); @@ -1957,7 +1961,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); test('MY_CAT is linked', () { - expect(cat.constantValue, 'const ConstantCat('tabby')'); + expect(cat.constantValue, + 'const ConstantCat('tabby')'); }); test('exported property', () { @@ -2090,7 +2095,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, test('linked return type', () { expect(t.linkedReturnType, equals('String')); - expect(generic.linkedReturnType, equals('List<S>')); + expect(generic.linkedReturnType, + equals('List<S>')); }); test("name with generics", () { diff --git a/test/src/utils.dart b/test/src/utils.dart index d47f9d2193..c7504f727b 100644 --- a/test/src/utils.dart +++ b/test/src/utils.dart @@ -42,7 +42,8 @@ init() async { testPackageGinormous = await bootBasicPackage( 'testing/test_package', ['css', 'code_in_commnets', 'excluded'], true); - testPackageSmall = await bootBasicPackage('testing/test_package_small', [], false); + testPackageSmall = + await bootBasicPackage('testing/test_package_small', [], false); testPackageSdk = await bootSdkPackage(); } diff --git a/tool/grind.dart b/tool/grind.dart index 6d29a521ef..bc1a487cf4 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -81,15 +81,105 @@ Future buildSdkDocs() async { sdkDocsDir.path, new Future.value(Directory.current.path)); } +class WarningsCollection { + final String tempDir; + final Map _warningKeyCounts; + final String branch; + final String pubCachePath; + WarningsCollection(this.tempDir, this.pubCachePath, this.branch) + : this._warningKeyCounts = new Map() {} + + static const String kPubCachePathReplacement = '_xxxPubDirectoryxxx_'; + static const String kTempDirReplacement = '_xxxTempDirectoryxxx_'; + + String _toKey(String text) { + String key = text.replaceAll(tempDir, kTempDirReplacement); + if (pubCachePath != null) + key = key.replaceAll(pubCachePath, kPubCachePathReplacement); + return key; + } + + String _fromKey(String text) { + String key = text.replaceAll(kTempDirReplacement, tempDir); + if (pubCachePath != null) + key = key.replaceAll(kPubCachePathReplacement, pubCachePath); + return key; + } + + void add(String text) { + String key = _toKey(text); + _warningKeyCounts.putIfAbsent(key, () => 0); + _warningKeyCounts[key]++; + } + + /// Output formatter for comparing warnings. [this] is the original. + String getPrintableWarningDelta(String title, WarningsCollection current) { + StringBuffer printBuffer = new StringBuffer(); + Set quantityChangedOuts = new Set(); + Set onlyOriginal = new Set(); + Set onlyCurrent = new Set(); + Set identical = new Set(); + Set allKeys = new Set.from([] + ..addAll(_warningKeyCounts.keys) + ..addAll(current._warningKeyCounts.keys)); + + for (String key in allKeys) { + if (_warningKeyCounts.containsKey(key) && + !current._warningKeyCounts.containsKey(key)) { + onlyOriginal.add(key); + } else if (!_warningKeyCounts.containsKey(key) && + current._warningKeyCounts.containsKey(key)) { + onlyCurrent.add(key); + } else if (_warningKeyCounts.containsKey(key) && + current._warningKeyCounts.containsKey(key) && + _warningKeyCounts[key] != current._warningKeyCounts[key]) { + quantityChangedOuts.add(key); + } else { + identical.add(key); + } + } + + if (onlyOriginal.isNotEmpty) { + printBuffer.writeln( + '*** $title : ${onlyOriginal.length} warnings from $branch, missing in ${current.branch}:'); + onlyOriginal.forEach((key) => printBuffer.writeln(_fromKey(key))); + } + if (onlyCurrent.isNotEmpty) { + printBuffer.writeln( + '*** $title : ${onlyCurrent.length} new warnings in ${current.branch}, missing in $branch'); + onlyCurrent.forEach((key) => printBuffer.writeln(current._fromKey(key))); + } + if (quantityChangedOuts.isNotEmpty) { + printBuffer.writeln('*** $title : Identical warning quantity changed'); + for (String key in quantityChangedOuts) { + printBuffer.writeln( + "* Appeared ${_warningKeyCounts[key]} times in $branch, ${current._warningKeyCounts[key]} in ${current.branch}:"); + printBuffer.writeln(current._fromKey(key)); + } + } + if (onlyOriginal.isEmpty && + onlyCurrent.isEmpty && + quantityChangedOuts.isEmpty) { + printBuffer.writeln( + '*** $title : No difference in warning output from $branch to ${current.branch}${allKeys.isEmpty ? "" : " (${allKeys.length} warnings found)"}'); + } else if (identical.isNotEmpty) { + printBuffer.writeln( + '*** $title : Difference in warning output found for ${allKeys.length - identical.length} warnings (${allKeys.length} warnings found)"'); + } + return printBuffer.toString(); + } +} + /// Returns a map of warning texts to the number of times each has been seen. -Map jsonMessageIterableToWarnings(Iterable messageIterable) { - Map warningTexts = new Map(); +WarningsCollection jsonMessageIterableToWarnings(Iterable messageIterable, + String tempPath, String pubDir, String branch) { + WarningsCollection warningTexts = + new WarningsCollection(tempPath, pubDir, branch); for (Map message in messageIterable) { if (message.containsKey('level') && message['level'] == 'WARNING' && message.containsKey('data')) { - warningTexts.putIfAbsent(message['data']['text'], () => 0); - warningTexts[message['data']['text']]++; + warningTexts.add(message['data']['text']); } } return warningTexts; @@ -104,13 +194,16 @@ Future compareSdkWarnings() async { sdkDocsDir.path, new Future.value(Directory.current.path), 'current'); Future originalDartdocSdkBuild = _buildSdkDocs(originalDartdocSdkDocs.path, originalDartdoc, 'original'); - Map currentDartdocWarnings = - jsonMessageIterableToWarnings(await currentDartdocSdkBuild); - Map originalDartdocWarnings = - jsonMessageIterableToWarnings(await originalDartdocSdkBuild); - - print(printWarningDelta('SDK docs', dartdocOriginalBranch, - originalDartdocWarnings, currentDartdocWarnings)); + WarningsCollection currentDartdocWarnings = jsonMessageIterableToWarnings( + await currentDartdocSdkBuild, sdkDocsDir.absolute.path, null, 'HEAD'); + WarningsCollection originalDartdocWarnings = jsonMessageIterableToWarnings( + await originalDartdocSdkBuild, + originalDartdocSdkDocs.absolute.path, + null, + dartdocOriginalBranch); + + print(originalDartdocWarnings.getPrintableWarningDelta( + 'SDK docs', currentDartdocWarnings)); } /// Helper function to create a clean version of dartdoc (based on the current @@ -142,7 +235,7 @@ Future> _buildSdkDocs(String sdkDocsPath, Future futureCwd, '--checked', path.join('bin', 'dartdoc.dart'), '--output', - '${sdkDocsDir.path}', + '${sdkDocsPath}', '--sdk-docs', '--json', '--show-progress', @@ -205,14 +298,8 @@ _serveDocsFrom(String servePath, int port, String context) async { var launcher = new SubprocessLauncher(context); await launcher.runStreamed(sdkBin('pub'), ['get']); await launcher.runStreamed(sdkBin('pub'), ['global', 'activate', 'dhttpd']); - await launcher.runStreamed(sdkBin('pub'), [ - 'run', - 'dhttpd', - '--port', - '$port', - '--path', - servePath - ]); + await launcher.runStreamed( + sdkBin('pub'), ['run', 'dhttpd', '--port', '$port', '--path', servePath]); } @Task('Serve generated SDK docs locally with dhttpd on port 8000') @@ -230,6 +317,54 @@ Future serveSdkDocs() async { ]); } +@Task('Compare warnings in Dartdoc for Flutter') +Future compareFlutterWarnings() async { + Directory originalDartdocFlutter = + Directory.systemTemp.createTempSync('dartdoc-comparison-flutter'); + Future originalDartdoc = createComparisonDartdoc(); + Map envCurrent = _createThrowawayPubCache(); + Map envOriginal = _createThrowawayPubCache(); + Future currentDartdocFlutterBuild = _buildFlutterDocs(flutterDir.path, + new Future.value(Directory.current.path), envCurrent, 'current'); + Future originalDartdocFlutterBuild = _buildFlutterDocs( + originalDartdocFlutter.path, originalDartdoc, envOriginal, 'original'); + WarningsCollection currentDartdocWarnings = jsonMessageIterableToWarnings( + await currentDartdocFlutterBuild, + flutterDir.absolute.path, + envCurrent['PUB_CACHE'], + 'HEAD'); + WarningsCollection originalDartdocWarnings = jsonMessageIterableToWarnings( + await originalDartdocFlutterBuild, + originalDartdocFlutter.absolute.path, + envOriginal['PUB_CACHE'], + dartdocOriginalBranch); + + print(originalDartdocWarnings.getPrintableWarningDelta( + 'Flutter repo', currentDartdocWarnings)); + + if (Platform.environment['SERVE_FLUTTER'] == '1') { + var launcher = new SubprocessLauncher('serve-flutter-docs'); + await launcher.runStreamed(sdkBin('pub'), ['get']); + Future original = launcher.runStreamed(sdkBin('pub'), [ + 'run', + 'dhttpd', + '--port', + '9000', + '--path', + path.join(originalDartdocFlutter.absolute.path, 'dev', 'docs', 'doc'), + ]); + Future current = launcher.runStreamed(sdkBin('pub'), [ + 'run', + 'dhttpd', + '--port', + '9001', + '--path', + path.join(flutterDir.absolute.path, 'dev', 'docs', 'doc'), + ]); + await Future.wait([original, current]); + } +} + @Task('Serve generated Flutter docs locally with dhttpd on port 8001') @Depends(buildFlutterDocs) Future serveFlutterDocs() async { @@ -249,21 +384,23 @@ Future serveFlutterDocs() async { @Task('Build flutter docs') Future buildFlutterDocs() async { log('building flutter docs into: $flutterDir'); - await _buildFlutterDocs(flutterDir.path); + Map env = _createThrowawayPubCache(); + await _buildFlutterDocs( + flutterDir.path, new Future.value(Directory.current.path), env); String index = new File(path.join(flutterDir.path, 'dev', 'docs', 'doc', 'index.html')) .readAsStringSync(); stdout.write(index); } -Future _buildFlutterDocs(String flutterPath, [String label]) async { - Map env = _createThrowawayPubCache(); +Future> _buildFlutterDocs( + String flutterPath, Future futureCwd, Map env, + [String label]) async { env['PATH'] = '${path.join(flutterPath, "bin")}:${env['PATH']}'; var launcher = new SubprocessLauncher( - 'build-flutter-docs${label == null ? "" : "-$label"}', - env); - await launcher.runStreamed('git', - ['clone', 'https://github.com/flutter/flutter.git', '.'], + 'build-flutter-docs${label == null ? "" : "-$label"}', env); + await launcher.runStreamed( + 'git', ['clone', 'https://github.com/flutter/flutter.git', '.'], workingDirectory: flutterPath); String flutterBin = path.join('bin', 'flutter'); String flutterCacheDart = @@ -285,27 +422,33 @@ Future _buildFlutterDocs(String flutterPath, [String label]) async { ['get'], workingDirectory: path.join(flutterPath, 'dev', 'tools'), ); - await launcher - .runStreamed(flutterCachePub, ['global', 'activate', '-spath', '.']); await launcher.runStreamed( + flutterCachePub, ['global', 'activate', '-spath', '.'], + workingDirectory: await futureCwd); + return await launcher.runStreamed( flutterCacheDart, - [path.join('dev', 'tools', 'dartdoc.dart')], + [path.join('dev', 'tools', 'dartdoc.dart'), '--json'], workingDirectory: flutterPath, ); } /// Returns the directory in which we generated documentation. -Future _buildPubPackageDocs(String pubPackageName, [String version, String label]) async { +Future _buildPubPackageDocs(String pubPackageName, + [String version, String label]) async { Map env = _createThrowawayPubCache(); var launcher = new SubprocessLauncher( - 'build-${pubPackageName}${version == null ? "" : "-$version"}${label == null ? "" : "-$label"}', env); + 'build-${pubPackageName}${version == null ? "" : "-$version"}${label == null ? "" : "-$label"}', + env); List args = ['cache', 'add']; if (version != null) args.addAll(['-v', version]); args.add(pubPackageName); await launcher.runStreamed('pub', args); - Directory cache = new Directory(path.join(env['PUB_CACHE'], 'hosted', 'pub.dartlang.org')); - Directory pubPackageDir = cache.listSync().firstWhere((e) => e.path.contains(pubPackageName)); - await launcher.runStreamed('pub', ['get'], workingDirectory: pubPackageDir.absolute.path); + Directory cache = + new Directory(path.join(env['PUB_CACHE'], 'hosted', 'pub.dartlang.org')); + Directory pubPackageDir = + cache.listSync().firstWhere((e) => e.path.contains(pubPackageName)); + await launcher.runStreamed('pub', ['get'], + workingDirectory: pubPackageDir.absolute.path); await launcher.runStreamed( Platform.resolvedExecutable, [ @@ -318,12 +461,14 @@ Future _buildPubPackageDocs(String pubPackageName, [String version, Stri return path.join(pubPackageDir.absolute.path, 'doc', 'api'); } -@Task('Serve an arbitrary pub package based on PACKAGE_NAME and PACKAGE_VERSION environment variables') +@Task( + 'Serve an arbitrary pub package based on PACKAGE_NAME and PACKAGE_VERSION environment variables') servePubPackage() async { assert(Platform.environment.containsKey('PACKAGE_NAME')); String packageName = Platform.environment['PACKAGE_NAME']; String version = Platform.environment['PACKAGE_VERSION']; - _serveDocsFrom(await _buildPubPackageDocs(packageName, version), 9000, 'serve-pub-package'); + _serveDocsFrom(await _buildPubPackageDocs(packageName, version), 9000, + 'serve-pub-package'); } @Task('Checks that CHANGELOG mentions current version')