Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
8c0aa6c6
Unverified
Commit
8c0aa6c6
authored
Oct 04, 2022
by
Jenn Magder
Committed by
GitHub
Oct 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turn off bitcode in existing iOS Xcode projects (#112828)
parent
c77e4cdd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
0 deletions
+114
-0
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+2
-0
remove_bitcode_migration.dart
...ools/lib/src/ios/migrations/remove_bitcode_migration.dart
+41
-0
ios_project_migration_test.dart
...ls/test/general.shard/ios/ios_project_migration_test.dart
+71
-0
No files found.
packages/flutter_tools/lib/src/ios/mac.dart
View file @
8c0aa6c6
...
@@ -31,6 +31,7 @@ import 'migrations/host_app_info_plist_migration.dart';
...
@@ -31,6 +31,7 @@ import 'migrations/host_app_info_plist_migration.dart';
import
'migrations/ios_deployment_target_migration.dart'
;
import
'migrations/ios_deployment_target_migration.dart'
;
import
'migrations/project_base_configuration_migration.dart'
;
import
'migrations/project_base_configuration_migration.dart'
;
import
'migrations/project_build_location_migration.dart'
;
import
'migrations/project_build_location_migration.dart'
;
import
'migrations/remove_bitcode_migration.dart'
;
import
'migrations/remove_framework_link_and_embedding_migration.dart'
;
import
'migrations/remove_framework_link_and_embedding_migration.dart'
;
import
'migrations/xcode_build_system_migration.dart'
;
import
'migrations/xcode_build_system_migration.dart'
;
import
'xcode_build_settings.dart'
;
import
'xcode_build_settings.dart'
;
...
@@ -128,6 +129,7 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -128,6 +129,7 @@ Future<XcodeBuildResult> buildXcodeProject({
XcodeProjectObjectVersionMigration
(
app
.
project
,
globals
.
logger
),
XcodeProjectObjectVersionMigration
(
app
.
project
,
globals
.
logger
),
HostAppInfoPlistMigration
(
app
.
project
,
globals
.
logger
),
HostAppInfoPlistMigration
(
app
.
project
,
globals
.
logger
),
XcodeScriptBuildPhaseMigration
(
app
.
project
,
globals
.
logger
),
XcodeScriptBuildPhaseMigration
(
app
.
project
,
globals
.
logger
),
RemoveBitcodeMigration
(
app
.
project
,
globals
.
logger
),
];
];
final
ProjectMigration
migration
=
ProjectMigration
(
migrators
);
final
ProjectMigration
migration
=
ProjectMigration
(
migrators
);
...
...
packages/flutter_tools/lib/src/ios/migrations/remove_bitcode_migration.dart
0 → 100644
View file @
8c0aa6c6
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'../../base/file_system.dart'
;
import
'../../base/project_migrator.dart'
;
import
'../../xcode_project.dart'
;
/// Remove deprecated bitcode build setting.
class
RemoveBitcodeMigration
extends
ProjectMigrator
{
RemoveBitcodeMigration
(
IosProject
project
,
super
.
logger
,
)
:
_xcodeProjectInfoFile
=
project
.
xcodeProjectInfoFile
;
final
File
_xcodeProjectInfoFile
;
@override
bool
migrate
()
{
if
(
_xcodeProjectInfoFile
.
existsSync
())
{
processFileLines
(
_xcodeProjectInfoFile
);
}
else
{
logger
.
printTrace
(
'Xcode project not found, skipping removing bitcode migration.'
);
}
return
true
;
}
@override
String
?
migrateLine
(
String
line
)
{
if
(
line
.
contains
(
'ENABLE_BITCODE = YES;'
))
{
if
(!
migrationRequired
)
{
// Only print for the first discovered change found.
logger
.
printWarning
(
'Disabling deprecated bitcode Xcode build setting. See https://github.com/flutter/flutter/issues/107887 for additional details.'
);
}
return
line
.
replaceAll
(
'ENABLE_BITCODE = YES'
,
'ENABLE_BITCODE = NO'
);
}
return
line
;
}
}
packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart
View file @
8c0aa6c6
...
@@ -10,6 +10,7 @@ import 'package:flutter_tools/src/ios/migrations/host_app_info_plist_migration.d
...
@@ -10,6 +10,7 @@ import 'package:flutter_tools/src/ios/migrations/host_app_info_plist_migration.d
import
'package:flutter_tools/src/ios/migrations/ios_deployment_target_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/ios_deployment_target_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/project_base_configuration_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/project_base_configuration_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/project_build_location_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/project_build_location_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/remove_bitcode_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/remove_framework_link_and_embedding_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/remove_framework_link_and_embedding_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/xcode_build_system_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/xcode_build_system_migration.dart'
;
import
'package:flutter_tools/src/migrations/xcode_project_object_version_migration.dart'
;
import
'package:flutter_tools/src/migrations/xcode_project_object_version_migration.dart'
;
...
@@ -821,6 +822,76 @@ platform :ios, '11.0'
...
@@ -821,6 +822,76 @@ platform :ios, '11.0'
'''
));
'''
));
});
});
});
});
group
(
'remove bitcode build setting'
,
()
{
late
MemoryFileSystem
memoryFileSystem
;
late
BufferLogger
testLogger
;
late
FakeIosProject
project
;
late
File
xcodeProjectInfoFile
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
testLogger
=
BufferLogger
.
test
();
project
=
FakeIosProject
();
xcodeProjectInfoFile
=
memoryFileSystem
.
file
(
'project.pbxproj'
);
project
.
xcodeProjectInfoFile
=
xcodeProjectInfoFile
;
});
testWithoutContext
(
'skipped if files are missing'
,
()
{
final
RemoveBitcodeMigration
migration
=
RemoveBitcodeMigration
(
project
,
testLogger
,
);
expect
(
migration
.
migrate
(),
isTrue
);
expect
(
xcodeProjectInfoFile
.
existsSync
(),
isFalse
);
expect
(
testLogger
.
traceText
,
contains
(
'Xcode project not found, skipping removing bitcode migration'
));
expect
(
testLogger
.
statusText
,
isEmpty
);
});
testWithoutContext
(
'skipped if nothing to upgrade'
,
()
{
const
String
xcodeProjectInfoFileContents
=
'IPHONEOS_DEPLOYMENT_TARGET = 11.0;'
;
xcodeProjectInfoFile
.
writeAsStringSync
(
xcodeProjectInfoFileContents
);
final
DateTime
projectLastModified
=
xcodeProjectInfoFile
.
lastModifiedSync
();
final
RemoveBitcodeMigration
migration
=
RemoveBitcodeMigration
(
project
,
testLogger
,
);
expect
(
migration
.
migrate
(),
isTrue
);
expect
(
xcodeProjectInfoFile
.
lastModifiedSync
(),
projectLastModified
);
expect
(
xcodeProjectInfoFile
.
readAsStringSync
(),
xcodeProjectInfoFileContents
);
expect
(
testLogger
.
statusText
,
isEmpty
);
});
testWithoutContext
(
'bitcode build setting is removed'
,
()
{
xcodeProjectInfoFile
.
writeAsStringSync
(
'''
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = Runner/Info.plist;
ENABLE_BITCODE = YES;
'''
);
final
RemoveBitcodeMigration
migration
=
RemoveBitcodeMigration
(
project
,
testLogger
,
);
expect
(
migration
.
migrate
(),
isTrue
);
expect
(
xcodeProjectInfoFile
.
readAsStringSync
(),
'''
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
ENABLE_BITCODE = NO;
'''
);
// Only print once even though 2 lines were changed.
expect
(
'Disabling deprecated bitcode Xcode build setting'
.
allMatches
(
testLogger
.
warningText
).
length
,
1
);
});
});
});
});
group
(
'update Xcode script build phase'
,
()
{
group
(
'update Xcode script build phase'
,
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment