From 7aeb0e09936ce0d33c4152ff8c61de8db40a5b9e Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Fri, 22 Dec 2017 14:17:37 -0800 Subject: [PATCH 1/3] Serve test package docs through grinder --- pubspec.lock | 2 +- tool/grind.dart | 56 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index d505112a10..59c9146175 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -374,4 +374,4 @@ packages: source: hosted version: "2.1.13" sdks: - dart: ">=1.23.0 <=2.0.0-dev.12.0" + dart: ">=1.23.0 <=2.0.0-dev.14.0" diff --git a/tool/grind.dart b/tool/grind.dart index f7278379d6..a36c4ca422 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -23,6 +23,10 @@ Directory get dartdocDocsDir => tempdirsCache.memoized1(createTempSync, 'dartdoc'); Directory get sdkDocsDir => tempdirsCache.memoized1(createTempSync, 'sdkdocs'); Directory get flutterDir => tempdirsCache.memoized1(createTempSync, 'flutter'); +Directory get testPackage => + new Directory(path.joinAll(['testing', 'test_package'])); +Directory get testPackageDocsDir => + tempdirsCache.memoized1(createTempSync, 'test_package'); /// Version of dartdoc we should use when making comparisons. String get dartdocOriginalBranch { @@ -136,7 +140,7 @@ Future> _buildSdkDocs(String sdkDocsPath, Future futureCwd, Platform.resolvedExecutable, [ '--checked', - 'bin/dartdoc.dart', + path.join('bin', 'dartdoc.dart'), '--output', '${sdkDocsDir.path}', '--sdk-docs', @@ -146,6 +150,56 @@ Future> _buildSdkDocs(String sdkDocsPath, Future futureCwd, workingDirectory: cwd); } +Future> _buildTestPackageDocs( + String outputDir, Future futureCwd, + [String label]) async { + if (label == null) label = ''; + if (label != '') label = '-$label'; + var launcher = new SubprocessLauncher('build-test-package-docs$label'); + await launcher.runStreamed(sdkBin('pub'), ['get'], + workingDirectory: testPackage.absolute.path); + String cwd = await futureCwd; + await launcher.runStreamed(sdkBin('pub'), ['get'], workingDirectory: cwd); + return await launcher.runStreamed( + Platform.resolvedExecutable, + [ + '--checked', + path.join(cwd, 'bin', 'dartdoc.dart'), + '--output', + outputDir, + '--auto-include-dependencies', + '--example-path-prefix', + 'examples', + '--include-source', + '--json', + '--pretty-index-json', + '--exclude', + 'dart.async,dart.collection,dart.convert,dart.core,dart.math,dart.typed_data,meta', + ], + workingDirectory: testPackage.absolute.path); +} + +@Task('Build generated test package docs (with inherited docs and source code)') +Future buildTestPackageDocs() async { + await _buildTestPackageDocs(testPackageDocsDir.absolute.path, + new Future.value(Directory.current.path)); +} + +@Task('Serve test package docs locally with dhttpd on port 8002') +@Depends(buildTestPackageDocs) +Future serveTestPackageDocs() async { + log('launching dhttpd on port 8002 for SDK'); + var launcher = new SubprocessLauncher('serve-sdk-docs'); + await launcher.runStreamed(sdkBin('pub'), [ + 'run', + 'dhttpd', + '--port', + '8002', + '--path', + '${testPackageDocsDir.absolute.path}', + ]); +} + @Task('Serve generated SDK docs locally with dhttpd on port 8000') @Depends(buildSdkDocs) Future serveSdkDocs() async { From bc677de448cf2c8f31a43310897048fb7c399f9b Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Thu, 4 Jan 2018 08:59:23 -0800 Subject: [PATCH 2/3] pubspec update --- pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.lock b/pubspec.lock index 71a75e9a0d..7cb597eee7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -408,4 +408,4 @@ packages: source: hosted version: "2.1.13" sdks: - dart: ">=1.23.0 <=2.0.0-dev.14.0" + dart: ">=1.23.0 <=2.0.0-dev.15.0" From 4ada66357e781cc134cc02a2d794c66b8094777a Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Thu, 4 Jan 2018 09:03:23 -0800 Subject: [PATCH 3/3] Fix label for test package server --- tool/grind.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/grind.dart b/tool/grind.dart index a36c4ca422..0c059bcb85 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -189,7 +189,7 @@ Future buildTestPackageDocs() async { @Depends(buildTestPackageDocs) Future serveTestPackageDocs() async { log('launching dhttpd on port 8002 for SDK'); - var launcher = new SubprocessLauncher('serve-sdk-docs'); + var launcher = new SubprocessLauncher('serve-test-package-docs'); await launcher.runStreamed(sdkBin('pub'), [ 'run', 'dhttpd',