diff --git a/dev/integration_tests/link_hook/pubspec.yaml b/dev/integration_tests/link_hook/pubspec.yaml index 8874770d1f..ed60a0cbec 100644 --- a/dev/integration_tests/link_hook/pubspec.yaml +++ b/dev/integration_tests/link_hook/pubspec.yaml @@ -8,8 +8,8 @@ environment: dependencies: cli_config: 0.2.0 logging: 1.2.0 - native_assets_cli: 0.7.3 - native_toolchain_c: 0.5.3 + native_assets_cli: 0.8.0 + native_toolchain_c: 0.5.4 _fe_analyzer_shared: 74.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" analyzer: 6.9.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" @@ -68,4 +68,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: 43c9 +# PUBSPEC CHECKSUM: c1c8 diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/android/native_assets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/android/native_assets.dart index d179316ab3..1a8b2fcf6b 100644 --- a/packages/flutter_tools/lib/src/isolated/native_assets/android/native_assets.dart +++ b/packages/flutter_tools/lib/src/isolated/native_assets/android/native_assets.dart @@ -59,8 +59,7 @@ Future> dryRunNativeAssetsAndroidInternal( ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult); // No link hooks in JIT mode. final List nativeAssets = buildDryRunResult.assets; - ensureNoLinkModeStatic(nativeAssets); - globals.logger.printTrace('Dry running native assets for $targetOS done.'); + globals.logger.printTrace('Dry running native assets for $targetOS done.'); final Map assetTargetLocations = _assetTargetLocations(nativeAssets); return assetTargetLocations.values; @@ -128,7 +127,6 @@ Future<(Uri? nativeAssetsYaml, List dependencies)> dependencies.addAll(linkResult.dependencies); } } - ensureNoLinkModeStatic(nativeAssets); globals.logger.printTrace('Building native assets for $targets done.'); final Map assetTargetLocations = _assetTargetLocations(nativeAssets); diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart index a0505cd9f5..427ccc45fd 100644 --- a/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart +++ b/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart @@ -56,7 +56,6 @@ Future> dryRunNativeAssetsIOSInternal( ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult); // No link hooks in JIT. final List nativeAssets = buildDryRunResult.assets; - ensureNoLinkModeStatic(nativeAssets); globals.logger.printTrace('Dry running native assets for $targetOS done.'); return _assetTargetLocations(nativeAssets).values; } @@ -122,7 +121,6 @@ Future> buildNativeAssetsIOS({ dependencies.addAll(linkResult.dependencies); } } - ensureNoLinkModeStatic(nativeAssets); globals.logger.printTrace('Building native assets for $targets done.'); final Map> fatAssetTargetLocations = _fatAssetTargetLocations(nativeAssets); diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets.dart index ae70ca89ef..e6d681aa45 100644 --- a/packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets.dart +++ b/packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets.dart @@ -61,7 +61,6 @@ Future> dryRunNativeAssetsMacOSInternal( ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult); // No link hooks in JIT mode. final List nativeAssets = buildDryRunResult.assets; - ensureNoLinkModeStatic(nativeAssets); globals.logger.printTrace('Dry running native assets for $targetOS done.'); final Uri? absolutePath = flutterTester ? buildUri : null; final Map assetTargetLocations = @@ -143,7 +142,6 @@ Future<(Uri? nativeAssetsYaml, List dependencies)> buildNativeAssetsMacOS({ dependencies.addAll(linkResult.dependencies); } } - ensureNoLinkModeStatic(nativeAssets); globals.logger.printTrace('Building native assets for $targets done.'); final Uri? absolutePath = flutterTester ? buildUri : null; final Map assetTargetLocations = diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart index 0dee80b7f1..99e1a6f522 100644 --- a/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart +++ b/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart @@ -382,27 +382,6 @@ Future ensureNoNativeAssetsOrOsIsSupported( ); } -/// Ensure all native assets have a linkmode declared to be dynamic loading. -/// -/// In JIT, the link mode must always be dynamic linking. -/// In AOT, the static linking has not yet been implemented in Dart: -/// https://github.com/dart-lang/sdk/issues/49418. -/// -/// Therefore, ensure all `build.dart` scripts return only dynamic libraries. -void ensureNoLinkModeStatic(List nativeAssets) { - final Iterable staticAssets = nativeAssets.where((AssetImpl e) => - e is NativeCodeAssetImpl && e.linkMode == StaticLinkingImpl()); - if (staticAssets.isNotEmpty) { - final String assetIds = - staticAssets.map((AssetImpl a) => a.id).toSet().join(', '); - throwToolExit( - 'Native asset(s) $assetIds have their link mode set to static, ' - 'but this is not yet supported. ' - 'For more info see https://github.com/dart-lang/sdk/issues/49418.', - ); - } -} - /// This should be the same for different archs, debug/release, etc. /// It should work for all macOS. Uri nativeAssetsBuildUri(Uri projectUri, OS os) { @@ -665,7 +644,6 @@ Future> dryRunNativeAssetsSingleArchitectureInternal( ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult); // No link hooks in JIT mode. final List nativeAssets = buildDryRunResult.assets; - ensureNoLinkModeStatic(nativeAssets); globals.logger.printTrace('Dry running native assets for $targetOS done.'); final Uri? absolutePath = flutterTester ? buildUri : null; final Map assetTargetLocations = @@ -744,7 +722,6 @@ Future<(Uri? nativeAssetsYaml, List dependencies)> buildNativeAssetsSingleA ...buildResult.dependencies, if (linkingEnabled) ...linkResult.dependencies, }; - ensureNoLinkModeStatic(nativeAssets); globals.logger.printTrace('Building native assets for $target done.'); final Uri? absolutePath = flutterTester ? buildUri : null; final Map assetTargetLocations = diff --git a/packages/flutter_tools/lib/src/update_packages_pins.dart b/packages/flutter_tools/lib/src/update_packages_pins.dart index c0556e7302..2abee682f5 100644 --- a/packages/flutter_tools/lib/src/update_packages_pins.dart +++ b/packages/flutter_tools/lib/src/update_packages_pins.dart @@ -22,8 +22,8 @@ const Map kManuallyPinnedDependencies = { // Add pinned packages here. Please leave a comment explaining why. 'flutter_gallery_assets': '1.0.2', // Tests depend on the exact version. 'flutter_template_images': '4.2.0', // Must always exactly match flutter_tools template. - 'native_assets_builder': '0.8.2', // Under active development with breaking changes until 1.0.0. Manually rolled by @dcharkes. - 'native_assets_cli': '0.7.3', // Under active development with breaking changes until 1.0.0. Manually rolled by @dcharkes. + 'native_assets_builder': '0.8.3', // Under active development with breaking changes until 1.0.0. Manually rolled by @dcharkes. + 'native_assets_cli': '0.8.0', // Under active development with breaking changes until 1.0.0. Manually rolled by @dcharkes. 'material_color_utilities': '0.11.1', // Keep pinned to latest until 1.0.0. 'leak_tracker': '10.0.7', // https://github.com/flutter/devtools/issues/3951 'leak_tracker_testing': '3.0.1', // https://github.com/flutter/devtools/issues/3951 diff --git a/packages/flutter_tools/pubspec.yaml b/packages/flutter_tools/pubspec.yaml index 3ac5424c3c..e3bcf88c0c 100644 --- a/packages/flutter_tools/pubspec.yaml +++ b/packages/flutter_tools/pubspec.yaml @@ -56,8 +56,8 @@ dependencies: cli_config: 0.2.0 graphs: 2.3.2 - native_assets_builder: 0.8.2 - native_assets_cli: 0.7.3 + native_assets_builder: 0.8.3 + native_assets_cli: 0.8.0 # We depend on very specific internal implementation details of the # 'test' package, which change between versions, so when upgrading @@ -122,4 +122,4 @@ dartdoc: # Exclude this package from the hosted API docs. nodoc: true -# PUBSPEC CHECKSUM: 40f5 +# PUBSPEC CHECKSUM: 01f4 diff --git a/packages/flutter_tools/templates/package_ffi/hook/build.dart.tmpl b/packages/flutter_tools/templates/package_ffi/hook/build.dart.tmpl index 73be953f99..f32f7ef74b 100644 --- a/packages/flutter_tools/templates/package_ffi/hook/build.dart.tmpl +++ b/packages/flutter_tools/templates/package_ffi/hook/build.dart.tmpl @@ -2,8 +2,6 @@ import 'package:native_toolchain_c/native_toolchain_c.dart'; import 'package:logging/logging.dart'; import 'package:native_assets_cli/native_assets_cli.dart'; -const packageName = '{{projectName}}'; - void main(List args) async { await build(args, (config, output) async { final packageName = config.packageName; @@ -13,7 +11,6 @@ void main(List args) async { sources: [ 'src/$packageName.c', ], - dartBuildFiles: ['hook/build.dart'], ); await cbuilder.run( config: config, diff --git a/packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl b/packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl index 0355b4d1a5..f6386bbc7a 100644 --- a/packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl +++ b/packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl @@ -9,8 +9,8 @@ environment: dependencies: cli_config: ^0.2.0 logging: ^1.2.0 - native_assets_cli: ^0.7.3 - native_toolchain_c: ^0.5.3 + native_assets_cli: ^0.8.0 + native_toolchain_c: ^0.5.4 dev_dependencies: ffi: ^2.1.3 diff --git a/packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart index dac1d72bca..793df6f7ec 100644 --- a/packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart +++ b/packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart @@ -340,49 +340,6 @@ void main() { } } - testUsingContext('static libs not supported', overrides: { - FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true), - ProcessManager: () => FakeProcessManager.empty(), - }, () async { - final File packageConfig = environment.projectDir.childFile('.dart_tool/package_config.json'); - await packageConfig.parent.create(); - await packageConfig.create(); - expect( - () => dryRunNativeAssetsLinux( - projectUri: projectUri, - fileSystem: fileSystem, - buildRunner: FakeNativeAssetsBuildRunner( - packagesWithNativeAssetsResult: [ - Package('bar', projectUri), - ], - buildDryRunResult: FakeNativeAssetsBuilderResult( - assets: [ - NativeCodeAssetImpl( - id: 'package:bar/bar.dart', - linkMode: StaticLinkingImpl(), - os: OSImpl.macOS, - architecture: ArchitectureImpl.arm64, - file: Uri.file('bar.a'), - ), - NativeCodeAssetImpl( - id: 'package:bar/bar.dart', - linkMode: StaticLinkingImpl(), - os: OSImpl.macOS, - architecture: ArchitectureImpl.x64, - file: Uri.file('bar.a'), - ), - ], - ), - ), - ), - throwsToolExit( - message: 'Native asset(s) package:bar/bar.dart have their link mode set to ' - 'static, but this is not yet supported. ' - 'For more info see https://github.com/dart-lang/sdk/issues/49418.', - ), - ); - }); - testUsingContext('Native assets dry run error', overrides: { FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true), ProcessManager: () => FakeProcessManager.empty(), diff --git a/packages/flutter_tools/test/general.shard/isolated/macos/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/macos/native_assets_test.dart index 39ba493310..3d23fb8b66 100644 --- a/packages/flutter_tools/test/general.shard/isolated/macos/native_assets_test.dart +++ b/packages/flutter_tools/test/general.shard/isolated/macos/native_assets_test.dart @@ -541,51 +541,6 @@ void main() { } } - testUsingContext('static libs not supported', overrides: { - FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true), - ProcessManager: () => FakeProcessManager.empty(), - }, () async { - final File packageConfig = environment.projectDir.childFile('.dart_tool/package_config.json'); - await packageConfig.parent.create(); - await packageConfig.create(); - expect( - () => dryRunNativeAssetsMacOS( - projectUri: projectUri, - fileSystem: fileSystem, - buildRunner: FakeNativeAssetsBuildRunner( - packagesWithNativeAssetsResult: [ - Package('bar', projectUri), - ], - buildDryRunResult: FakeNativeAssetsBuilderResult( - assets: [ - NativeCodeAssetImpl( - id: 'package:bar/bar.dart', - linkMode: StaticLinkingImpl(), - os: OSImpl.macOS, - architecture: ArchitectureImpl.arm64, - file: Uri.file('bar.a'), - ), - NativeCodeAssetImpl( - id: 'package:bar/bar.dart', - linkMode: StaticLinkingImpl(), - os: OSImpl.macOS, - architecture: ArchitectureImpl.x64, - file: Uri.file('bar.a'), - ), - ], - ), - ), - ), - throwsToolExit( - message: 'Native asset(s) package:bar/bar.dart have their link mode set to ' - 'static, but this is not yet supported. ' - 'For more info see https://github.com/dart-lang/sdk/issues/49418.', - ), - ); - }); - - - testUsingContext('Native assets dry run error', overrides: { FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true), ProcessManager: () => FakeProcessManager.empty(), diff --git a/packages/flutter_tools/test/general.shard/isolated/windows/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/windows/native_assets_test.dart index 2eada062d9..45c35d8a14 100644 --- a/packages/flutter_tools/test/general.shard/isolated/windows/native_assets_test.dart +++ b/packages/flutter_tools/test/general.shard/isolated/windows/native_assets_test.dart @@ -306,44 +306,6 @@ void main() { } } - testUsingContext('static libs not supported', overrides: { - FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true), - ProcessManager: () => FakeProcessManager.empty(), - }, () async { - final File packageConfig = environment.projectDir.childFile('.dart_tool/package_config.json'); - await packageConfig.parent.create(); - await packageConfig.create(); - expect( - () => dryRunNativeAssetsWindows( - projectUri: projectUri, - fileSystem: fileSystem, - buildRunner: FakeNativeAssetsBuildRunner( - packagesWithNativeAssetsResult: [ - Package('bar', projectUri), - ], - buildDryRunResult: FakeNativeAssetsBuilderResult( - assets: [ - NativeCodeAssetImpl( - id: 'package:bar/bar.dart', - linkMode: StaticLinkingImpl(), - os: OSImpl.windows, - architecture: ArchitectureImpl.x64, - file: Uri.file(OSImpl.windows.staticlibFileName('bar')), - ), - ], - ), - ), - ), - throwsToolExit( - message: 'Native asset(s) package:bar/bar.dart have their link mode set to ' - 'static, but this is not yet supported. ' - 'For more info see https://github.com/dart-lang/sdk/issues/49418.', - ), - ); - }); - - - testUsingContext('Native assets dry run error', overrides: { FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true), ProcessManager: () => FakeProcessManager.empty(), diff --git a/packages/flutter_tools/test/integration.shard/isolated/native_assets_test.dart b/packages/flutter_tools/test/integration.shard/isolated/native_assets_test.dart index e8f7b567f1..104e35fe1c 100644 --- a/packages/flutter_tools/test/integration.shard/isolated/native_assets_test.dart +++ b/packages/flutter_tools/test/integration.shard/isolated/native_assets_test.dart @@ -271,13 +271,13 @@ void main() { 'build', buildSubcommand, if (buildSubcommand == 'ios') '--no-codesign', - if (buildSubcommand == 'windows') '-v' // Requires verbose mode for error. + '-v', // Requires verbose mode for error. ], workingDirectory: exampleDirectory.path, ); expect( (result.stdout as String) + (result.stderr as String), - contains('link mode set to static, but this is not yet supported'), + contains('has a link mode "static", which is not allowed by by the config link mode preference "dynamic"'), ); expect(result.exitCode, isNot(0)); });