mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[native_assets] Fix framework name deduplication (#149761)
Applies 02d5286e02
to MacOS.
I'm hoping this will fix:
* https://github.com/flutter/flutter/issues/148955
This commit is contained in:
parent
ae47edab7a
commit
2a543aa43b
@ -214,10 +214,19 @@ Map<AssetImpl, KernelAsset> _assetTargetLocations(
|
|||||||
Uri? absolutePath,
|
Uri? absolutePath,
|
||||||
) {
|
) {
|
||||||
final Set<String> alreadyTakenNames = <String>{};
|
final Set<String> alreadyTakenNames = <String>{};
|
||||||
return <AssetImpl, KernelAsset>{
|
final Map<String, KernelAssetPath> idToPath = <String, KernelAssetPath>{};
|
||||||
for (final AssetImpl asset in nativeAssets)
|
final Map<AssetImpl, KernelAsset> result = <AssetImpl, KernelAsset>{};
|
||||||
asset: _targetLocationMacOS(asset, absolutePath, alreadyTakenNames),
|
for (final AssetImpl asset in nativeAssets) {
|
||||||
};
|
final KernelAssetPath path = idToPath[asset.id] ??
|
||||||
|
_targetLocationMacOS(asset, absolutePath, alreadyTakenNames).path;
|
||||||
|
idToPath[asset.id] = path;
|
||||||
|
result[asset] = KernelAsset(
|
||||||
|
id: (asset as NativeCodeAssetImpl).id,
|
||||||
|
target: Target.fromArchitectureAndOS(asset.architecture!, asset.os),
|
||||||
|
path: path,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
KernelAsset _targetLocationMacOS(
|
KernelAsset _targetLocationMacOS(
|
||||||
|
@ -177,12 +177,25 @@ void main() {
|
|||||||
nativeAssetsYaml,
|
nativeAssetsYaml,
|
||||||
projectUri.resolve('build/native_assets/macos/native_assets.yaml'),
|
projectUri.resolve('build/native_assets/macos/native_assets.yaml'),
|
||||||
);
|
);
|
||||||
|
final String nativeAssetsYamlContents =
|
||||||
|
await fileSystem.file(nativeAssetsYaml).readAsString();
|
||||||
expect(
|
expect(
|
||||||
await fileSystem.file(nativeAssetsYaml).readAsString(),
|
nativeAssetsYamlContents,
|
||||||
contains('package:bar/bar.dart'),
|
contains('package:bar/bar.dart'),
|
||||||
);
|
);
|
||||||
expect(buildRunner.buildDryRunInvocations, 1);
|
expect(buildRunner.buildDryRunInvocations, 1);
|
||||||
expect(buildRunner.linkDryRunInvocations, 1);
|
expect(buildRunner.linkDryRunInvocations, 1);
|
||||||
|
// Check that the framework uri is identical for both archs.
|
||||||
|
final String pathSeparator = const LocalPlatform().pathSeparator;
|
||||||
|
expect(
|
||||||
|
nativeAssetsYamlContents,
|
||||||
|
stringContainsInOrder(
|
||||||
|
<String>[
|
||||||
|
'bar.framework${pathSeparator}bar',
|
||||||
|
'bar.framework${pathSeparator}bar',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('build with assets but not enabled', overrides: <Type, Generator>{
|
testUsingContext('build with assets but not enabled', overrides: <Type, Generator>{
|
||||||
|
Loading…
Reference in New Issue
Block a user