Skip to content

Commit

Permalink
Fix CI jobs (#3763)
Browse files Browse the repository at this point in the history
This is an absolute mess now, our workspace is super fragmented at this point, but in general this:

- Fixes new analyzer deprecations
- Requires the new analyzer
  -  Which requires a new SDK
    -  Which requires moving more packages out of the workspace
- Fixes the jobs that run against `main` by allowing 3.7.0 dev SDKs. These versions will be broken at some point because the DDC binary is going to move, so we are not allowing 3.7.0 stable.
  • Loading branch information
jakemac53 authored Oct 8, 2024
1 parent 387401f commit c9a64a4
Show file tree
Hide file tree
Showing 19 changed files with 372 additions and 249 deletions.
496 changes: 286 additions & 210 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish_to: none
#resolution: workspace

environment:
sdk: ^3.6.0-165.0.dev
sdk: ^3.6.0-228.0.dev

dependencies:
web: ^1.0.0
Expand Down
4 changes: 3 additions & 1 deletion build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## 2.4.2-wip

- Bump the min sdk to 3.5.0.
- Bump the min sdk to 3.6.0-228.0.dev.
- Remove some unnecessary casts and non-null assertions now that we have private
field promotion.
- Require analyzer ^6.9.0.
- Fix analyzer deprecations.

## 2.4.1

Expand Down
10 changes: 7 additions & 3 deletions build/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ name: build
version: 2.4.2-wip
description: A package for authoring build_runner compatible code generators.
repository: https:/dart-lang/build/tree/master/build
resolution: workspace

# This package can't be part of the workspace because it requires a very recent
# Dart SDK - see the top-level pubspec for details.
#resolution: workspace

environment:
sdk: ^3.5.0
sdk: ^3.6.0-228.0.dev

dependencies:
analyzer: ">=1.5.0 <7.0.0"
analyzer: ^6.9.0
async: ^2.5.0
convert: ^3.0.0
crypto: ^3.0.0
Expand All @@ -21,6 +24,7 @@ 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:
Expand Down
8 changes: 5 additions & 3 deletions build/test/builder/build_step_impl_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,15 @@ void main() {

var aLib = await resolver.libraryFor(primary);
expect(aLib.name, 'a');
expect(aLib.importedLibraries.length, 2);
expect(aLib.importedLibraries.any((library) => library.name == 'b'),
expect(aLib.definingCompilationUnit.libraryImports.length, 2);
expect(
aLib.definingCompilationUnit.libraryImports
.any((import) => import.importedLibrary!.name == 'b'),
isTrue);

var bLib = await resolver.findLibraryByName('b');
expect(bLib!.name, 'b');
expect(bLib.importedLibraries.length, 1);
expect(bLib.definingCompilationUnit.libraryImports.length, 1);

await buildStep.complete();
});
Expand Down
4 changes: 2 additions & 2 deletions build/test/generate/run_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void main() {
config.packages.singleWhere((p) => p.name == 'build');
expect(buildPackage.root, Uri.parse('asset:build/'));
expect(buildPackage.packageUriRoot, Uri.parse('asset:build/lib/'));
expect(buildPackage.languageVersion, LanguageVersion(3, 5));
expect(buildPackage.languageVersion, LanguageVersion(3, 6));

final resolvedBuildUri =
config.resolve(Uri.parse('package:build/foo.txt'))!;
Expand All @@ -106,7 +106,7 @@ void main() {
Package(
'build',
Uri.file('/foo/bar/'),
languageVersion: LanguageVersion(3, 5),
languageVersion: LanguageVersion(3, 6),
),
]),
);
Expand Down
1 change: 1 addition & 0 deletions build_modules/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 5.0.10-wip

- Bump the min sdk to 3.5.0.
- Support 3.7.0 pre-release sdks.

## 5.0.9

Expand Down
2 changes: 1 addition & 1 deletion build_modules/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository: https:/dart-lang/build/tree/master/build_modules
resolution: workspace

environment:
sdk: '>=3.5.0 <3.7.0'
sdk: '>=3.5.0 <3.7.0-z'

dependencies:
analyzer: '>=5.1.0 <7.0.0'
Expand Down
3 changes: 2 additions & 1 deletion build_resolvers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

- Require the latest analyzer, and stop passing the `withNullability`
parameter which was previously required and is now deprecated.
- Bump the min sdk to 3.5.0.
- Bump the min sdk to 3.6.0-228.0.dev.
- Fix SDK summary reads when multiple isolates are using build resolvers (not
recommended).
- Fix analyzer deprecations.

## 2.4.2

Expand Down
11 changes: 7 additions & 4 deletions build_resolvers/lib/src/resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ class PerActionResolver implements ReleasableResolver {
// `BuildStep.canRead`. They'd still be reachable by crawling the element
// model manually.
yield current;
final toCrawl = current.importedLibraries
.followedBy(current.exportedLibraries)
.where((l) => !seen.contains(l))
final toCrawl = current.definingCompilationUnit.libraryImports
.map((import) => import.importedLibrary)
.followedBy(current.definingCompilationUnit.libraryExports
.map((export) => export.exportedLibrary))
.nonNulls
.where((library) => !seen.contains(library))
.toSet();
toVisit.addAll(toCrawl);
seen.addAll(toCrawl);
Expand Down Expand Up @@ -279,7 +282,7 @@ class AnalyzerResolver implements ReleasableResolver {
Future<List<ErrorsResult>> _syntacticErrorsFor(LibraryElement element) async {
final existingSources = [element.source];

for (final part in element.parts) {
for (final part in element.definingCompilationUnit.parts) {
var uri = part.uri;
// There may be no source if the part doesn't exist. That's not important
// for us since we only care about existing file syntax.
Expand Down
10 changes: 7 additions & 3 deletions build_resolvers/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ name: build_resolvers
version: 2.4.3-wip
description: Resolve Dart code in a Builder
repository: https:/dart-lang/build/tree/master/build_resolvers
resolution: workspace

# This package can't be part of the workspace because it requires a very recent
# Dart SDK - see the top-level pubspec for details.
#resolution: workspace

environment:
sdk: ^3.5.0
sdk: ^3.6.0-228.0.dev

dependencies:
analyzer: '>=6.7.0 <7.0.0'
analyzer: ^6.9.0
async: ^2.5.0
build: ^2.0.0
collection: ^1.17.0
Expand All @@ -25,6 +28,7 @@ dependencies:

dev_dependencies:
build_test: ^2.0.0
dart_flutter_team_lints: ^3.1.0
test: ^1.16.0

topics:
Expand Down
27 changes: 19 additions & 8 deletions build_resolvers/test/resolver_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ void main() {
''',
}, (resolver) async {
var lib = await resolver.libraryFor(entryPoint);
expect(lib.importedLibraries.length, 2);
var libA = lib.importedLibraries.where((l) => l.name == 'a').single;
expect(lib.definingCompilationUnit.libraryImports.length, 2);
var libA = lib
..definingCompilationUnit
.libraryImports
.where((l) => l.importedLibrary!.name == 'a')
.single;
expect(libA.getClass('Foo'), isNull);
}, resolvers: AnalyzerResolvers());
});
Expand All @@ -64,8 +68,12 @@ void main() {
''',
}, (resolver) async {
var lib = await resolver.libraryFor(entryPoint);
expect(lib.importedLibraries.length, 2);
var libB = lib.importedLibraries.where((l) => l.name == 'b').single;
expect(lib.definingCompilationUnit.libraryImports.length, 2);
var libB = lib
..definingCompilationUnit
.libraryImports
.where((l) => l.importedLibrary!.name == 'b')
.single;
expect(libB.getClass('Foo'), isNull);
}, resolvers: AnalyzerResolvers());
});
Expand Down Expand Up @@ -257,8 +265,11 @@ void main() {
} ''',
}, (resolver) async {
var lib = await resolver.libraryFor(entryPoint);
expect(lib.parts.length, 1);
expect(lib.parts.whereType<DirectiveUriWithSource>(), isEmpty);
expect(lib.definingCompilationUnit.parts.length, 1);
expect(
lib.definingCompilationUnit.parts
.whereType<DirectiveUriWithSource>(),
isEmpty);
}, resolvers: AnalyzerResolvers());
});

Expand Down Expand Up @@ -454,8 +465,8 @@ void main() {
''',
}, (resolver) async {
var entry = await resolver.libraryFor(AssetId('a', 'lib/a.dart'));
var classDefinition = entry.importedLibraries
.map((l) => l.getClass('SomeClass'))
var classDefinition = entry.definingCompilationUnit.libraryImports
.map((l) => l.importedLibrary!.getClass('SomeClass'))
.singleWhere((c) => c != null)!;
expect(await resolver.assetIdForElement(classDefinition),
AssetId('a', 'lib/b.dart'));
Expand Down
4 changes: 3 additions & 1 deletion build_runner_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 7.3.3-wip

- Bump the min sdk to 3.5.0.
- Bump the min sdk to 3.6.0-dev.228.
- Require analyzer ^6.9.0.
- Fix analyzer deprecations.

## 7.3.2

Expand Down
10 changes: 7 additions & 3 deletions build_runner_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ name: build_runner_core
version: 7.3.3-wip
description: Core tools to organize the structure of a build and run Builders.
repository: https:/dart-lang/build/tree/master/build_runner_core
resolution: workspace

# This package can't be part of the workspace because it requires a very recent
# Dart SDK - see the top-level pubspec for details.
#resolution: workspace

environment:
sdk: ^3.5.0
sdk: ^3.6.0-228.0.dev

platforms:
linux:
Expand Down Expand Up @@ -35,9 +38,10 @@ dependencies:
dev_dependencies:
_test_common:
path: ../_test_common
analyzer: '>=5.2.0 <7.0.0'
analyzer: ^6.9.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
Expand Down
8 changes: 6 additions & 2 deletions build_runner_core/test/generate/resolver_reuse_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ void main() {
await buildStep.canRead(buildStep.inputId.addExtension('.foo'));
// Check that the `.imported.dart` library is still reachable
// through the resolver.
var importedLibrary = inputLibrary.importedLibraries.firstWhere(
(l) => l.source.uri.path.endsWith('.imported.dart'));
var importedLibrary = inputLibrary
.definingCompilationUnit.libraryImports
.firstWhere((l) => l
.importedLibrary!.definingCompilationUnit.source.uri.path
.endsWith('.imported.dart'))
.importedLibrary!;
var classNames = importedLibrary.definingCompilationUnit.classes
.map((c) => c.name)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void main() {
final buildRunner =
config.packages.singleWhere((p) => p.name == 'build_runner_core');

expect(buildRunner.languageVersion, LanguageVersion(3, 5));
expect(buildRunner.languageVersion, LanguageVersion(3, 6));
});
});

Expand Down
4 changes: 4 additions & 0 deletions build_web_compilers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.1.0-wip

- Support 3.7.0 pre-release sdks.

## 4.1.0-beta.2

- Add source maps for dart2wasm builds.
Expand Down
9 changes: 7 additions & 2 deletions build_web_compilers/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: build_web_compilers
version: 4.1.0-beta.2
version: 4.1.0-wip
description: Builder implementations wrapping the dart2js and DDC compilers.
repository: https:/dart-lang/build/tree/master/build_web_compilers
# This package can't be part of the workspace because it requires a very recent
# Dart SDK - see the top-level pubspec for details.
#resolution: workspace

environment:
sdk: ^3.6.0-165.0.dev
sdk: '>=3.6.0-165.0.dev <3.7.0-z'

dependencies:
analyzer: '>=5.1.0 <7.0.0'
Expand Down Expand Up @@ -42,5 +42,10 @@ dev_dependencies:
test: ^1.16.0
yaml: ^3.1.0

# TODO: remove once this package is back in the workspace
dependency_overrides:
build_modules:
path: ../build_modules

topics:
- build-runner
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ workspace:
#- _test
#- _test/pkgs/provides_builder
- _test_common
- build
# - build
- build_config
- build_daemon
- build_modules
- build_resolvers
# - build_resolvers
- build_runner
- build_runner_core
# - build_runner_core
- build_test
#- build_web_compilers
- example
Expand Down

0 comments on commit c9a64a4

Please sign in to comment.