From b3d3ef1c6981c92d5f513d31240aa2e340f19cd3 Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Mon, 17 Jun 2024 11:40:59 -0700 Subject: [PATCH] [WIP] Use workspaces (#3717) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Testing out the new pub workspaces feature, it seems to work! General stuff I ran into: - We had test fixture packages with general names that I had to rename, because they were listed as real dev deps in some packages and there can only be one resolution per name. Fixed by just renaming them. - Initially I got confusing errors about dependency overrides that I didn't understand how to resolve (we previously had dependency overrides to path dependencies in each pubspec). - The issue was you aren't allowed to override any package that is a part of the mono repo. - My first try to fix it was to move the overrides into the workspace pubspec, but I got the same error. - It wasn't obvious to me that I just needed to remove them entirely, they are automatically all path dependencies. - ~It looks like mono_repo will need some work to support workspaces~ Actually I think it is OK to run `dart pub get` from any dir, so it might be OK In general, it really wasn't difficult 👍 cc @jonasfj @kevmoo @natebosch @sigurdm --- .gitignore | 2 +- _test/analysis_options.yaml | 2 +- _test/pkgs/provides_builder/pubspec.yaml | 2 +- _test/pubspec.yaml | 24 +------ _test/test/common/utils.dart | 6 +- _test_common/analysis_options.yaml | 2 +- _test_common/lib/package_graphs.dart | 4 +- _test_common/pubspec.yaml | 16 +---- analysis/pubspec.yaml | 8 --- ...ysis_options.yaml => analysis_options.yaml | 0 build/analysis_options.yaml | 2 +- build/pubspec.yaml | 2 +- build/pubspec_overrides.yaml | 7 -- build_config/analysis_options.yaml | 2 +- build_config/pubspec.yaml | 2 +- build_config/pubspec_overrides.yaml | 15 ---- build_daemon/analysis_options.yaml | 2 +- build_daemon/pubspec.yaml | 6 +- build_daemon/pubspec_overrides.yaml | 17 ----- build_modules/analysis_options.yaml | 2 +- build_modules/lib/src/scratch_space.dart | 8 ++- build_modules/pubspec.yaml | 4 +- build_modules/pubspec_overrides.yaml | 17 ----- build_modules/test/fixtures/a/pubspec.yaml | 2 +- build_modules/test/fixtures/b/pubspec.yaml | 2 +- build_resolvers/analysis_options.yaml | 2 +- build_resolvers/pubspec.yaml | 2 +- build_resolvers/pubspec_overrides.yaml | 7 -- build_runner/analysis_options.yaml | 2 +- build_runner/lib/src/generate/watch_impl.dart | 10 ++- build_runner/pubspec.yaml | 2 +- build_runner/pubspec_overrides.yaml | 19 ------ build_runner_core/analysis_options.yaml | 2 +- .../src/environment/create_merged_dir.dart | 68 ++++++------------- .../lib/src/package_graph/package_graph.dart | 11 +-- build_runner_core/pubspec.yaml | 2 +- build_runner_core/pubspec_overrides.yaml | 17 ----- .../environment/create_merged_dir_test.dart | 11 +-- .../basic_pkg/.dart_tool/package_config.json | 30 ++++++++ .../test/fixtures/basic_pkg/.packages | 6 -- .../.dart_tool/package_config.json | 45 ++++++++++++ .../test/fixtures/flutter_pkg/.packages | 9 --- .../no_pubspec/.dart_tool/package_config.json | 4 ++ .../test/fixtures/no_pubspec/.packages | 1 - .../.dart_tool/package_config.json | 20 ++++++ .../test/fixtures/with_dev_deps/.packages | 4 -- .../fixtures/workspace/pkgs/a/pubspec.yaml | 2 +- .../fixtures/workspace/pkgs/b/pubspec.yaml | 2 +- .../test/fixtures/workspace/pubspec.lock | 2 +- .../test/fixtures/workspace/pubspec.yaml | 2 +- .../package_graph/package_graph_test.dart | 2 +- build_test/analysis_options.yaml | 2 +- build_test/pubspec.yaml | 2 +- build_test/pubspec_overrides.yaml | 7 -- build_web_compilers/analysis_options.yaml | 2 +- build_web_compilers/pubspec.yaml | 12 ++-- build_web_compilers/pubspec_overrides.yaml | 19 ------ .../test/fixtures/a/lib/a_cycle.dart | 5 -- .../test/fixtures/a/lib/a_cycle_with_b.dart | 2 - .../test/fixtures/a/lib/a_part_in_cycle.dart | 1 - .../test/fixtures/b/lib/b_cycle_with_a.dart | 2 - .../test/fixtures/c/lib/c_cycle.dart | 5 ++ .../test/fixtures/c/lib/c_cycle_with_d.dart | 2 + .../a_no_cycle.dart => c/lib/c_no_cycle.dart} | 0 .../test/fixtures/c/lib/c_part_in_cycle.dart | 1 + .../lib/c_secondary_in_cycle.dart} | 2 +- .../test/fixtures/{a => c}/pubspec.yaml | 7 +- .../test/fixtures/d/lib/d_cycle_with_c.dart | 2 + .../test/fixtures/{b => d}/pubspec.yaml | 7 +- example/analysis_options.yaml | 2 +- example/pubspec.yaml | 7 +- pubspec.yaml | 26 +++++++ scratch_space/analysis_options.yaml | 2 +- scratch_space/pubspec.yaml | 2 +- scratch_space/pubspec_overrides.yaml | 17 ----- tool/analysis_options.yaml | 2 +- tool/pubspec.yaml | 2 +- 77 files changed, 238 insertions(+), 342 deletions(-) delete mode 100644 analysis/pubspec.yaml rename analysis/analysis_options.yaml => analysis_options.yaml (100%) delete mode 100644 build/pubspec_overrides.yaml delete mode 100644 build_config/pubspec_overrides.yaml delete mode 100644 build_daemon/pubspec_overrides.yaml delete mode 100644 build_modules/pubspec_overrides.yaml delete mode 100644 build_resolvers/pubspec_overrides.yaml delete mode 100644 build_runner/pubspec_overrides.yaml delete mode 100644 build_runner_core/pubspec_overrides.yaml create mode 100644 build_runner_core/test/fixtures/basic_pkg/.dart_tool/package_config.json delete mode 100644 build_runner_core/test/fixtures/basic_pkg/.packages create mode 100644 build_runner_core/test/fixtures/flutter_pkg/.dart_tool/package_config.json delete mode 100644 build_runner_core/test/fixtures/flutter_pkg/.packages create mode 100644 build_runner_core/test/fixtures/no_pubspec/.dart_tool/package_config.json delete mode 100644 build_runner_core/test/fixtures/no_pubspec/.packages create mode 100644 build_runner_core/test/fixtures/with_dev_deps/.dart_tool/package_config.json delete mode 100644 build_runner_core/test/fixtures/with_dev_deps/.packages delete mode 100644 build_test/pubspec_overrides.yaml delete mode 100644 build_web_compilers/pubspec_overrides.yaml delete mode 100644 build_web_compilers/test/fixtures/a/lib/a_cycle.dart delete mode 100644 build_web_compilers/test/fixtures/a/lib/a_cycle_with_b.dart delete mode 100644 build_web_compilers/test/fixtures/a/lib/a_part_in_cycle.dart delete mode 100644 build_web_compilers/test/fixtures/b/lib/b_cycle_with_a.dart create mode 100644 build_web_compilers/test/fixtures/c/lib/c_cycle.dart create mode 100644 build_web_compilers/test/fixtures/c/lib/c_cycle_with_d.dart rename build_web_compilers/test/fixtures/{a/lib/a_no_cycle.dart => c/lib/c_no_cycle.dart} (100%) create mode 100644 build_web_compilers/test/fixtures/c/lib/c_part_in_cycle.dart rename build_web_compilers/test/fixtures/{a/lib/a_secondary_in_cycle.dart => c/lib/c_secondary_in_cycle.dart} (52%) rename build_web_compilers/test/fixtures/{a => c}/pubspec.yaml (51%) create mode 100644 build_web_compilers/test/fixtures/d/lib/d_cycle_with_c.dart rename build_web_compilers/test/fixtures/{b => d}/pubspec.yaml (51%) create mode 100644 pubspec.yaml delete mode 100644 scratch_space/pubspec_overrides.yaml diff --git a/.gitignore b/.gitignore index e7081f519..ccb2152fc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ pubspec.lock /*/build/ # Include .packages files from tests which are hand coded -!build_runner_core/test/fixtures/**/.packages +!build_runner_core/test/fixtures/**/.dart_tool/ !build_runner_core/test/fixtures/**/pubspec.lock # Extra files from dart2js that we don't want diff --git a/_test/analysis_options.yaml b/_test/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/_test/analysis_options.yaml +++ b/_test/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/_test/pkgs/provides_builder/pubspec.yaml b/_test/pkgs/provides_builder/pubspec.yaml index 3acb8408b..e433c90d7 100644 --- a/_test/pkgs/provides_builder/pubspec.yaml +++ b/_test/pkgs/provides_builder/pubspec.yaml @@ -1,5 +1,5 @@ name: provides_builder - +resolution: workspace environment: sdk: ^3.5.0-259.0.dev diff --git a/_test/pubspec.yaml b/_test/pubspec.yaml index af9e28d53..7167f04c7 100644 --- a/_test/pubspec.yaml +++ b/_test/pubspec.yaml @@ -1,5 +1,6 @@ name: _test publish_to: none +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -14,32 +15,9 @@ dev_dependencies: build_runner_core: any build_test: any build_web_compilers: any - dart_flutter_team_lints: ^3.1.0 io: ^1.0.0 path: ^1.8.0 provides_builder: path: pkgs/provides_builder/ test: ^1.16.0 test_process: ^2.0.0 - -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_daemon: - path: ../build_daemon - build_modules: - path: ../build_modules - build_resolvers: - path: ../build_resolvers - build_runner: - path: ../build_runner - build_runner_core: - path: ../build_runner_core - build_test: - path: ../build_test - build_web_compilers: - path: ../build_web_compilers - scratch_space: - path: ../scratch_space diff --git a/_test/test/common/utils.dart b/_test/test/common/utils.dart index 86006e7e4..dd841f40b 100644 --- a/_test/test/common/utils.dart +++ b/_test/test/common/utils.dart @@ -5,6 +5,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'dart:isolate'; import 'package:path/path.dart' as p; import 'package:test/test.dart'; @@ -30,11 +31,12 @@ Future runCommand(List args) => /// build to complete. /// /// To ensure a clean build, set [ensureCleanBuild] to `true`. -Future startServer({bool? ensureCleanBuild, List? buildArgs}) => +Future startServer( + {bool? ensureCleanBuild, List? buildArgs}) async => _startServer( 'dart', [ - '--packages=.dart_tool/package_config.json', + '--packages=${(await Isolate.packageConfig).toString()}', p.join('..', 'build_runner', 'bin', 'build_runner.dart'), 'serve', '--verbose', diff --git a/_test_common/analysis_options.yaml b/_test_common/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/_test_common/analysis_options.yaml +++ b/_test_common/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/_test_common/lib/package_graphs.dart b/_test_common/lib/package_graphs.dart index a28bfc2b4..a401d946b 100644 --- a/_test_common/lib/package_graphs.dart +++ b/_test_common/lib/package_graphs.dart @@ -21,10 +21,10 @@ PackageNode package(String packageName, DependencyType? type, LanguageVersion? languageVersion}) => PackageNode(packageName, path ?? '/$packageName', - type ?? DependencyType.path, languageVersion ?? LanguageVersion(0, 0)); + type ?? DependencyType.path, languageVersion); PackageNode rootPackage(String packageName, {String? path, LanguageVersion? languageVersion}) => PackageNode(packageName, path ?? '/$packageName', DependencyType.path, - languageVersion ?? LanguageVersion(0, 0), + languageVersion, isRoot: true); diff --git a/_test_common/pubspec.yaml b/_test_common/pubspec.yaml index da0c3efcd..31a8ee556 100644 --- a/_test_common/pubspec.yaml +++ b/_test_common/pubspec.yaml @@ -1,6 +1,7 @@ name: _test_common publish_to: none description: Test infra for writing build tests. Is not published. +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -18,18 +19,3 @@ dependencies: test: ^1.16.0 test_descriptor: ^2.0.0 watcher: ^1.0.0 - -dev_dependencies: - dart_flutter_team_lints: ^3.1.0 - -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_resolvers: - path: ../build_resolvers - build_runner_core: - path: ../build_runner_core - build_test: - path: ../build_test diff --git a/analysis/pubspec.yaml b/analysis/pubspec.yaml deleted file mode 100644 index b62ba75de..000000000 --- a/analysis/pubspec.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# This file only exists to enable the top level shared analysis_options.yaml -# file to import package:dart_flutter_team_lints. -name: _for_analysis_options_only -publish_to: none -environment: - sdk: ^3.5.0-259.0.dev -dev_dependencies: - dart_flutter_team_lints: ^3.1.0 diff --git a/analysis/analysis_options.yaml b/analysis_options.yaml similarity index 100% rename from analysis/analysis_options.yaml rename to analysis_options.yaml diff --git a/build/analysis_options.yaml b/build/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build/analysis_options.yaml +++ b/build/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build/pubspec.yaml b/build/pubspec.yaml index e6c98c19e..70869b13f 100644 --- a/build/pubspec.yaml +++ b/build/pubspec.yaml @@ -2,6 +2,7 @@ name: build version: 2.4.2-wip description: A package for authoring build_runner compatible code generators. repository: https://github.com/dart-lang/build/tree/master/build +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -20,7 +21,6 @@ dependencies: dev_dependencies: build_resolvers: ^2.4.0 build_test: ^2.0.0 - dart_flutter_team_lints: ^3.1.0 test: ^1.16.0 topics: diff --git a/build/pubspec_overrides.yaml b/build/pubspec_overrides.yaml deleted file mode 100644 index 14c8a8448..000000000 --- a/build/pubspec_overrides.yaml +++ /dev/null @@ -1,7 +0,0 @@ -dependency_overrides: - build_config: - path: ../build_config - build_resolvers: - path: ../build_resolvers - build_test: - path: ../build_test diff --git a/build_config/analysis_options.yaml b/build_config/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build_config/analysis_options.yaml +++ b/build_config/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build_config/pubspec.yaml b/build_config/pubspec.yaml index c4710cddc..b62fe7009 100644 --- a/build_config/pubspec.yaml +++ b/build_config/pubspec.yaml @@ -3,6 +3,7 @@ version: 1.1.2-wip description: >- Format definition and support for parsing `build.yaml` configuration. repository: https://github.com/dart-lang/build/tree/master/build_config +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -16,7 +17,6 @@ dependencies: dev_dependencies: build_runner: ^2.0.0 - dart_flutter_team_lints: ^3.1.0 json_serializable: ^6.0.0 term_glyph: ^1.2.0 test: ^1.16.0 diff --git a/build_config/pubspec_overrides.yaml b/build_config/pubspec_overrides.yaml deleted file mode 100644 index 885c6e685..000000000 --- a/build_config/pubspec_overrides.yaml +++ /dev/null @@ -1,15 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_daemon: - path: ../build_daemon - build_modules: - path: ../build_modules - build_resolvers: - path: ../build_resolvers - build_runner: - path: ../build_runner - build_runner_core: - path: ../build_runner_core - scratch_space: - path: ../scratch_space diff --git a/build_daemon/analysis_options.yaml b/build_daemon/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build_daemon/analysis_options.yaml +++ b/build_daemon/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build_daemon/pubspec.yaml b/build_daemon/pubspec.yaml index b5a57c6ae..7bf6df8cd 100644 --- a/build_daemon/pubspec.yaml +++ b/build_daemon/pubspec.yaml @@ -2,6 +2,7 @@ name: build_daemon version: 4.0.3-wip description: A daemon for running Dart builds. repository: https://github.com/dart-lang/build/tree/master/build_daemon +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -25,15 +26,10 @@ dev_dependencies: build_runner: ^2.0.0 # TODO: untangle analyzer dependency built_value_generator: ^8.1.0 - dart_flutter_team_lints: ^3.1.0 mockito: ^5.0.0 test: ^1.25.5 test_descriptor: ^2.0.0 uuid: ^3.0.0 -dependency_overrides: - build_runner: - path: ../build_runner - topics: - build-runner diff --git a/build_daemon/pubspec_overrides.yaml b/build_daemon/pubspec_overrides.yaml deleted file mode 100644 index 24d963358..000000000 --- a/build_daemon/pubspec_overrides.yaml +++ /dev/null @@ -1,17 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_modules: - path: ../build_modules - build_resolvers: - path: ../build_resolvers - build_runner: - path: ../build_runner - build_runner_core: - path: ../build_runner_core - build_test: - path: ../build_test - scratch_space: - path: ../scratch_space diff --git a/build_modules/analysis_options.yaml b/build_modules/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build_modules/analysis_options.yaml +++ b/build_modules/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build_modules/lib/src/scratch_space.dart b/build_modules/lib/src/scratch_space.dart index 28dca0e50..7831b2d52 100644 --- a/build_modules/lib/src/scratch_space.dart +++ b/build_modules/lib/src/scratch_space.dart @@ -5,6 +5,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'dart:isolate'; import 'dart:math' as math; import 'package:build/build.dart'; @@ -22,7 +23,7 @@ final scratchSpace = ScratchSpace(); /// A shared [Resource] for a [ScratchSpace], which cleans up the contents of /// the [ScratchSpace] in dispose, but doesn't delete it entirely. -final scratchSpaceResource = Resource(() { +final scratchSpaceResource = Resource(() async { if (!scratchSpace.exists) { scratchSpace.tempDir.createSync(recursive: true); scratchSpace.exists = true; @@ -30,7 +31,7 @@ final scratchSpaceResource = Resource(() { var packageConfigFile = File( p.join(scratchSpace.tempDir.path, '.dart_tool', 'package_config.json')); if (!packageConfigFile.existsSync()) { - var originalConfigFile = File(p.join('.dart_tool', 'package_config.json')); + var originalConfigFile = File.fromUri((await Isolate.packageConfig)!); var packageConfigContents = _scratchSpacePackageConfig( originalConfigFile.readAsStringSync(), originalConfigFile.absolute.uri); packageConfigFile @@ -94,6 +95,9 @@ String _scratchSpacePackageConfig(String rootConfig, Uri packageConfigUri) { var foundRoot = false; for (var package in packages) { var rootUri = packageConfigUri.resolve(package['rootUri'] as String); + if (!rootUri.path.endsWith('/') && _currentDirUri.path.endsWith('/')) { + rootUri = rootUri.replace(path: '${rootUri.path}/'); + } // We expect to see exactly one package where the root uri is equal to // the current directory, and that is the current packge. if (rootUri == _currentDirUri) { diff --git a/build_modules/pubspec.yaml b/build_modules/pubspec.yaml index 69407796d..3bbf7ed54 100644 --- a/build_modules/pubspec.yaml +++ b/build_modules/pubspec.yaml @@ -4,9 +4,10 @@ description: >- Builders to analyze and split Dart code into individually compilable modules based on imports. repository: https://github.com/dart-lang/build/tree/master/build_modules +resolution: workspace environment: - sdk: '>=3.0.0 <3.6.0' + sdk: '>=3.5.0-259.0.dev <3.6.0' dependencies: analyzer: '>=5.1.0 <7.0.0' @@ -32,7 +33,6 @@ dev_dependencies: # Used inside tests build_runner: ^2.0.0 build_test: ^2.0.0 - dart_flutter_team_lints: ^3.1.0 json_serializable: ^6.0.0 test: ^1.16.0 diff --git a/build_modules/pubspec_overrides.yaml b/build_modules/pubspec_overrides.yaml deleted file mode 100644 index 02c6e6566..000000000 --- a/build_modules/pubspec_overrides.yaml +++ /dev/null @@ -1,17 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_daemon: - path: ../build_daemon - build_resolvers: - path: ../build_resolvers - build_runner: - path: ../build_runner - build_runner_core: - path: ../build_runner_core - build_test: - path: ../build_test - scratch_space: - path: ../scratch_space diff --git a/build_modules/test/fixtures/a/pubspec.yaml b/build_modules/test/fixtures/a/pubspec.yaml index f476b9756..142156e2e 100644 --- a/build_modules/test/fixtures/a/pubspec.yaml +++ b/build_modules/test/fixtures/a/pubspec.yaml @@ -1,5 +1,5 @@ name: a - +resolution: workspace environment: sdk: ^3.5.0-259.0.dev diff --git a/build_modules/test/fixtures/b/pubspec.yaml b/build_modules/test/fixtures/b/pubspec.yaml index 9e58884af..25c39398b 100644 --- a/build_modules/test/fixtures/b/pubspec.yaml +++ b/build_modules/test/fixtures/b/pubspec.yaml @@ -1,5 +1,5 @@ name: b - +resolution: workspace environment: sdk: ^3.5.0-259.0.dev diff --git a/build_resolvers/analysis_options.yaml b/build_resolvers/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build_resolvers/analysis_options.yaml +++ b/build_resolvers/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build_resolvers/pubspec.yaml b/build_resolvers/pubspec.yaml index e7630f722..4a15a0c7a 100644 --- a/build_resolvers/pubspec.yaml +++ b/build_resolvers/pubspec.yaml @@ -2,6 +2,7 @@ name: build_resolvers version: 2.4.3-wip description: Resolve Dart code in a Builder repository: https://github.com/dart-lang/build/tree/master/build_resolvers +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -24,7 +25,6 @@ dependencies: dev_dependencies: build_test: ^2.0.0 - dart_flutter_team_lints: ^3.1.0 test: ^1.16.0 topics: diff --git a/build_resolvers/pubspec_overrides.yaml b/build_resolvers/pubspec_overrides.yaml deleted file mode 100644 index 996223833..000000000 --- a/build_resolvers/pubspec_overrides.yaml +++ /dev/null @@ -1,7 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_test: - path: ../build_test diff --git a/build_runner/analysis_options.yaml b/build_runner/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build_runner/analysis_options.yaml +++ b/build_runner/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build_runner/lib/src/generate/watch_impl.dart b/build_runner/lib/src/generate/watch_impl.dart index 2d6e3af94..68726c0f8 100644 --- a/build_runner/lib/src/generate/watch_impl.dart +++ b/build_runner/lib/src/generate/watch_impl.dart @@ -332,8 +332,14 @@ class WatchImpl implements BuildState { () async { await logTimedAsync(_logger, 'Waiting for all file watchers to be ready', () => graphWatcher.ready); - originalRootPackageConfigDigest = md5.convert( - await watcherEnvironment.reader.readAsBytes(rootPackageConfigId)); + if (await watcherEnvironment.reader.canRead(rootPackageConfigId)) { + originalRootPackageConfigDigest = md5.convert( + await watcherEnvironment.reader.readAsBytes(rootPackageConfigId)); + } else { + _logger.warning( + 'Root package config not readable, manual restarts will be needed ' + 'after running `pub upgrade`.'); + } BuildResult firstBuild; BuildImpl? build; diff --git a/build_runner/pubspec.yaml b/build_runner/pubspec.yaml index e6385665f..8d92660a4 100644 --- a/build_runner/pubspec.yaml +++ b/build_runner/pubspec.yaml @@ -2,6 +2,7 @@ name: build_runner version: 2.4.12-wip description: A build system for Dart code generation and modular compilation. repository: https://github.com/dart-lang/build/tree/master/build_runner +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -52,7 +53,6 @@ dev_dependencies: path: ../_test_common build_test: ^2.0.0 build_web_compilers: ^4.0.0 - dart_flutter_team_lints: ^3.1.0 stream_channel: ^2.0.0 test: ^1.25.5 test_descriptor: ^2.0.0 diff --git a/build_runner/pubspec_overrides.yaml b/build_runner/pubspec_overrides.yaml deleted file mode 100644 index 372ed42a6..000000000 --- a/build_runner/pubspec_overrides.yaml +++ /dev/null @@ -1,19 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_daemon: - path: ../build_daemon - build_modules: - path: ../build_modules - build_resolvers: - path: ../build_resolvers - build_runner_core: - path: ../build_runner_core - build_test: - path: ../build_test - build_web_compilers: - path: ../build_web_compilers - scratch_space: - path: ../scratch_space diff --git a/build_runner_core/analysis_options.yaml b/build_runner_core/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build_runner_core/analysis_options.yaml +++ b/build_runner_core/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build_runner_core/lib/src/environment/create_merged_dir.dart b/build_runner_core/lib/src/environment/create_merged_dir.dart index 0b5d436b6..60b25b98d 100644 --- a/build_runner_core/lib/src/environment/create_merged_dir.dart +++ b/build_runner_core/lib/src/environment/create_merged_dir.dart @@ -124,10 +124,8 @@ Future _createMergedOutputDir( for (var id in builtAssets) _writeAsset( id, outputDir, root, packageGraph, reader, symlinkOnly, hoist), - _writeCustomPackagesFile(packageGraph, outputDir), - if (await reader.canRead(_packageConfigId(packageGraph.root.name))) - _writeModifiedPackageConfig( - packageGraph.root.name, reader, outputDir), + _writeModifiedPackageConfig( + packageGraph.root.name, packageGraph, outputDir), ])); if (!hoist) { @@ -160,22 +158,6 @@ Future _createMergedOutputDir( } } -/// Creates a custom `.packages` file in [outputDir] containing all the -/// packages in [packageGraph]. -/// -/// All package root uris are of the form `packages//`. -Future _writeCustomPackagesFile( - PackageGraph packageGraph, Directory outputDir) async { - var packagesFileContent = - packageGraph.allPackages.keys.map((p) => '$p:packages/$p/').join('\r\n'); - var packagesAsset = AssetId(packageGraph.root.name, '.packages'); - await _writeAsString(outputDir, packagesAsset, packagesFileContent); - return packagesAsset; -} - -AssetId _packageConfigId(String rootPackage) => - AssetId(rootPackage, '.dart_tool/package_config.json'); - /// Creates a modified `.dart_tool/package_config.json` file in [outputDir] /// based on the current one but with modified root and package uris. /// @@ -186,32 +168,26 @@ AssetId _packageConfigId(String rootPackage) => /// /// All other fields are left as is. Future _writeModifiedPackageConfig( - String rootPackage, AssetReader reader, Directory outputDir) async { - var packageConfigAsset = _packageConfigId(rootPackage); - var packageConfig = jsonDecode(await reader.readAsString(packageConfigAsset)) - as Map; - - var version = packageConfig['configVersion'] as int; - if (version != 2) { - throw UnsupportedError( - 'Unsupported package_config.json version, got $version but only ' - 'version 2 is supported.'); - } - var packages = - (packageConfig['packages'] as List).cast>(); - for (var package in packages) { - final name = package['name'] as String; - if (name == rootPackage) { - package['rootUri'] = '../'; - package['packageUri'] = 'packages/${package['name']}'; - } else { - package['rootUri'] = '../packages/${package['name']}'; - package['packageUri'] = ''; - } - } - await _writeAsString( - outputDir, packageConfigAsset, jsonEncode(packageConfig)); - return packageConfigAsset; + String rootPackage, PackageGraph packageGraph, Directory outputDir) async { + var packageConfig = { + 'configVersion': 2, + 'packages': [ + for (var package in packageGraph.allPackages.values) + { + 'name': package.name, + 'rootUri': package.name == rootPackage + ? '../' + : '../packages/${package.name}', + 'packageUri': + package.name == rootPackage ? 'packages/${package.name}' : '', + if (package.languageVersion != null) + 'languageVersion': '${package.languageVersion}', + }, + ] + }; + var packageConfigId = AssetId(rootPackage, '.dart_tool/package_config.json'); + await _writeAsString(outputDir, packageConfigId, jsonEncode(packageConfig)); + return packageConfigId; } Set _findRootDirs(Iterable allAssets, String outputPath) { diff --git a/build_runner_core/lib/src/package_graph/package_graph.dart b/build_runner_core/lib/src/package_graph/package_graph.dart index 3337fd156..1f4cd474a 100644 --- a/build_runner_core/lib/src/package_graph/package_graph.dart +++ b/build_runner_core/lib/src/package_graph/package_graph.dart @@ -12,13 +12,8 @@ import '../util/constants.dart'; /// The SDK package, we filter this to the core libs and dev compiler /// resources. -final _sdkPackageNode = PackageNode( - r'$sdk', - sdkPath, - DependencyType.hosted, - // A fake language version for the SDK, we don't allow you to read its - // sources anyways, and invalidate the whole build if this changes. - LanguageVersion(0, 0)); +final _sdkPackageNode = + PackageNode(r'$sdk', sdkPath, DependencyType.hosted, null); /// A graph of the package dependencies for an application. class PackageGraph { @@ -89,7 +84,6 @@ class PackageGraph { while (true) { packageConfig = await findPackageConfig(Directory(rootDir), recurse: false); - File(p.join(rootDir, '.dart_tool', 'package_config.json')); if (packageConfig != null) { break; } @@ -105,7 +99,6 @@ class PackageGraph { throw StateError( 'Unable to find package config for package at $packagePath.'); } - final dependencyTypes = _parseDependencyTypes(rootDir); final nodes = {}; diff --git a/build_runner_core/pubspec.yaml b/build_runner_core/pubspec.yaml index b082c69bf..66ab8aea0 100644 --- a/build_runner_core/pubspec.yaml +++ b/build_runner_core/pubspec.yaml @@ -2,6 +2,7 @@ name: build_runner_core version: 7.3.2-wip description: Core tools to organize the structure of a build and run Builders. repository: https://github.com/dart-lang/build/tree/master/build_runner_core +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -37,7 +38,6 @@ dev_dependencies: analyzer: '>=5.2.0 <7.0.0' build_runner: ^2.0.0 build_test: ^2.0.0 - dart_flutter_team_lints: ^3.1.0 json_serializable: ^6.0.0 test: ^1.16.0 test_descriptor: ^2.0.0 diff --git a/build_runner_core/pubspec_overrides.yaml b/build_runner_core/pubspec_overrides.yaml deleted file mode 100644 index 0a42a95c4..000000000 --- a/build_runner_core/pubspec_overrides.yaml +++ /dev/null @@ -1,17 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_daemon: - path: ../build_daemon - build_modules: - path: ../build_modules - build_resolvers: - path: ../build_resolvers - build_runner: - path: ../build_runner - build_test: - path: ../build_test - scratch_space: - path: ../scratch_space diff --git a/build_runner_core/test/environment/create_merged_dir_test.dart b/build_runner_core/test/environment/create_merged_dir_test.dart index 993627a67..06242523d 100644 --- a/build_runner_core/test/environment/create_merged_dir_test.dart +++ b/build_runner_core/test/environment/create_merged_dir_test.dart @@ -55,7 +55,7 @@ void main() { }; final packageGraph = buildPackageGraph({ rootPackage('a'): ['b'], - package('b'): [] + package('b'): [], }); late TargetGraph targetGraph; late Directory tmpDir; @@ -212,7 +212,7 @@ void main() { 'packages/b/c.txt': 'c', 'packages/b/c.txt.copy': 'c', '.dart_tool/package_config.json': - _expectedPackageConfig('a', ['a', 'b']), + _expectedPackageConfig('a', ['a', 'b', r'$sdk']), }; _expectFiles(webFiles, tmpDir); @@ -297,7 +297,7 @@ void main() { 'packages/b/c.txt': 'c', 'web/b.txt': 'b', '.dart_tool/package_config.json': - _expectedPackageConfig('a', ['a', 'b']) + _expectedPackageConfig('a', ['a', 'b', r'$sdk']) }; _expectFiles(expectedFiles, tmpDir); }); @@ -482,7 +482,10 @@ void _expectAllFiles(Directory dir) { 'packages/b/c.txt.copy': 'c', 'web/b.txt': 'b', 'web/b.txt.copy': 'b', - '.dart_tool/package_config.json': _expectedPackageConfig('a', ['a', 'b']) + '.dart_tool/package_config.json': _expectedPackageConfig( + 'a', + ['a', 'b', r'$sdk'], + ) }; _expectFiles(expectedFiles, dir); } diff --git a/build_runner_core/test/fixtures/basic_pkg/.dart_tool/package_config.json b/build_runner_core/test/fixtures/basic_pkg/.dart_tool/package_config.json new file mode 100644 index 000000000..9e1cafe15 --- /dev/null +++ b/build_runner_core/test/fixtures/basic_pkg/.dart_tool/package_config.json @@ -0,0 +1,30 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "a", + "rootUri": "../pkg/a", + "packageUri": "lib/" + }, + { + "name": "b", + "rootUri": "../pkg/b", + "packageUri": "lib/" + }, + { + "name": "c", + "rootUri": "../pkg/c", + "packageUri": "lib/" + }, + { + "name": "d", + "rootUri": "../pkg/d", + "packageUri": "lib/" + }, + { + "name": "basic_pkg", + "rootUri": "../", + "packageUri": "lib/" + } + ] +} diff --git a/build_runner_core/test/fixtures/basic_pkg/.packages b/build_runner_core/test/fixtures/basic_pkg/.packages deleted file mode 100644 index 5383d3dd2..000000000 --- a/build_runner_core/test/fixtures/basic_pkg/.packages +++ /dev/null @@ -1,6 +0,0 @@ -# Generated by hand on 2016-02-01 -a:pkg/a/lib/ -b:pkg/b/lib/ -c:pkg/c/lib/ -d:pkg/d/lib/ -basic_pkg:lib/ diff --git a/build_runner_core/test/fixtures/flutter_pkg/.dart_tool/package_config.json b/build_runner_core/test/fixtures/flutter_pkg/.dart_tool/package_config.json new file mode 100644 index 000000000..3da8f0b05 --- /dev/null +++ b/build_runner_core/test/fixtures/flutter_pkg/.dart_tool/package_config.json @@ -0,0 +1,45 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "collection", + "rootUri": "../pkg/collection", + "packageUri": "lib/" + }, + { + "name": "flutter", + "rootUri": "../sdk/flutter/flutter", + "packageUri": "lib/" + }, + { + "name": "flutter_driver", + "rootUri": "../sdk/flutter/flutter_driver", + "packageUri": "lib/" + }, + { + "name": "flutter_gallery_assets", + "rootUri": "../sdk/flutter/flutter_gallery_assets", + "packageUri": "lib/" + }, + { + "name": "flutter_test", + "rootUri": "../sdk/flutter/flutter_test", + "packageUri": "lib/" + }, + { + "name": "intl", + "rootUri": "../pkg/intl", + "packageUri": "lib/" + }, + { + "name": "string_scanner", + "rootUri": "../pkg/string_scanner", + "packageUri": "lib/" + }, + { + "name": "flutter_gallery", + "rootUri": "../", + "packageUri": "lib/" + } + ] +} diff --git a/build_runner_core/test/fixtures/flutter_pkg/.packages b/build_runner_core/test/fixtures/flutter_pkg/.packages deleted file mode 100644 index cadfb72e3..000000000 --- a/build_runner_core/test/fixtures/flutter_pkg/.packages +++ /dev/null @@ -1,9 +0,0 @@ -# Generated by hand on 2017-02-17. -collection:pkg/collection/lib/ -flutter:sdk/flutter/flutter/lib/ -flutter_driver:sdk/flutter/flutter_driver/lib/ -flutter_gallery_assets:sdk/flutter/flutter_gallery_assets/lib/ -flutter_test:sdk/flutter/flutter_test/lib/ -intl:pkg/intl/lib/ -string_scanner:pkg/string_scanner/lib/ -flutter_gallery:./lib/ \ No newline at end of file diff --git a/build_runner_core/test/fixtures/no_pubspec/.dart_tool/package_config.json b/build_runner_core/test/fixtures/no_pubspec/.dart_tool/package_config.json new file mode 100644 index 000000000..170046e51 --- /dev/null +++ b/build_runner_core/test/fixtures/no_pubspec/.dart_tool/package_config.json @@ -0,0 +1,4 @@ +{ + "configVersion": 2, + "packages": [] +} diff --git a/build_runner_core/test/fixtures/no_pubspec/.packages b/build_runner_core/test/fixtures/no_pubspec/.packages deleted file mode 100644 index 3fc66548b..000000000 --- a/build_runner_core/test/fixtures/no_pubspec/.packages +++ /dev/null @@ -1 +0,0 @@ -# Created by hand, but empty diff --git a/build_runner_core/test/fixtures/with_dev_deps/.dart_tool/package_config.json b/build_runner_core/test/fixtures/with_dev_deps/.dart_tool/package_config.json new file mode 100644 index 000000000..49d03485f --- /dev/null +++ b/build_runner_core/test/fixtures/with_dev_deps/.dart_tool/package_config.json @@ -0,0 +1,20 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "a", + "rootUri": "../pkg/a", + "packageUri": "lib/" + }, + { + "name": "b", + "rootUri": "../pkg/b", + "packageUri": "lib/" + }, + { + "name": "with_dev_deps", + "rootUri": "../", + "packageUri": "lib/" + } + ] +} diff --git a/build_runner_core/test/fixtures/with_dev_deps/.packages b/build_runner_core/test/fixtures/with_dev_deps/.packages deleted file mode 100644 index c9578622f..000000000 --- a/build_runner_core/test/fixtures/with_dev_deps/.packages +++ /dev/null @@ -1,4 +0,0 @@ -# Generated by hand on 2016-03-01 -a:pkg/a/lib/ -b:pkg/b/lib/ -with_dev_deps:lib/ diff --git a/build_runner_core/test/fixtures/workspace/pkgs/a/pubspec.yaml b/build_runner_core/test/fixtures/workspace/pkgs/a/pubspec.yaml index 1677c6409..f7a80ee09 100644 --- a/build_runner_core/test/fixtures/workspace/pkgs/a/pubspec.yaml +++ b/build_runner_core/test/fixtures/workspace/pkgs/a/pubspec.yaml @@ -1,6 +1,6 @@ name: a environment: - sdk: ^3.5.0-0 + sdk: ^3.5.0-259.0.dev resolution: workspace dependencies: b: diff --git a/build_runner_core/test/fixtures/workspace/pkgs/b/pubspec.yaml b/build_runner_core/test/fixtures/workspace/pkgs/b/pubspec.yaml index c22a169a4..c74577984 100644 --- a/build_runner_core/test/fixtures/workspace/pkgs/b/pubspec.yaml +++ b/build_runner_core/test/fixtures/workspace/pkgs/b/pubspec.yaml @@ -1,4 +1,4 @@ name: b environment: - sdk: ^3.5.0-0 + sdk: ^3.5.0-259.0.dev resolution: workspace diff --git a/build_runner_core/test/fixtures/workspace/pubspec.lock b/build_runner_core/test/fixtures/workspace/pubspec.lock index 3630c37dc..f70457999 100644 --- a/build_runner_core/test/fixtures/workspace/pubspec.lock +++ b/build_runner_core/test/fixtures/workspace/pubspec.lock @@ -2,4 +2,4 @@ # See https://dart.dev/tools/pub/glossary#lockfile packages: {} sdks: - dart: ">=3.5.0-0 <4.0.0" + dart: ">=3.5.0-259.0.dev <4.0.0" diff --git a/build_runner_core/test/fixtures/workspace/pubspec.yaml b/build_runner_core/test/fixtures/workspace/pubspec.yaml index 97e18a7f5..cdf31bd4a 100644 --- a/build_runner_core/test/fixtures/workspace/pubspec.yaml +++ b/build_runner_core/test/fixtures/workspace/pubspec.yaml @@ -1,6 +1,6 @@ name: workspace environment: - sdk: ^3.5.0-0 + sdk: ^3.5.0-259.0.dev workspace: - pkgs/a - pkgs/b diff --git a/build_runner_core/test/package_graph/package_graph_test.dart b/build_runner_core/test/package_graph/package_graph_test.dart index 2a6e8fb1d..4a3c9195d 100644 --- a/build_runner_core/test/package_graph/package_graph_test.dart +++ b/build_runner_core/test/package_graph/package_graph_test.dart @@ -32,7 +32,7 @@ void main() { }); group('basic package ', () { - var basicPkgPath = 'test/fixtures/basic_pkg'; + var basicPkgPath = 'test/fixtures/basic_pkg/'; setUp(() async { graph = await PackageGraph.forPath(basicPkgPath); diff --git a/build_test/analysis_options.yaml b/build_test/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build_test/analysis_options.yaml +++ b/build_test/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build_test/pubspec.yaml b/build_test/pubspec.yaml index fded877a2..cf63e1561 100644 --- a/build_test/pubspec.yaml +++ b/build_test/pubspec.yaml @@ -2,6 +2,7 @@ name: build_test description: Utilities for writing unit tests of Builders. version: 2.2.3-wip repository: https://github.com/dart-lang/build/tree/master/build_test +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -26,7 +27,6 @@ dependencies: dev_dependencies: analyzer: '>=5.2.0 <7.0.0' collection: ^1.15.0 - dart_flutter_team_lints: ^3.1.0 topics: - build-runner diff --git a/build_test/pubspec_overrides.yaml b/build_test/pubspec_overrides.yaml deleted file mode 100644 index f44df59da..000000000 --- a/build_test/pubspec_overrides.yaml +++ /dev/null @@ -1,7 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_resolvers: - path: ../build_resolvers diff --git a/build_web_compilers/analysis_options.yaml b/build_web_compilers/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/build_web_compilers/analysis_options.yaml +++ b/build_web_compilers/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/build_web_compilers/pubspec.yaml b/build_web_compilers/pubspec.yaml index b7e49f8d8..ec2177261 100644 --- a/build_web_compilers/pubspec.yaml +++ b/build_web_compilers/pubspec.yaml @@ -2,9 +2,10 @@ name: build_web_compilers version: 4.0.11-wip description: Builder implementations wrapping the dart2js and DDC compilers. repository: https://github.com/dart-lang/build/tree/master/build_web_compilers +resolution: workspace environment: - sdk: '>=3.1.0 <3.6.0' + sdk: '>=3.5.0-259.0.dev <3.6.0' dependencies: analyzer: '>=5.1.0 <7.0.0' @@ -25,13 +26,12 @@ dependencies: stack_trace: ^1.10.0 dev_dependencies: - a: - path: test/fixtures/a - b: - path: test/fixtures/b build_runner: ^2.0.0 build_test: ^2.0.0 - dart_flutter_team_lints: ^3.1.0 + c: + path: test/fixtures/c + d: + path: test/fixtures/d test: ^1.16.0 topics: diff --git a/build_web_compilers/pubspec_overrides.yaml b/build_web_compilers/pubspec_overrides.yaml deleted file mode 100644 index a09d8d9a3..000000000 --- a/build_web_compilers/pubspec_overrides.yaml +++ /dev/null @@ -1,19 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_daemon: - path: ../build_daemon - build_modules: - path: ../build_modules - build_resolvers: - path: ../build_resolvers - build_runner: - path: ../build_runner - build_runner_core: - path: ../build_runner_core - build_test: - path: ../build_test - scratch_space: - path: ../scratch_space diff --git a/build_web_compilers/test/fixtures/a/lib/a_cycle.dart b/build_web_compilers/test/fixtures/a/lib/a_cycle.dart deleted file mode 100644 index dc033a901..000000000 --- a/build_web_compilers/test/fixtures/a/lib/a_cycle.dart +++ /dev/null @@ -1,5 +0,0 @@ -// ignore_for_file: unused_import -import 'package:b/b_cycle_with_a.dart'; -import 'a_secondary_in_cycle.dart'; - -part 'a_part_in_cycle.dart'; diff --git a/build_web_compilers/test/fixtures/a/lib/a_cycle_with_b.dart b/build_web_compilers/test/fixtures/a/lib/a_cycle_with_b.dart deleted file mode 100644 index 02289ee01..000000000 --- a/build_web_compilers/test/fixtures/a/lib/a_cycle_with_b.dart +++ /dev/null @@ -1,2 +0,0 @@ -// ignore: unused_import -import 'package:b/b_cycle_with_a.dart'; diff --git a/build_web_compilers/test/fixtures/a/lib/a_part_in_cycle.dart b/build_web_compilers/test/fixtures/a/lib/a_part_in_cycle.dart deleted file mode 100644 index 3fcf196eb..000000000 --- a/build_web_compilers/test/fixtures/a/lib/a_part_in_cycle.dart +++ /dev/null @@ -1 +0,0 @@ -part of 'a_cycle.dart'; diff --git a/build_web_compilers/test/fixtures/b/lib/b_cycle_with_a.dart b/build_web_compilers/test/fixtures/b/lib/b_cycle_with_a.dart deleted file mode 100644 index f4189aad1..000000000 --- a/build_web_compilers/test/fixtures/b/lib/b_cycle_with_a.dart +++ /dev/null @@ -1,2 +0,0 @@ -// ignore: unused_import -import 'package:a/a_cycle_with_b.dart'; diff --git a/build_web_compilers/test/fixtures/c/lib/c_cycle.dart b/build_web_compilers/test/fixtures/c/lib/c_cycle.dart new file mode 100644 index 000000000..52807bb25 --- /dev/null +++ b/build_web_compilers/test/fixtures/c/lib/c_cycle.dart @@ -0,0 +1,5 @@ +// ignore_for_file: unused_import +import 'package:d/d_cycle_with_c.dart'; +import 'c_secondary_in_cycle.dart'; + +part 'c_part_in_cycle.dart'; diff --git a/build_web_compilers/test/fixtures/c/lib/c_cycle_with_d.dart b/build_web_compilers/test/fixtures/c/lib/c_cycle_with_d.dart new file mode 100644 index 000000000..0c2e4564f --- /dev/null +++ b/build_web_compilers/test/fixtures/c/lib/c_cycle_with_d.dart @@ -0,0 +1,2 @@ +// ignore: unused_import +import 'package:d/d_cycle_with_c.dart'; diff --git a/build_web_compilers/test/fixtures/a/lib/a_no_cycle.dart b/build_web_compilers/test/fixtures/c/lib/c_no_cycle.dart similarity index 100% rename from build_web_compilers/test/fixtures/a/lib/a_no_cycle.dart rename to build_web_compilers/test/fixtures/c/lib/c_no_cycle.dart diff --git a/build_web_compilers/test/fixtures/c/lib/c_part_in_cycle.dart b/build_web_compilers/test/fixtures/c/lib/c_part_in_cycle.dart new file mode 100644 index 000000000..691a6b5b4 --- /dev/null +++ b/build_web_compilers/test/fixtures/c/lib/c_part_in_cycle.dart @@ -0,0 +1 @@ +part of 'c_cycle.dart'; diff --git a/build_web_compilers/test/fixtures/a/lib/a_secondary_in_cycle.dart b/build_web_compilers/test/fixtures/c/lib/c_secondary_in_cycle.dart similarity index 52% rename from build_web_compilers/test/fixtures/a/lib/a_secondary_in_cycle.dart rename to build_web_compilers/test/fixtures/c/lib/c_secondary_in_cycle.dart index 3004a5e7e..6a9c3bf38 100644 --- a/build_web_compilers/test/fixtures/a/lib/a_secondary_in_cycle.dart +++ b/build_web_compilers/test/fixtures/c/lib/c_secondary_in_cycle.dart @@ -1,2 +1,2 @@ // ignore: unused_import -import 'a_cycle.dart'; +import 'c_cycle.dart'; diff --git a/build_web_compilers/test/fixtures/a/pubspec.yaml b/build_web_compilers/test/fixtures/c/pubspec.yaml similarity index 51% rename from build_web_compilers/test/fixtures/a/pubspec.yaml rename to build_web_compilers/test/fixtures/c/pubspec.yaml index f476b9756..923ab803e 100644 --- a/build_web_compilers/test/fixtures/a/pubspec.yaml +++ b/build_web_compilers/test/fixtures/c/pubspec.yaml @@ -1,8 +1,9 @@ -name: a +name: c +resolution: workspace environment: sdk: ^3.5.0-259.0.dev dependencies: - b: - path: ../b + d: + path: ../d diff --git a/build_web_compilers/test/fixtures/d/lib/d_cycle_with_c.dart b/build_web_compilers/test/fixtures/d/lib/d_cycle_with_c.dart new file mode 100644 index 000000000..9cf7a2d25 --- /dev/null +++ b/build_web_compilers/test/fixtures/d/lib/d_cycle_with_c.dart @@ -0,0 +1,2 @@ +// ignore: unused_import +import 'package:c/c_cycle_with_d.dart'; diff --git a/build_web_compilers/test/fixtures/b/pubspec.yaml b/build_web_compilers/test/fixtures/d/pubspec.yaml similarity index 51% rename from build_web_compilers/test/fixtures/b/pubspec.yaml rename to build_web_compilers/test/fixtures/d/pubspec.yaml index 9e58884af..c1eb7475c 100644 --- a/build_web_compilers/test/fixtures/b/pubspec.yaml +++ b/build_web_compilers/test/fixtures/d/pubspec.yaml @@ -1,8 +1,9 @@ -name: b +name: d +resolution: workspace environment: sdk: ^3.5.0-259.0.dev dependencies: - a: - path: ../a + c: + path: ../c diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 0f12cd277..9866ab93a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -2,6 +2,7 @@ name: example publish_to: none environment: sdk: ^3.5.0-259.0.dev +resolution: workspace dependencies: analyzer: ">=5.0.0 <7.0.0" @@ -12,9 +13,3 @@ dependencies: dev_dependencies: build_runner: ^2.0.0 build_web_compilers: ^4.0.0 - dart_flutter_team_lints: ^3.1.0 - -# TODO: Remove once build_modules version 5.0.6 is published. -dependency_overrides: - build_modules: - path: ../build_modules diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 000000000..456cd0e06 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,26 @@ +name: build_workspace # Can be anything +environment: + sdk: ^3.5.0-259.0.dev # Must be ^3.5.0 or later for workspace to be allowed +publish_to: none +dev_dependencies: + dart_flutter_team_lints: ^3.1.0 +workspace: +- _test +- _test/pkgs/provides_builder +- _test_common +- build +- build_config +- build_daemon +- build_modules +- build_resolvers +- build_runner +- build_runner_core +- build_test +- build_web_compilers +- example +- scratch_space +- tool +- build_modules/test/fixtures/a +- build_modules/test/fixtures/b +- build_web_compilers/test/fixtures/c +- build_web_compilers/test/fixtures/d diff --git a/scratch_space/analysis_options.yaml b/scratch_space/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/scratch_space/analysis_options.yaml +++ b/scratch_space/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/scratch_space/pubspec.yaml b/scratch_space/pubspec.yaml index 597ddb1fc..cdade61dd 100644 --- a/scratch_space/pubspec.yaml +++ b/scratch_space/pubspec.yaml @@ -2,6 +2,7 @@ name: scratch_space version: 1.0.3-wip description: A tool to manage running external executables within package:build. repository: https://github.com/dart-lang/build/tree/master/scratch_space +resolution: workspace topics: - build-runner @@ -19,5 +20,4 @@ dependencies: dev_dependencies: build_runner: ^2.0.0 build_test: ^2.0.0 - dart_flutter_team_lints: ^3.1.0 test: ^1.16.0 diff --git a/scratch_space/pubspec_overrides.yaml b/scratch_space/pubspec_overrides.yaml deleted file mode 100644 index 2411a6dd3..000000000 --- a/scratch_space/pubspec_overrides.yaml +++ /dev/null @@ -1,17 +0,0 @@ -dependency_overrides: - build: - path: ../build - build_config: - path: ../build_config - build_daemon: - path: ../build_daemon - build_modules: - path: ../build_modules - build_resolvers: - path: ../build_resolvers - build_runner: - path: ../build_runner - build_runner_core: - path: ../build_runner_core - build_test: - path: ../build_test diff --git a/tool/analysis_options.yaml b/tool/analysis_options.yaml index e0815af9d..5e2133eb6 100644 --- a/tool/analysis_options.yaml +++ b/tool/analysis_options.yaml @@ -1 +1 @@ -include: ../analysis/analysis_options.yaml +include: ../analysis_options.yaml diff --git a/tool/pubspec.yaml b/tool/pubspec.yaml index a2eb19726..63164f81c 100644 --- a/tool/pubspec.yaml +++ b/tool/pubspec.yaml @@ -1,6 +1,7 @@ publish_to: none name: build_development_tools description: Collection of scripts used during development of build packages. +resolution: workspace environment: sdk: ^3.5.0-259.0.dev @@ -11,6 +12,5 @@ dependencies: yaml_edit: ^2.0.1 dev_dependencies: - dart_flutter_team_lints: ^3.1.0 test: ^1.20.1 test_descriptor: ^2.0.0