Make flutter_tools use newest package:{native_assets_builder,native_assets_cli,native_toolchain_c} (#158214)
Almost all of the code is just adopting to changes to the APIs of `package:native_assets_builder`, `package:native_assets_cli` and `package:native_toolchain_c` There's only two semantic changes * Removes a test that checks for a verification error if a build hook produces a static library if the preferred linking mode is dynamic: => The test is written in a very hacky way. By monkey patching the build config.json that flutter build actually made. This monkey patching relies on package:cli_config which is now no longer used. => The actual code that checks for this mismatch lives in dart-lang/native repository and is tested there. So there's really no need to duplicate that. * The `package:native_assets_builder` no longer knows about code assets. This is something a user of that package (e.g. flutter tools) adds. Now the dry-run functionality will invoke build hooks who produce code assets without an architecture. => The `package:native_assets_builder` used to expand such a code asset to N different code assets (one for each supported architecture) => This logic was now moved to flutter tools. => In the near future we're going to this dry-run complexity, which will then also get rid of this uglyness (of expanding to all archs of an OS).
This commit is contained in:
committed by
GitHub
parent
22a7afd99a
commit
3a83e43ede
@@ -3,12 +3,12 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:native_assets_cli/native_assets_cli.dart';
|
||||
import 'package:native_assets_cli/code_assets.dart';
|
||||
import 'package:native_assets_cli/code_assets_builder.dart';
|
||||
import 'package:native_toolchain_c/native_toolchain_c.dart';
|
||||
|
||||
|
||||
void main(List<String> args) async {
|
||||
await build(args, (BuildConfig config, BuildOutput output) async {
|
||||
await build(args, (BuildConfig config, BuildOutputBuilder output) async {
|
||||
final String assetName;
|
||||
if (config.linkingEnabled) {
|
||||
// The link hook will be run. So emit an asset with a name that is
|
||||
@@ -30,7 +30,7 @@ void main(List<String> args) async {
|
||||
],
|
||||
dartBuildFiles: <String>['hook/build.dart'],
|
||||
);
|
||||
final BuildOutput outputCatcher = BuildOutput();
|
||||
final BuildOutputBuilder outputCatcher = BuildOutputBuilder();
|
||||
await cbuilder.run(
|
||||
config: config,
|
||||
output: outputCatcher,
|
||||
@@ -38,10 +38,11 @@ void main(List<String> args) async {
|
||||
..level = Level.ALL
|
||||
..onRecord.listen((LogRecord record) => print(record.message)),
|
||||
);
|
||||
output.addDependencies(outputCatcher.dependencies);
|
||||
final BuildOutput catchedOutput = BuildOutput(outputCatcher.json);
|
||||
output.addDependencies(catchedOutput.dependencies);
|
||||
// Send the asset to hook/link.dart or immediately for bundling.
|
||||
output.addAsset(
|
||||
outputCatcher.assets.single,
|
||||
output.codeAssets.add(
|
||||
catchedOutput.codeAssets.single,
|
||||
linkInPackage: config.linkingEnabled ? 'link_hook' : null,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:native_assets_cli/native_assets_cli.dart';
|
||||
import 'package:native_assets_cli/code_assets.dart';
|
||||
|
||||
void main(List<String> args) async {
|
||||
await link(args, (LinkConfig config, LinkOutput output) async {
|
||||
final NativeCodeAsset asset = config.assets.single as NativeCodeAsset;
|
||||
await link(args, (LinkConfig config, LinkOutputBuilder output) async {
|
||||
final CodeAsset asset = config.codeAssets.single;
|
||||
final String packageName = config.packageName;
|
||||
output.addAsset(NativeCodeAsset(
|
||||
output.codeAssets.add(CodeAsset(
|
||||
package: packageName,
|
||||
// Change the asset id to something that is used.
|
||||
name: '${packageName}_bindings_generated.dart',
|
||||
|
||||
@@ -6,10 +6,9 @@ environment:
|
||||
sdk: '>=3.5.0-154.0.dev <4.0.0'
|
||||
|
||||
dependencies:
|
||||
cli_config: 0.2.0
|
||||
logging: 1.2.0
|
||||
native_assets_cli: 0.8.0
|
||||
native_toolchain_c: 0.5.4
|
||||
native_assets_cli: 0.9.0
|
||||
native_toolchain_c: 0.6.0
|
||||
|
||||
_fe_analyzer_shared: 76.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
analyzer: 6.11.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
@@ -68,4 +67,4 @@ dev_dependencies:
|
||||
quiver: 3.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
yaml_edit: 2.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
|
||||
# PUBSPEC CHECKSUM: ddf6
|
||||
# PUBSPEC CHECKSUM: a89a
|
||||
|
||||
Reference in New Issue
Block a user