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
53f5b902
Unverified
Commit
53f5b902
authored
Jun 16, 2021
by
Jenn Magder
Committed by
GitHub
Jun 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use -miphonesimulator-version-min when building App.framework for simulator (#84729)
parent
75e9318d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
49 deletions
+105
-49
build.dart
packages/flutter_tools/lib/src/base/build.dart
+7
-8
ios.dart
packages/flutter_tools/lib/src/build_system/targets/ios.dart
+15
-6
xcode.dart
packages/flutter_tools/lib/src/macos/xcode.dart
+2
-2
build_test.dart
...ges/flutter_tools/test/general.shard/base/build_test.dart
+23
-23
common_test.dart
.../test/general.shard/build_system/targets/common_test.dart
+12
-8
ios_test.dart
...ols/test/general.shard/build_system/targets/ios_test.dart
+46
-2
No files found.
packages/flutter_tools/lib/src/base/build.dart
View file @
53f5b902
...
...
@@ -250,24 +250,24 @@ class AOTSnapshotter {
}
final
List
<
String
>
commonBuildOptions
=
<
String
>[
'-arch'
,
targetArch
,
'-arch'
,
targetArch
,
if
(
isIOS
)
// When the minimum version is updated, remember to update
// template MinimumOSVersion.
// https://github.com/flutter/flutter/pull/62902
'-miphoneos-version-min=8.0'
,
if
(
sdkRoot
!=
null
)
...<
String
>[
'-isysroot'
,
sdkRoot
,
],
];
const
String
embedBitcodeArg
=
'-fembed-bitcode'
;
final
String
assemblyO
=
_fileSystem
.
path
.
join
(
outputPath
,
'snapshot_assembly.o'
);
List
<
String
>?
isysrootArgs
;
if
(
sdkRoot
!=
null
)
{
isysrootArgs
=
<
String
>[
'-isysroot'
,
sdkRoot
];
}
final
RunResult
compileResult
=
await
_xcode
.
cc
(<
String
>[
'-arch'
,
targetArch
,
if
(
isysrootArgs
!=
null
)
...
isysrootArgs
,
...
commonBuildOptions
,
if
(
bitcode
)
embedBitcodeArg
,
'-c'
,
assemblyPath
,
...
...
@@ -289,7 +289,6 @@ class AOTSnapshotter {
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
if
(
bitcode
)
embedBitcodeArg
,
if
(
isysrootArgs
!=
null
)
...
isysrootArgs
,
'-o'
,
appLib
,
assemblyO
,
];
...
...
packages/flutter_tools/lib/src/build_system/targets/ios.dart
View file @
53f5b902
...
...
@@ -69,8 +69,7 @@ abstract class AotAssemblyBase extends Target {
}
final
String
sdkRoot
=
environment
.
defines
[
kSdkRoot
];
final
EnvironmentType
environmentType
=
environmentTypeFromSdkroot
(
environment
.
fileSystem
.
directory
(
sdkRoot
));
final
EnvironmentType
environmentType
=
environmentTypeFromSdkroot
(
sdkRoot
,
environment
.
fileSystem
);
if
(
environmentType
==
EnvironmentType
.
simulator
)
{
throw
Exception
(
'release/profile builds are only supported for physical devices. '
...
...
@@ -222,6 +221,10 @@ class DebugUniversalFramework extends Target {
@override
Future
<
void
>
build
(
Environment
environment
)
async
{
if
(
environment
.
defines
[
kSdkRoot
]
==
null
)
{
throw
MissingDefineException
(
kSdkRoot
,
name
);
}
// Generate a trivial App.framework.
final
Set
<
String
>
iosArchNames
=
environment
.
defines
[
kIosArchs
]
?.
split
(
' '
)
...
...
@@ -292,8 +295,8 @@ abstract class UnpackIOS extends Target {
}
void
_copyFramework
(
Environment
environment
)
{
final
Directory
sdkRoot
=
environment
.
fileSystem
.
directory
(
environment
.
defines
[
kSdkRoot
])
;
final
EnvironmentType
environmentType
=
environmentTypeFromSdkroot
(
sdkRoot
);
final
String
sdkRoot
=
environment
.
defines
[
kSdkRoot
]
;
final
EnvironmentType
environmentType
=
environmentTypeFromSdkroot
(
sdkRoot
,
environment
.
fileSystem
);
final
String
basePath
=
environment
.
artifacts
.
getArtifactPath
(
Artifact
.
flutterFramework
,
platform:
TargetPlatform
.
ios
,
...
...
@@ -584,7 +587,8 @@ Future<void> _createStubAppFramework(File outputFile, Environment environment,
throwToolExit
(
'Failed to create App.framework stub at
${outputFile.path}
:
$e
'
);
}
final
Directory
tempDir
=
outputFile
.
fileSystem
.
systemTempDirectory
final
FileSystem
fileSystem
=
environment
.
fileSystem
;
final
Directory
tempDir
=
fileSystem
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_stub_source.'
);
try
{
final
File
stubSource
=
tempDir
.
childFile
(
'debug_app.cc'
)
...
...
@@ -593,6 +597,8 @@ Future<void> _createStubAppFramework(File outputFile, Environment environment,
'''
);
final
String
sdkRoot
=
environment
.
defines
[
kSdkRoot
];
final
EnvironmentType
environmentType
=
environmentTypeFromSdkroot
(
sdkRoot
,
fileSystem
);
await
globals
.
xcode
.
clang
(<
String
>[
'-x'
,
'c'
,
...
...
@@ -601,7 +607,10 @@ Future<void> _createStubAppFramework(File outputFile, Environment environment,
'-dynamiclib'
,
'-fembed-bitcode-marker'
,
// Keep version in sync with AOTSnapshotter flag
'-miphoneos-version-min=8.0'
,
if
(
environmentType
==
EnvironmentType
.
physical
)
'-miphoneos-version-min=8.0'
else
'-miphonesimulator-version-min=8.0'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@executable_path/Frameworks'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
...
...
packages/flutter_tools/lib/src/macos/xcode.dart
View file @
53f5b902
...
...
@@ -198,10 +198,10 @@ class Xcode {
}
}
EnvironmentType
?
environmentTypeFromSdkroot
(
Directory
sdkroot
)
{
EnvironmentType
?
environmentTypeFromSdkroot
(
String
sdkroot
,
FileSystem
fileSystem
)
{
assert
(
sdkroot
!=
null
);
// iPhoneSimulator.sdk or iPhoneOS.sdk
final
String
sdkName
=
sdkroot
.
basename
.
toLowerCase
();
final
String
sdkName
=
fileSystem
.
path
.
basename
(
sdkroot
)
.
toLowerCase
();
if
(
sdkName
.
contains
(
'iphone'
))
{
return
sdkName
.
contains
(
'simulator'
)
?
EnvironmentType
.
simulator
:
EnvironmentType
.
physical
;
}
...
...
packages/flutter_tools/test/general.shard/base/build_test.dart
View file @
53f5b902
...
...
@@ -29,26 +29,8 @@ const FakeCommand kARMCheckCommand = FakeCommand(
const
List
<
String
>
kDefaultClang
=
<
String
>[
'-miphoneos-version-min=8.0'
,
'-dynamiclib'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@executable_path/Frameworks'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
'-isysroot'
,
'path/to/sdk'
,
'-o'
,
'build/foo/App.framework/App'
,
'build/foo/snapshot_assembly.o'
,
];
const
List
<
String
>
kBitcodeClang
=
<
String
>[
'-miphoneos-version-min=8.0'
,
'-dynamiclib'
,
'-Xlinker'
,
'-rpath'
,
...
...
@@ -60,9 +42,6 @@ const List<String> kBitcodeClang = <String>[
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
'-fembed-bitcode'
,
'-isysroot'
,
'path/to/sdk'
,
'-o'
,
'build/foo/App.framework/App'
,
'build/foo/snapshot_assembly.o'
,
...
...
@@ -266,6 +245,7 @@ void main() {
'cc'
,
'-arch'
,
'armv7'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/sdk'
,
'-fembed-bitcode'
,
...
...
@@ -279,7 +259,24 @@ void main() {
'clang'
,
'-arch'
,
'armv7'
,
...
kBitcodeClang
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/sdk'
,
'-dynamiclib'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@executable_path/Frameworks'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
'-fembed-bitcode'
,
'-o'
,
'build/foo/App.framework/App'
,
'build/foo/snapshot_assembly.o'
,
]),
]);
...
...
@@ -328,6 +325,7 @@ void main() {
'cc'
,
'-arch'
,
'armv7'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/sdk'
,
'-c'
,
...
...
@@ -387,6 +385,7 @@ void main() {
'cc'
,
'-arch'
,
'armv7'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/sdk'
,
'-c'
,
...
...
@@ -419,7 +418,6 @@ void main() {
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testWithoutContext
(
'builds iOS armv7 snapshot'
,
()
async
{
final
String
outputPath
=
fileSystem
.
path
.
join
(
'build'
,
'foo'
);
final
String
genSnapshotPath
=
artifacts
.
getArtifactPath
(
...
...
@@ -445,6 +443,7 @@ void main() {
'cc'
,
'-arch'
,
'armv7'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/sdk'
,
'-c'
,
...
...
@@ -500,6 +499,7 @@ void main() {
'cc'
,
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/sdk'
,
'-c'
,
...
...
packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
View file @
53f5b902
...
...
@@ -475,6 +475,7 @@ void main() {
'cc'
,
'-arch'
,
'armv7'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-c'
,
...
...
@@ -487,6 +488,7 @@ void main() {
'cc'
,
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-c'
,
...
...
@@ -500,6 +502,8 @@ void main() {
'-arch'
,
'armv7'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-dynamiclib'
,
'-Xlinker'
,
'-rpath'
,
...
...
@@ -511,8 +515,6 @@ void main() {
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-o'
,
'
$build
/armv7/App.framework/App'
,
'
$build
/armv7/snapshot_assembly.o'
,
...
...
@@ -523,6 +525,8 @@ void main() {
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-dynamiclib'
,
'-Xlinker'
,
'-rpath'
,
...
...
@@ -534,8 +538,6 @@ void main() {
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-o'
,
'
$build
/arm64/App.framework/App'
,
'
$build
/arm64/snapshot_assembly.o'
,
...
...
@@ -581,6 +583,7 @@ void main() {
'cc'
,
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
// Contains bitcode flag.
...
...
@@ -596,6 +599,8 @@ void main() {
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-dynamiclib'
,
'-Xlinker'
,
'-rpath'
,
...
...
@@ -609,8 +614,6 @@ void main() {
'@rpath/App.framework/App'
,
// Contains bitcode flag.
'-fembed-bitcode'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-o'
,
'
$build
/arm64/App.framework/App'
,
'
$build
/arm64/snapshot_assembly.o'
,
...
...
@@ -656,6 +659,7 @@ void main() {
'cc'
,
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
// Contains bitcode flag.
...
...
@@ -671,6 +675,8 @@ void main() {
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-dynamiclib'
,
'-Xlinker'
,
'-rpath'
,
...
...
@@ -684,8 +690,6 @@ void main() {
'@rpath/App.framework/App'
,
// Contains bitcode flag.
'-fembed-bitcode'
,
'-isysroot'
,
'path/to/iPhoneOS.sdk'
,
'-o'
,
'
$build
/arm64/App.framework/App'
,
'
$build
/arm64/snapshot_assembly.o'
,
...
...
packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
View file @
53f5b902
...
...
@@ -35,7 +35,7 @@ const List<String> _kSharedConfig = <String>[
'-install_name'
,
'@rpath/App.framework/App'
,
'-isysroot'
,
'path/to/sdk'
,
'path/to/
iPhoneOS.
sdk'
,
];
void
main
(
)
{
...
...
@@ -69,9 +69,53 @@ void main() {
expect
(
const
AotAssemblyProfile
().
analyticsName
,
'ios_aot'
);
});
testUsingContext
(
'DebugUniveralFramework creates simulator binary'
,
()
async
{
environment
.
defines
[
kIosArchs
]
=
'x86_64'
;
environment
.
defines
[
kSdkRoot
]
=
'path/to/iPhoneSimulator.sdk'
;
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'xcrun'
,
'clang'
,
'-x'
,
'c'
,
'-arch'
,
'x86_64'
,
fileSystem
.
path
.
absolute
(
fileSystem
.
path
.
join
(
'.tmp_rand0'
,
'flutter_tools_stub_source.rand0'
,
'debug_app.cc'
)),
'-dynamiclib'
,
'-fembed-bitcode-marker'
,
'-miphonesimulator-version-min=8.0'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@executable_path/Frameworks'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
'-isysroot'
,
'path/to/iPhoneSimulator.sdk'
,
'-o'
,
environment
.
buildDir
.
childDirectory
(
'App.framework'
)
.
childFile
(
'App'
)
.
path
,
]),
);
await
const
DebugUniversalFramework
().
build
(
environment
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
Platform:
()
=>
macPlatform
,
});
testUsingContext
(
'DebugUniveralFramework creates expected binary with arm64 only arch'
,
()
async
{
environment
.
defines
[
kIosArchs
]
=
'arm64'
;
environment
.
defines
[
kSdkRoot
]
=
'path/to/sdk'
;
environment
.
defines
[
kSdkRoot
]
=
'path/to/
iPhoneOS.
sdk'
;
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
'xcrun'
,
...
...
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