Skip to content

[native assets] Add support for pub workspaces #2484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkgs/test_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 0.6.9-wip

- Add support for native assets for `dart test` in pub workspaces.

## 0.6.8

* Fix hang when running multiple precompiled browser tests.
Expand Down
18 changes: 14 additions & 4 deletions pkgs/test_core/lib/src/runner/vm/test_compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,22 @@ class _TestCompilerForLanguageVersion {
p.relative(p.dirname(p.dirname(Platform.resolvedExecutable)));
final packageConfigUriAwaited = await packageConfigUri;

// If we have native assets for the host os in JIT mode, they are here.
// If we have native assets for the host os in JIT mode, they are either
// in the `.dart_tool/` in the root package or in the pub workspace.
Uri? nativeAssetsYaml;
if (enabledExperiments.contains('native-assets')) {
nativeAssetsYaml = packageConfigUriAwaited.resolve('native_assets.yaml');
if (!await File.fromUri(nativeAssetsYaml).exists()) {
nativeAssetsYaml = null;
final nativeAssetsYamlRootPackage =
Directory.current.uri.resolve('.dart_tool/native_assets.yaml');
final nativeAssetsYamlWorkspace =
packageConfigUriAwaited.resolve('native_assets.yaml');
for (final potentialNativeAssetsUri in [
nativeAssetsYamlRootPackage,
nativeAssetsYamlWorkspace
]) {
if (await File.fromUri(potentialNativeAssetsUri).exists()) {
nativeAssetsYaml = potentialNativeAssetsUri;
break;
}
}
}

Expand Down