[native assets] Roll dependencies (#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.)
This commit is contained in:
parent
b411047401
commit
aef2758716
@ -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
|
||||
|
@ -59,8 +59,7 @@ Future<Iterable<KernelAsset>> dryRunNativeAssetsAndroidInternal(
|
||||
ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult);
|
||||
// No link hooks in JIT mode.
|
||||
final List<AssetImpl> 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<AssetImpl, KernelAsset> assetTargetLocations =
|
||||
_assetTargetLocations(nativeAssets);
|
||||
return assetTargetLocations.values;
|
||||
@ -128,7 +127,6 @@ Future<(Uri? nativeAssetsYaml, List<Uri> dependencies)>
|
||||
dependencies.addAll(linkResult.dependencies);
|
||||
}
|
||||
}
|
||||
ensureNoLinkModeStatic(nativeAssets);
|
||||
globals.logger.printTrace('Building native assets for $targets done.');
|
||||
final Map<AssetImpl, KernelAsset> assetTargetLocations =
|
||||
_assetTargetLocations(nativeAssets);
|
||||
|
@ -56,7 +56,6 @@ Future<Iterable<KernelAsset>> dryRunNativeAssetsIOSInternal(
|
||||
ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult);
|
||||
// No link hooks in JIT.
|
||||
final List<AssetImpl> nativeAssets = buildDryRunResult.assets;
|
||||
ensureNoLinkModeStatic(nativeAssets);
|
||||
globals.logger.printTrace('Dry running native assets for $targetOS done.');
|
||||
return _assetTargetLocations(nativeAssets).values;
|
||||
}
|
||||
@ -122,7 +121,6 @@ Future<List<Uri>> buildNativeAssetsIOS({
|
||||
dependencies.addAll(linkResult.dependencies);
|
||||
}
|
||||
}
|
||||
ensureNoLinkModeStatic(nativeAssets);
|
||||
globals.logger.printTrace('Building native assets for $targets done.');
|
||||
final Map<KernelAssetPath, List<AssetImpl>> fatAssetTargetLocations =
|
||||
_fatAssetTargetLocations(nativeAssets);
|
||||
|
@ -61,7 +61,6 @@ Future<Iterable<KernelAsset>> dryRunNativeAssetsMacOSInternal(
|
||||
ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult);
|
||||
// No link hooks in JIT mode.
|
||||
final List<AssetImpl> nativeAssets = buildDryRunResult.assets;
|
||||
ensureNoLinkModeStatic(nativeAssets);
|
||||
globals.logger.printTrace('Dry running native assets for $targetOS done.');
|
||||
final Uri? absolutePath = flutterTester ? buildUri : null;
|
||||
final Map<AssetImpl, KernelAsset> assetTargetLocations =
|
||||
@ -143,7 +142,6 @@ Future<(Uri? nativeAssetsYaml, List<Uri> 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<AssetImpl, KernelAsset> assetTargetLocations =
|
||||
|
@ -382,27 +382,6 @@ Future<void> 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<AssetImpl> nativeAssets) {
|
||||
final Iterable<AssetImpl> 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<Iterable<KernelAsset>> dryRunNativeAssetsSingleArchitectureInternal(
|
||||
ensureNativeAssetsBuildDryRunSucceed(buildDryRunResult);
|
||||
// No link hooks in JIT mode.
|
||||
final List<AssetImpl> nativeAssets = buildDryRunResult.assets;
|
||||
ensureNoLinkModeStatic(nativeAssets);
|
||||
globals.logger.printTrace('Dry running native assets for $targetOS done.');
|
||||
final Uri? absolutePath = flutterTester ? buildUri : null;
|
||||
final Map<AssetImpl, KernelAsset> assetTargetLocations =
|
||||
@ -744,7 +722,6 @@ Future<(Uri? nativeAssetsYaml, List<Uri> 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<AssetImpl, KernelAsset> assetTargetLocations =
|
||||
|
@ -22,8 +22,8 @@ const Map<String, String> kManuallyPinnedDependencies = <String, String>{
|
||||
// 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
|
||||
|
@ -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
|
||||
|
@ -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<String> args) async {
|
||||
await build(args, (config, output) async {
|
||||
final packageName = config.packageName;
|
||||
@ -13,7 +11,6 @@ void main(List<String> args) async {
|
||||
sources: [
|
||||
'src/$packageName.c',
|
||||
],
|
||||
dartBuildFiles: ['hook/build.dart'],
|
||||
);
|
||||
await cbuilder.run(
|
||||
config: config,
|
||||
|
@ -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
|
||||
|
@ -340,49 +340,6 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
testUsingContext('static libs not supported', overrides: <Type, Generator>{
|
||||
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>[
|
||||
Package('bar', projectUri),
|
||||
],
|
||||
buildDryRunResult: FakeNativeAssetsBuilderResult(
|
||||
assets: <AssetImpl>[
|
||||
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: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true),
|
||||
ProcessManager: () => FakeProcessManager.empty(),
|
||||
|
@ -541,51 +541,6 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
testUsingContext('static libs not supported', overrides: <Type, Generator>{
|
||||
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>[
|
||||
Package('bar', projectUri),
|
||||
],
|
||||
buildDryRunResult: FakeNativeAssetsBuilderResult(
|
||||
assets: <AssetImpl>[
|
||||
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: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true),
|
||||
ProcessManager: () => FakeProcessManager.empty(),
|
||||
|
@ -306,44 +306,6 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
testUsingContext('static libs not supported', overrides: <Type, Generator>{
|
||||
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>[
|
||||
Package('bar', projectUri),
|
||||
],
|
||||
buildDryRunResult: FakeNativeAssetsBuilderResult(
|
||||
assets: <AssetImpl>[
|
||||
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: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(isNativeAssetsEnabled: true),
|
||||
ProcessManager: () => FakeProcessManager.empty(),
|
||||
|
@ -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));
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user