diff --git a/.travis.yml b/.travis.yml index 7e4339b597..ba716bdcb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: dart sudo: false dart: - stable - - "dev/raw/latest" + - "dev/raw/2.9.0-5.0.dev" env: - DARTDOC_BOT=main - DARTDOC_BOT=flutter @@ -18,7 +18,7 @@ matrix: include: - env: DARTDOC_BOT=main os: osx - dart: "dev/raw/latest" + dart: "dev/raw/2.9.0-5.0.dev" install: - ./tool/install_travis.sh diff --git a/appveyor.yml b/appveyor.yml index e58a645699..2f19250fd0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ branches: - master install: - - ps: wget https://storage.googleapis.com/dart-archive/channels/dev/release/latest/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip + - ps: wget https://storage.googleapis.com/dart-archive/channels/dev/release/2.9.0-5.0.dev/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip - cmd: echo "Unzipping dart-sdk..." - cmd: 7z x dart-sdk.zip -o"C:\tools" -y > nul - cmd: del dart-sdk.zip diff --git a/test/model_special_cases_test.dart b/test/model_special_cases_test.dart index 2d11f00712..9cabd67ba7 100644 --- a/test/model_special_cases_test.dart +++ b/test/model_special_cases_test.dart @@ -14,10 +14,14 @@ import 'package:dartdoc/dartdoc.dart'; import 'package:dartdoc/src/model/model.dart'; import 'package:dartdoc/src/special_elements.dart'; import 'package:dartdoc/src/warnings.dart'; +import 'package:pub_semver/pub_semver.dart'; import 'package:test/test.dart'; import 'src/utils.dart' as utils; +final String _platformVersionString = Platform.version.split(' ').first; +final Version _platformVersion = Version.parse(_platformVersionString); + void main() { var sdkDir = defaultSdkDir; @@ -26,11 +30,19 @@ void main() { exit(1); } + // This doesn't have the `max` because NNBD is supposed to work after this + // version, and if the `max` is placed here we'll silently pass 2.10 stable + // if we haven't figured out how to switch on NNBD outside of `dev` builds + // as specified in #2148. + final _nnbdExperimentAllowed = + VersionRange(min: Version.parse('2.9.0'), includeMin: true); + // Experimental features not yet enabled by default. Move tests out of this block // when the feature is enabled by default. group('Experiments', () { Library lateFinalWithoutInitializer, nnbdClassMemberDeclarations; Class b; + setUpAll(() async { lateFinalWithoutInitializer = (await utils.testPackageGraphExperiments) .libraries @@ -120,7 +132,9 @@ void main() { expect(initializeMe.isLate, isTrue); expect(initializeMe.features, contains('late')); }); - }, skip: 'dart-lang/dartdoc#2148'); + }, + skip: (!_nnbdExperimentAllowed.allows(_platformVersion) && + !_platformVersionString.contains('edge'))); group('HTML Injection when allowed', () { Class htmlInjection; diff --git a/testing/test_package_experiments/pubspec.yaml b/testing/test_package_experiments/pubspec.yaml index 35afe7fbbf..bda7ea23fb 100644 --- a/testing/test_package_experiments/pubspec.yaml +++ b/testing/test_package_experiments/pubspec.yaml @@ -1,3 +1,4 @@ name: test_package_experiments version: 0.0.1 +sdk: '>=2.9.0 <2.10.0' description: Experimental flags are tested here. diff --git a/tool/grind.dart b/tool/grind.dart index 8014b1239c..db7068b5e6 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -117,6 +117,9 @@ Directory get flutterDir => _flutterDir ??= createTempSync('flutter'); Directory get testPackage => Directory(path.joinAll(['testing', 'test_package'])); +Directory get testPackageExperiments => + Directory(path.joinAll(['testing', 'test_package_experiments'])); + Directory get pluginPackage => Directory(path.joinAll(['testing', 'test_package_flutter_plugin'])); @@ -125,6 +128,11 @@ Directory _testPackageDocsDir; Directory get testPackageDocsDir => _testPackageDocsDir ??= createTempSync('test_package'); +Directory _testPackageExperimentsDocsDir; +Directory get testPackageExperimentsDocsDir => + _testPackageExperimentsDocsDir ??= + createTempSync('test_package_experiments'); + Directory _pluginPackageDocsDir; Directory get pluginPackageDocsDir => @@ -497,15 +505,14 @@ Future> _buildSdkDocs(String sdkDocsPath, Future futureCwd, workingDirectory: cwd); } -Future> _buildTestPackageDocs( - String outputDir, Future futureCwd, - [String label]) async { - label ??= ''; +Future> _buildTestPackageDocs(String outputDir, String cwd, + {List params, String label = '', String testPackagePath}) async { if (label != '') label = '-$label'; + testPackagePath ??= testPackage.absolute.path; + params ??= []; var launcher = SubprocessLauncher('build-test-package-docs$label'); Future testPackagePubGet = launcher.runStreamed(sdkBin('pub'), ['get'], - workingDirectory: testPackage.absolute.path); - var cwd = await futureCwd; + workingDirectory: testPackagePath); Future dartdocPubGet = launcher.runStreamed(sdkBin('pub'), ['get'], workingDirectory: cwd); await Future.wait([testPackagePubGet, dartdocPubGet]); @@ -522,16 +529,33 @@ Future> _buildTestPackageDocs( '--json', '--link-to-remote', '--pretty-index-json', + ...params, ...extraDartdocParameters, ], - workingDirectory: testPackage.absolute.path); + workingDirectory: testPackagePath); +} + +@Task('Build generated test package docs from the experiment test package') +@Depends(clean) +Future buildTestExperimentsPackageDocs() async { + await _buildTestPackageDocs( + testPackageExperimentsDocsDir.absolute.path, Directory.current.path, + testPackagePath: testPackageExperiments.absolute.path, + params: ['--enable-experiment', 'non-nullable', '--no-link-to-remote']); +} + +@Task('Serve experimental test package on port 8003.') +@Depends(buildTestExperimentsPackageDocs) +Future serveTestExperimentsPackageDocs() async { + await _serveDocsFrom(testPackageExperimentsDocsDir.absolute.path, 8003, + 'test-package-docs-experiments'); } @Task('Build generated test package docs (with inherited docs and source code)') @Depends(clean) Future buildTestPackageDocs() async { await _buildTestPackageDocs( - testPackageDocsDir.absolute.path, Future.value(Directory.current.path)); + testPackageDocsDir.absolute.path, Directory.current.path); } @Task('Serve test package docs locally with dhttpd on port 8002') @@ -549,11 +573,16 @@ Future serveTestPackageDocs() async { ]); } +bool _serveReady = false; + Future _serveDocsFrom(String servePath, int port, String context) async { log('launching dhttpd on port $port for $context'); var launcher = SubprocessLauncher(context); - await launcher.runStreamed(sdkBin('pub'), ['get']); - await launcher.runStreamed(sdkBin('pub'), ['global', 'activate', 'dhttpd']); + if (!_serveReady) { + await launcher.runStreamed(sdkBin('pub'), ['get']); + await launcher.runStreamed(sdkBin('pub'), ['global', 'activate', 'dhttpd']); + _serveReady = true; + } await launcher.runStreamed( sdkBin('pub'), ['run', 'dhttpd', '--port', '$port', '--path', servePath]); }