@@ -13,7 +13,6 @@ import 'package:logging/logging.dart';
1313import 'package:native_assets_builder/native_assets_builder.dart' ;
1414import 'package:native_assets_cli/code_assets_builder.dart' ;
1515import 'package:native_assets_cli/data_assets_builder.dart' ;
16- import 'package:native_assets_cli/native_assets_cli_internal.dart' ;
1716import 'package:package_config/package_config.dart' as package_config;
1817
1918import 'core.dart' ;
@@ -107,23 +106,10 @@ class DartNativeAssetsBuilder {
107106 }
108107
109108 Future <bool > warnOnNativeAssets () async {
110- final workingDirectory = Directory .current.uri;
111-
112109 try {
113- final packageLayout = await PackageLayout .fromWorkingDirectory (
114- _fileSystem,
115- workingDirectory,
116- runPackageName,
117- );
118- final packagesWithNativeAssets = [
119- ...await packageLayout.packagesWithAssets (Hook .build),
120- ...await packageLayout.packagesWithAssets (Hook .link)
121- ];
122- if (packagesWithNativeAssets.isEmpty) {
123- return false ;
124- }
125- final packageNames =
126- packagesWithNativeAssets.map ((p) => p.name).join (' ' );
110+ final builder = await _nativeAssetsBuildRunner;
111+ final packageNames = await builder.packagesWithBuildHooks ();
112+ if (packageNames.isEmpty) return false ;
127113 log.stderr (
128114 'Package(s) $packageNames require the native assets feature to be enabled. '
129115 'Enable native assets with `--enable-experiment=native-assets`.' ,
@@ -141,7 +127,8 @@ class DartNativeAssetsBuilder {
141127 Future <BuildResult ?> _buildNativeAssetsShared ({
142128 required bool linkingEnabled,
143129 }) async {
144- final buildResult = await (await _nativeAssetsBuildRunner).build (
130+ final builder = await _nativeAssetsBuildRunner;
131+ final buildResult = await builder.build (
145132 inputCreator: () => BuildInputBuilder ()
146133 ..config.setupCode (
147134 targetOS: target.os,
@@ -177,7 +164,8 @@ class DartNativeAssetsBuilder {
177164 required String ? recordedUsagesPath,
178165 required BuildResult buildResult,
179166 }) async {
180- final linkResult = await (await _nativeAssetsBuildRunner).link (
167+ final builder = await _nativeAssetsBuildRunner;
168+ final linkResult = await builder.link (
181169 inputCreator: () => LinkInputBuilder ()
182170 ..config.setupCode (
183171 targetOS: target.os,
0 commit comments