Unverified Commit df2b3604 authored by Matej Knopp's avatar Matej Knopp Committed by GitHub

Do not shorten native assets framework names (#144568)

Previously the name was shortened to 15 characters, which doesn't seem
to be necessary.
[CFBundleName](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundlename)
documentation mentions 15 character length, but that does not seem to be
relevant to framework bundles.

Flutter plugins already have framework bundles with names longer than 15
characters and it is not causing any issues.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
parent 67e6cad0
......@@ -165,9 +165,6 @@ Future<CCompilerConfig> cCompilerConfigMacOS() async {
/// (A–Z, a–z, and 0–9), hyphens (-), and periods (.).
/// https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleidentifier
///
/// This name can contain up to 15 characters.
/// https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundlename
///
/// The [alreadyTakenNames] are used to ensure that the framework name does not
/// conflict with previously chosen names.
Uri frameworkUri(String fileName, Set<String> alreadyTakenNames) {
......@@ -185,13 +182,7 @@ Uri frameworkUri(String fileName, Set<String> alreadyTakenNames) {
fileName = fileName.replaceFirst('lib', '');
}
fileName = fileName.replaceAll(RegExp(r'[^A-Za-z0-9_-]'), '');
if (fileName.length > 15) {
fileName = fileName.substring(0, 15);
}
if (alreadyTakenNames.contains(fileName)) {
if (fileName.length > 12) {
fileName = fileName.substring(0, 12);
}
final String prefixName = fileName;
for (int i = 1; i < 1000; i++) {
fileName = '$prefixName$i';
......
......@@ -34,7 +34,7 @@ void main() {
);
expect(
frameworkUri('libatoolongfilenameforaframework.dylib', <String>{}),
equals(Uri.file('atoolongfilenam.framework/atoolongfilenam')),
equals(Uri.file('atoolongfilenameforaframework.framework/atoolongfilenameforaframework')),
);
});
......@@ -54,15 +54,15 @@ void main() {
);
expect(
frameworkUri('libatoolongfilenameforaframework.dylib', alreadyTakenNames),
equals(Uri.file('atoolongfilenam.framework/atoolongfilenam')),
equals(Uri.file('atoolongfilenameforaframework.framework/atoolongfilenameforaframework')),
);
expect(
frameworkUri('libatoolongfilenameforaframework.dylib', alreadyTakenNames),
equals(Uri.file('atoolongfile1.framework/atoolongfile1')),
equals(Uri.file('atoolongfilenameforaframework1.framework/atoolongfilenameforaframework1')),
);
expect(
frameworkUri('libatoolongfilenameforaframework.dylib', alreadyTakenNames),
equals(Uri.file('atoolongfile2.framework/atoolongfile2')),
equals(Uri.file('atoolongfilenameforaframework2.framework/atoolongfilenameforaframework2')),
);
});
}
......@@ -305,7 +305,7 @@ void expectDylibIsBundledMacOS(Directory appDirectory, String buildMode) {
// Resources/
// Info.plist
// Current -> A
final String frameworkName = packageName.substring(0, 15);
const String frameworkName = packageName;
final Directory frameworkDir =
frameworksFolder.childDirectory('$frameworkName.framework');
final Directory versionsDir = frameworkDir.childDirectory('Versions');
......@@ -330,7 +330,7 @@ void expectDylibIsBundledIos(Directory appDirectory, String buildMode) {
expect(appBundle, exists);
final Directory frameworksFolder = appBundle.childDirectory('Frameworks');
expect(frameworksFolder, exists);
final String frameworkName = packageName.substring(0, 15);
const String frameworkName = packageName;
final File dylib = frameworksFolder
.childDirectory('$frameworkName.framework')
.childFile(frameworkName);
......@@ -409,7 +409,7 @@ void expectDylibIsBundledAndroid(Directory appDirectory, String buildMode) {
void expectDylibIsBundledWithFrameworks(Directory appDirectory, String buildMode, String os) {
final Directory frameworksFolder = appDirectory.childDirectory('build/$os/framework/${buildMode.upperCaseFirst()}');
expect(frameworksFolder, exists);
final String frameworkName = packageName.substring(0, 15);
const String frameworkName = packageName;
final File dylib = frameworksFolder
.childDirectory('$frameworkName.framework')
.childFile(frameworkName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment