Skip to content

Commit aef2758

Browse files
authored
[native assets] Roll dependencies (flutter#155432)
Rolls native deps to the latest version, and cleans up deprecated field from template. Tests: * All the unit and integration tests for native assets. The template and dependencies are exercised in the integration test. Since `package:native_assets_builder` already checks for having no static libraries as output, the custom check in flutter_tools is removed. The tests stubbing out the native assets builder exercising the custom check are also removed. (The integration tests now check for the error message from the native assets builder.)
1 parent b411047 commit aef2758

File tree

13 files changed

+13
-171
lines changed

13 files changed

+13
-171
lines changed

dev/integration_tests/link_hook/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ environment:
88
dependencies:
99
cli_config: 0.2.0
1010
logging: 1.2.0
11-
native_assets_cli: 0.7.3
12-
native_toolchain_c: 0.5.3
11+
native_assets_cli: 0.8.0
12+
native_toolchain_c: 0.5.4
1313

1414
_fe_analyzer_shared: 74.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
1515
analyzer: 6.9.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -68,4 +68,4 @@ dev_dependencies:
6868
quiver: 3.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
6969
yaml_edit: 2.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
7070

71-
# PUBSPEC CHECKSUM: 43c9
71+
# PUBSPEC CHECKSUM: c1c8

packages/flutter_tools/lib/src/isolated/native_assets/android/native_assets.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ Future<Iterable<KernelAsset>> dryRunNativeAssetsAndroidInternal(
5959
ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult);
6060
// No link hooks in JIT mode.
6161
final List<AssetImpl> nativeAssets = buildDryRunResult.assets;
62-
ensureNoLinkModeStatic(nativeAssets);
63-
globals.logger.printTrace('Dry running native assets for $targetOS done.');
62+
globals.logger.printTrace('Dry running native assets for $targetOS done.');
6463
final Map<AssetImpl, KernelAsset> assetTargetLocations =
6564
_assetTargetLocations(nativeAssets);
6665
return assetTargetLocations.values;
@@ -128,7 +127,6 @@ Future<(Uri? nativeAssetsYaml, List<Uri> dependencies)>
128127
dependencies.addAll(linkResult.dependencies);
129128
}
130129
}
131-
ensureNoLinkModeStatic(nativeAssets);
132130
globals.logger.printTrace('Building native assets for $targets done.');
133131
final Map<AssetImpl, KernelAsset> assetTargetLocations =
134132
_assetTargetLocations(nativeAssets);

packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ Future<Iterable<KernelAsset>> dryRunNativeAssetsIOSInternal(
5656
ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult);
5757
// No link hooks in JIT.
5858
final List<AssetImpl> nativeAssets = buildDryRunResult.assets;
59-
ensureNoLinkModeStatic(nativeAssets);
6059
globals.logger.printTrace('Dry running native assets for $targetOS done.');
6160
return _assetTargetLocations(nativeAssets).values;
6261
}
@@ -122,7 +121,6 @@ Future<List<Uri>> buildNativeAssetsIOS({
122121
dependencies.addAll(linkResult.dependencies);
123122
}
124123
}
125-
ensureNoLinkModeStatic(nativeAssets);
126124
globals.logger.printTrace('Building native assets for $targets done.');
127125
final Map<KernelAssetPath, List<AssetImpl>> fatAssetTargetLocations =
128126
_fatAssetTargetLocations(nativeAssets);

packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ Future<Iterable<KernelAsset>> dryRunNativeAssetsMacOSInternal(
6161
ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult);
6262
// No link hooks in JIT mode.
6363
final List<AssetImpl> nativeAssets = buildDryRunResult.assets;
64-
ensureNoLinkModeStatic(nativeAssets);
6564
globals.logger.printTrace('Dry running native assets for $targetOS done.');
6665
final Uri? absolutePath = flutterTester ? buildUri : null;
6766
final Map<AssetImpl, KernelAsset> assetTargetLocations =
@@ -143,7 +142,6 @@ Future<(Uri? nativeAssetsYaml, List<Uri> dependencies)> buildNativeAssetsMacOS({
143142
dependencies.addAll(linkResult.dependencies);
144143
}
145144
}
146-
ensureNoLinkModeStatic(nativeAssets);
147145
globals.logger.printTrace('Building native assets for $targets done.');
148146
final Uri? absolutePath = flutterTester ? buildUri : null;
149147
final Map<AssetImpl, KernelAsset> assetTargetLocations =

packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -382,27 +382,6 @@ Future<void> ensureNoNativeAssetsOrOsIsSupported(
382382
);
383383
}
384384

385-
/// Ensure all native assets have a linkmode declared to be dynamic loading.
386-
///
387-
/// In JIT, the link mode must always be dynamic linking.
388-
/// In AOT, the static linking has not yet been implemented in Dart:
389-
/// https://github.com/dart-lang/sdk/issues/49418.
390-
///
391-
/// Therefore, ensure all `build.dart` scripts return only dynamic libraries.
392-
void ensureNoLinkModeStatic(List<AssetImpl> nativeAssets) {
393-
final Iterable<AssetImpl> staticAssets = nativeAssets.where((AssetImpl e) =>
394-
e is NativeCodeAssetImpl && e.linkMode == StaticLinkingImpl());
395-
if (staticAssets.isNotEmpty) {
396-
final String assetIds =
397-
staticAssets.map((AssetImpl a) => a.id).toSet().join(', ');
398-
throwToolExit(
399-
'Native asset(s) $assetIds have their link mode set to static, '
400-
'but this is not yet supported. '
401-
'For more info see https://github.com/dart-lang/sdk/issues/49418.',
402-
);
403-
}
404-
}
405-
406385
/// This should be the same for different archs, debug/release, etc.
407386
/// It should work for all macOS.
408387
Uri nativeAssetsBuildUri(Uri projectUri, OS os) {
@@ -665,7 +644,6 @@ Future<Iterable<KernelAsset>> dryRunNativeAssetsSingleArchitectureInternal(
665644
ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult);
666645
// No link hooks in JIT mode.
667646
final List<AssetImpl> nativeAssets = buildDryRunResult.assets;
668-
ensureNoLinkModeStatic(nativeAssets);
669647
globals.logger.printTrace('Dry running native assets for $targetOS done.');
670648
final Uri? absolutePath = flutterTester ? buildUri : null;
671649
final Map<AssetImpl, KernelAsset> assetTargetLocations =
@@ -744,7 +722,6 @@ Future<(Uri? nativeAssetsYaml, List<Uri> dependencies)> buildNativeAssetsSingleA
744722
...buildResult.dependencies,
745723
if (linkingEnabled) ...linkResult.dependencies,
746724
};
747-
ensureNoLinkModeStatic(nativeAssets);
748725
globals.logger.printTrace('Building native assets for $target done.');
749726
final Uri? absolutePath = flutterTester ? buildUri : null;
750727
final Map<AssetImpl, KernelAsset> assetTargetLocations =

packages/flutter_tools/lib/src/update_packages_pins.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const Map<String, String> kManuallyPinnedDependencies = <String, String>{
2222
// Add pinned packages here. Please leave a comment explaining why.
2323
'flutter_gallery_assets': '1.0.2', // Tests depend on the exact version.
2424
'flutter_template_images': '4.2.0', // Must always exactly match flutter_tools template.
25-
'native_assets_builder': '0.8.2', // Under active development with breaking changes until 1.0.0. Manually rolled by @dcharkes.
26-
'native_assets_cli': '0.7.3', // Under active development with breaking changes until 1.0.0. Manually rolled by @dcharkes.
25+
'native_assets_builder': '0.8.3', // Under active development with breaking changes until 1.0.0. Manually rolled by @dcharkes.
26+
'native_assets_cli': '0.8.0', // Under active development with breaking changes until 1.0.0. Manually rolled by @dcharkes.
2727
'material_color_utilities': '0.11.1', // Keep pinned to latest until 1.0.0.
2828
'leak_tracker': '10.0.7', // https://github.com/flutter/devtools/issues/3951
2929
'leak_tracker_testing': '3.0.1', // https://github.com/flutter/devtools/issues/3951

packages/flutter_tools/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ dependencies:
5656

5757
cli_config: 0.2.0
5858
graphs: 2.3.2
59-
native_assets_builder: 0.8.2
60-
native_assets_cli: 0.7.3
59+
native_assets_builder: 0.8.3
60+
native_assets_cli: 0.8.0
6161

6262
# We depend on very specific internal implementation details of the
6363
# 'test' package, which change between versions, so when upgrading
@@ -122,4 +122,4 @@ dartdoc:
122122
# Exclude this package from the hosted API docs.
123123
nodoc: true
124124

125-
# PUBSPEC CHECKSUM: 40f5
125+
# PUBSPEC CHECKSUM: 01f4

packages/flutter_tools/templates/package_ffi/hook/build.dart.tmpl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import 'package:native_toolchain_c/native_toolchain_c.dart';
22
import 'package:logging/logging.dart';
33
import 'package:native_assets_cli/native_assets_cli.dart';
44

5-
const packageName = '{{projectName}}';
6-
75
void main(List<String> args) async {
86
await build(args, (config, output) async {
97
final packageName = config.packageName;
@@ -13,7 +11,6 @@ void main(List<String> args) async {
1311
sources: [
1412
'src/$packageName.c',
1513
],
16-
dartBuildFiles: ['hook/build.dart'],
1714
);
1815
await cbuilder.run(
1916
config: config,

packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ environment:
99
dependencies:
1010
cli_config: ^0.2.0
1111
logging: ^1.2.0
12-
native_assets_cli: ^0.7.3
13-
native_toolchain_c: ^0.5.3
12+
native_assets_cli: ^0.8.0
13+
native_toolchain_c: ^0.5.4
1414

1515
dev_dependencies:
1616
ffi: ^2.1.3

packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -340,49 +340,6 @@ void main() {
340340
}
341341
}
342342

343-
testUsingContext('static libs not supported', overrides: <Type, Generator>{
344-
FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true),
345-
ProcessManager: () => FakeProcessManager.empty(),
346-
}, () async {
347-
final File packageConfig = environment.projectDir.childFile('.dart_tool/package_config.json');
348-
await packageConfig.parent.create();
349-
await packageConfig.create();
350-
expect(
351-
() => dryRunNativeAssetsLinux(
352-
projectUri: projectUri,
353-
fileSystem: fileSystem,
354-
buildRunner: FakeNativeAssetsBuildRunner(
355-
packagesWithNativeAssetsResult: <Package>[
356-
Package('bar', projectUri),
357-
],
358-
buildDryRunResult: FakeNativeAssetsBuilderResult(
359-
assets: <AssetImpl>[
360-
NativeCodeAssetImpl(
361-
id: 'package:bar/bar.dart',
362-
linkMode: StaticLinkingImpl(),
363-
os: OSImpl.macOS,
364-
architecture: ArchitectureImpl.arm64,
365-
file: Uri.file('bar.a'),
366-
),
367-
NativeCodeAssetImpl(
368-
id: 'package:bar/bar.dart',
369-
linkMode: StaticLinkingImpl(),
370-
os: OSImpl.macOS,
371-
architecture: ArchitectureImpl.x64,
372-
file: Uri.file('bar.a'),
373-
),
374-
],
375-
),
376-
),
377-
),
378-
throwsToolExit(
379-
message: 'Native asset(s) package:bar/bar.dart have their link mode set to '
380-
'static, but this is not yet supported. '
381-
'For more info see https://github.com/dart-lang/sdk/issues/49418.',
382-
),
383-
);
384-
});
385-
386343
testUsingContext('Native assets dry run error', overrides: <Type, Generator>{
387344
FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true),
388345
ProcessManager: () => FakeProcessManager.empty(),

0 commit comments

Comments
 (0)