Skip to content

Commit fe6ba55

Browse files
authored
[native_assets_builder] Support pub workspaces 3 (#1924)
1 parent 999ddf1 commit fe6ba55

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ class NativeAssetsBuildRunner {
8888
///
8989
/// This method is invoked by launchers such as dartdev (for `dart run`) and
9090
/// flutter_tools (for `flutter run` and `flutter build`).
91-
Future<bool> hasBuildHooks() async {
91+
Future<List<String>> packagesWithBuildHooks() async {
9292
final planner = await _planner;
9393
final packagesWithHook = await planner.packagesWithHook(Hook.build);
94-
return packagesWithHook.isNotEmpty;
94+
return packagesWithHook.map((e) => e.name).toList();
9595
}
9696

9797
/// This method is invoked by launchers such as dartdev (for `dart run`) and

pkgs/native_assets_builder/test/build_runner/pub_workspace_test.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ workspace:
8787
expect(logs.join('\n'), contains('Skipping build for native_add'));
8888
});
8989

90-
test('hasBuildHooks', () async {
90+
test('packagesWithBuildHooks', () async {
9191
const fileSystem = LocalFileSystem();
9292
final packageUri = tempUri.resolve('no_hook/');
9393
await makePubWorkspace([
@@ -98,9 +98,9 @@ workspace:
9898
'native_add',
9999
'native_subtract',
100100
]);
101-
for (final (runPackageName, hasBuildHooks) in [
102-
('no_hook', false),
103-
('dart_app', true),
101+
for (final (runPackageName, packagesWithBuildHooks) in [
102+
('no_hook', <String>[]),
103+
('dart_app', ['native_add', 'native_subtract']),
104104
]) {
105105
final packageLayoutNoHook = await PackageLayout.fromWorkingDirectory(
106106
fileSystem,
@@ -113,7 +113,10 @@ workspace:
113113
fileSystem: fileSystem,
114114
packageLayout: packageLayoutNoHook,
115115
);
116-
expect(await builderNoHook.hasBuildHooks(), equals(hasBuildHooks));
116+
expect(
117+
await builderNoHook.packagesWithBuildHooks(),
118+
equals(packagesWithBuildHooks),
119+
);
117120
}
118121
});
119122
}

0 commit comments

Comments
 (0)