Skip to content

Commit ab85097

Browse files
committed
[native assets] Add support for pub workspaces
1 parent 9f9fd77 commit ab85097

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

pkgs/test_core/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 0.6.9-wip
22

3+
- Add support for native assets for `dart test` in pub workspaces.
4+
35
## 0.6.8
46

57
* Fix hang when running multiple precompiled browser tests.

pkgs/test_core/lib/src/runner/vm/test_compiler.dart

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,22 @@ class _TestCompilerForLanguageVersion {
151151
p.relative(p.dirname(p.dirname(Platform.resolvedExecutable)));
152152
final packageConfigUriAwaited = await packageConfigUri;
153153

154-
// If we have native assets for the host os in JIT mode, they are here.
154+
// If we have native assets for the host os in JIT mode, they are either
155+
// in the `.dart_tool/` in the root package or in the pub workspace.
155156
Uri? nativeAssetsYaml;
156157
if (enabledExperiments.contains('native-assets')) {
157-
nativeAssetsYaml = packageConfigUriAwaited.resolve('native_assets.yaml');
158-
if (!await File.fromUri(nativeAssetsYaml).exists()) {
159-
nativeAssetsYaml = null;
158+
final nativeAssetsYamlRootPackage =
159+
Directory.current.uri.resolve('.dart_tool/native_assets.yaml');
160+
final nativeAssetsYamlWorkspace =
161+
packageConfigUriAwaited.resolve('native_assets.yaml');
162+
for (final potentialNativeAssetsUri in [
163+
nativeAssetsYamlRootPackage,
164+
nativeAssetsYamlWorkspace
165+
]) {
166+
if (await File.fromUri(potentialNativeAssetsUri).exists()) {
167+
nativeAssetsYaml = potentialNativeAssetsUri;
168+
break;
169+
}
160170
}
161171
}
162172

0 commit comments

Comments
 (0)