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
1df165ea
Unverified
Commit
1df165ea
authored
Aug 16, 2019
by
Jonah Williams
Committed by
GitHub
Aug 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename iOS arch for macOS release mode (macOS release mode 2 of 3) (#38645)
parent
9823b3db
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
54 deletions
+62
-54
build.dart
packages/flutter_tools/lib/src/base/build.dart
+20
-15
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+13
-10
ios.dart
packages/flutter_tools/lib/src/build_system/targets/ios.dart
+8
-8
build_aot.dart
packages/flutter_tools/lib/src/commands/build_aot.dart
+10
-10
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+1
-1
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+2
-2
build_test.dart
...ges/flutter_tools/test/general.shard/base/build_test.dart
+6
-6
dart_test.dart
...ls/test/general.shard/build_system/targets/dart_test.dart
+2
-2
No files found.
packages/flutter_tools/lib/src/base/build.dart
View file @
1df165ea
...
...
@@ -46,7 +46,7 @@ class GenSnapshot {
Future
<
int
>
run
({
@required
SnapshotType
snapshotType
,
IOSArch
ios
Arch
,
DarwinArch
darwin
Arch
,
Iterable
<
String
>
additionalArgs
=
const
<
String
>[],
})
{
final
List
<
String
>
args
=
<
String
>[
...
...
@@ -59,7 +59,7 @@ class GenSnapshot {
// iOS has a separate gen_snapshot for armv7 and arm64 in the same,
// directory. So we need to select the right one.
if
(
snapshotType
.
platform
==
TargetPlatform
.
ios
)
{
snapshotterPath
+=
'_'
+
getNameFor
IOSArch
(
ios
Arch
);
snapshotterPath
+=
'_'
+
getNameFor
DarwinArch
(
darwin
Arch
);
}
StringConverter
outputFilter
;
...
...
@@ -89,7 +89,7 @@ class AOTSnapshotter {
@required
String
mainPath
,
@required
String
packagesPath
,
@required
String
outputPath
,
IOSArch
ios
Arch
,
DarwinArch
darwin
Arch
,
List
<
String
>
extraGenSnapshotOptions
=
const
<
String
>[],
@required
bool
bitcode
,
})
async
{
...
...
@@ -103,7 +103,7 @@ class AOTSnapshotter {
return
1
;
}
// TODO(cbracken): replace IOSArch with TargetPlatform.ios_{armv7,arm64}.
assert
(
platform
!=
TargetPlatform
.
ios
||
ios
Arch
!=
null
);
assert
(
platform
!=
TargetPlatform
.
ios
||
darwin
Arch
!=
null
);
final
PackageMap
packageMap
=
PackageMap
(
packagesPath
);
final
String
packageMapError
=
packageMap
.
checkValid
();
...
...
@@ -130,7 +130,7 @@ class AOTSnapshotter {
}
final
String
assembly
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.S'
);
if
(
platform
==
TargetPlatform
.
ios
)
{
if
(
platform
==
TargetPlatform
.
ios
||
platform
==
TargetPlatform
.
darwin_x64
)
{
// Assembly AOT snapshot.
outputPaths
.
add
(
assembly
);
genSnapshotArgs
.
add
(
'--snapshot_kind=app-aot-assembly'
);
...
...
@@ -143,7 +143,7 @@ class AOTSnapshotter {
genSnapshotArgs
.
add
(
'--strip'
);
}
if
(
platform
==
TargetPlatform
.
android_arm
||
iosArch
==
IOS
Arch
.
armv7
)
{
if
(
platform
==
TargetPlatform
.
android_arm
||
darwinArch
==
Darwin
Arch
.
armv7
)
{
// Use softfp for Android armv7 devices.
// This is the default for armv7 iOS builds, but harmless to set.
// TODO(cbracken): eliminate this when we fix https://github.com/flutter/flutter/issues/17489
...
...
@@ -168,7 +168,7 @@ class AOTSnapshotter {
()
=>
genSnapshot
.
run
(
snapshotType:
snapshotType
,
additionalArgs:
genSnapshotArgs
,
iosArch:
ios
Arch
,
darwinArch:
darwin
Arch
,
));
if
(
genSnapshotExitCode
!=
0
)
{
printError
(
'Dart snapshot generator failed with exit code
$genSnapshotExitCode
'
);
...
...
@@ -197,9 +197,9 @@ class AOTSnapshotter {
// On iOS, we use Xcode to compile the snapshot into a dynamic library that the
// end-developer can link into their app.
if
(
platform
==
TargetPlatform
.
ios
)
{
final
RunResult
result
=
await
_build
Ios
Framework
(
iosArch:
ios
Arch
,
if
(
platform
==
TargetPlatform
.
ios
||
platform
==
TargetPlatform
.
darwin_x64
)
{
final
RunResult
result
=
await
_buildFramework
(
appleArch:
darwin
Arch
,
assemblyPath:
bitcode
?
'
$assembly
.bitcode'
:
assembly
,
outputPath:
outputDir
.
path
,
bitcode:
bitcode
,
...
...
@@ -210,17 +210,21 @@ class AOTSnapshotter {
return
0
;
}
/// Builds an iOS framework at [outputPath]/App.framework from the assembly
/// Builds an iOS
or macOS
framework at [outputPath]/App.framework from the assembly
/// source at [assemblyPath].
Future
<
RunResult
>
_build
Ios
Framework
({
@required
IOSArch
ios
Arch
,
Future
<
RunResult
>
_buildFramework
({
@required
DarwinArch
apple
Arch
,
@required
String
assemblyPath
,
@required
String
outputPath
,
@required
bool
bitcode
,
})
async
{
final
String
targetArch
=
iosArch
==
IOSArch
.
armv7
?
'armv7'
:
'arm64'
;
final
String
targetArch
=
getNameForDarwinArch
(
appleArch
)
;
printStatus
(
'Building App.framework for
$targetArch
...'
);
final
List
<
String
>
commonBuildOptions
=
<
String
>[
'-arch'
,
targetArch
,
'-miphoneos-version-min=8.0'
];
final
List
<
String
>
commonBuildOptions
=
<
String
>[
'-arch'
,
targetArch
,
if
(
appleArch
==
DarwinArch
.
arm64
||
appleArch
==
DarwinArch
.
armv7
)
'-miphoneos-version-min=8.0'
,
];
final
String
assemblyO
=
fs
.
path
.
join
(
outputPath
,
'snapshot_assembly.o'
);
final
RunResult
compileResult
=
await
xcode
.
cc
(<
String
>[
...
...
@@ -322,6 +326,7 @@ class AOTSnapshotter {
TargetPlatform
.
android_arm
,
TargetPlatform
.
android_arm64
,
TargetPlatform
.
ios
,
TargetPlatform
.
darwin_x64
,
].
contains
(
platform
);
}
...
...
packages/flutter_tools/lib/src/build_info.dart
View file @
1df165ea
...
...
@@ -265,12 +265,13 @@ enum TargetPlatform {
web_javascript
,
}
/// iOS target device architecture.
/// iOS
and macOS
target device architecture.
//
// TODO(cbracken): split TargetPlatform.ios into ios_armv7, ios_arm64.
enum
IOS
Arch
{
enum
Darwin
Arch
{
armv7
,
arm64
,
x86_64
,
}
enum
AndroidArch
{
...
...
@@ -281,27 +282,29 @@ enum AndroidArch {
}
/// The default set of iOS device architectures to build for.
const
List
<
IOSArch
>
defaultIOSArchs
=
<
IOS
Arch
>[
IOS
Arch
.
arm64
,
const
List
<
DarwinArch
>
defaultIOSArchs
=
<
Darwin
Arch
>[
Darwin
Arch
.
arm64
,
];
String
getNameFor
IOSArch
(
IOS
Arch
arch
)
{
String
getNameFor
DarwinArch
(
Darwin
Arch
arch
)
{
switch
(
arch
)
{
case
IOS
Arch
.
armv7
:
case
Darwin
Arch
.
armv7
:
return
'armv7'
;
case
IOS
Arch
.
arm64
:
case
Darwin
Arch
.
arm64
:
return
'arm64'
;
case
DarwinArch
.
x86_64
:
return
'x86_64'
;
}
assert
(
false
);
return
null
;
}
IOS
Arch
getIOSArchForName
(
String
arch
)
{
Darwin
Arch
getIOSArchForName
(
String
arch
)
{
switch
(
arch
)
{
case
'armv7'
:
return
IOS
Arch
.
armv7
;
return
Darwin
Arch
.
armv7
;
case
'arm64'
:
return
IOS
Arch
.
arm64
;
return
Darwin
Arch
.
arm64
;
}
assert
(
false
);
return
null
;
...
...
packages/flutter_tools/lib/src/build_system/targets/ios.dart
View file @
1df165ea
...
...
@@ -32,8 +32,8 @@ abstract class AotAssemblyBase extends Target {
final
bool
bitcode
=
environment
.
defines
[
kBitcodeFlag
]
==
'true'
;
final
BuildMode
buildMode
=
getBuildModeForName
(
environment
.
defines
[
kBuildMode
]);
final
TargetPlatform
targetPlatform
=
getTargetPlatformForName
(
environment
.
defines
[
kTargetPlatform
]);
final
List
<
IOS
Arch
>
iosArchs
=
environment
.
defines
[
kIosArchs
]?.
split
(
','
)?.
map
(
getIOSArchForName
)?.
toList
()
??
<
IOSArch
>[
IOS
Arch
.
arm64
];
final
List
<
Darwin
Arch
>
iosArchs
=
environment
.
defines
[
kIosArchs
]?.
split
(
','
)?.
map
(
getIOSArchForName
)?.
toList
()
??
<
DarwinArch
>[
Darwin
Arch
.
arm64
];
if
(
targetPlatform
!=
TargetPlatform
.
ios
)
{
throw
Exception
(
'aot_assembly is only supported for iOS applications'
);
}
...
...
@@ -46,7 +46,7 @@ abstract class AotAssemblyBase extends Target {
mainPath:
environment
.
buildDir
.
childFile
(
'app.dill'
).
path
,
packagesPath:
environment
.
projectDir
.
childFile
(
'.packages'
).
path
,
outputPath:
outputPath
,
ios
Arch:
iosArchs
.
single
,
darwin
Arch:
iosArchs
.
single
,
bitcode:
bitcode
,
);
if
(
snapshotExitCode
!=
0
)
{
...
...
@@ -56,14 +56,14 @@ abstract class AotAssemblyBase extends Target {
// If we're building multiple iOS archs the binaries need to be lipo'd
// together.
final
List
<
Future
<
int
>>
pending
=
<
Future
<
int
>>[];
for
(
IOS
Arch
iosArch
in
iosArchs
)
{
for
(
Darwin
Arch
iosArch
in
iosArchs
)
{
pending
.
add
(
snapshotter
.
build
(
platform:
targetPlatform
,
buildMode:
buildMode
,
mainPath:
environment
.
buildDir
.
childFile
(
'app.dill'
).
path
,
packagesPath:
environment
.
projectDir
.
childFile
(
'.packages'
).
path
,
outputPath:
fs
.
path
.
join
(
outputPath
,
getNameFor
IOS
Arch
(
iosArch
)),
ios
Arch:
iosArch
,
outputPath:
fs
.
path
.
join
(
outputPath
,
getNameFor
Darwin
Arch
(
iosArch
)),
darwin
Arch:
iosArch
,
bitcode:
bitcode
,
));
}
...
...
@@ -73,8 +73,8 @@ abstract class AotAssemblyBase extends Target {
}
final
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
'lipo'
,
...
iosArchs
.
map
((
IOS
Arch
iosArch
)
=>
fs
.
path
.
join
(
outputPath
,
getNameFor
IOS
Arch
(
iosArch
),
'App.framework'
,
'App'
)),
...
iosArchs
.
map
((
Darwin
Arch
iosArch
)
=>
fs
.
path
.
join
(
outputPath
,
getNameFor
Darwin
Arch
(
iosArch
),
'App.framework'
,
'App'
)),
'-create'
,
'-output'
,
fs
.
path
.
join
(
outputPath
,
'App.framework'
,
'App'
),
...
...
packages/flutter_tools/lib/src/commands/build_aot.dart
View file @
1df165ea
...
...
@@ -40,8 +40,8 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
)
..
addMultiOption
(
'ios-arch'
,
splitCommas:
true
,
defaultsTo:
defaultIOSArchs
.
map
<
String
>(
getNameFor
IOS
Arch
),
allowed:
IOSArch
.
values
.
map
<
String
>(
getNameForIOS
Arch
),
defaultsTo:
defaultIOSArchs
.
map
<
String
>(
getNameFor
Darwin
Arch
),
allowed:
DarwinArch
.
values
.
map
<
String
>(
getNameForDarwin
Arch
),
help:
'iOS architectures to build.'
,
)
..
addMultiOption
(
FlutterOptions
.
kExtraFrontEndOptions
,
...
...
@@ -118,17 +118,17 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
// Build AOT snapshot.
if
(
platform
==
TargetPlatform
.
ios
)
{
// Determine which iOS architectures to build for.
final
Iterable
<
IOSArch
>
buildArchs
=
argResults
[
'ios-arch'
].
map
<
IOS
Arch
>(
getIOSArchForName
);
final
Map
<
IOSArch
,
String
>
iosBuilds
=
<
IOS
Arch
,
String
>{};
for
(
IOS
Arch
arch
in
buildArchs
)
iosBuilds
[
arch
]
=
fs
.
path
.
join
(
outputPath
,
getNameFor
IOS
Arch
(
arch
));
final
Iterable
<
DarwinArch
>
buildArchs
=
argResults
[
'ios-arch'
].
map
<
Darwin
Arch
>(
getIOSArchForName
);
final
Map
<
DarwinArch
,
String
>
iosBuilds
=
<
Darwin
Arch
,
String
>{};
for
(
Darwin
Arch
arch
in
buildArchs
)
iosBuilds
[
arch
]
=
fs
.
path
.
join
(
outputPath
,
getNameFor
Darwin
Arch
(
arch
));
// Generate AOT snapshot and compile to arch-specific App.framework.
final
Map
<
IOSArch
,
Future
<
int
>>
exitCodes
=
<
IOS
Arch
,
Future
<
int
>>{};
iosBuilds
.
forEach
((
IOS
Arch
iosArch
,
String
outputPath
)
{
final
Map
<
DarwinArch
,
Future
<
int
>>
exitCodes
=
<
Darwin
Arch
,
Future
<
int
>>{};
iosBuilds
.
forEach
((
Darwin
Arch
iosArch
,
String
outputPath
)
{
exitCodes
[
iosArch
]
=
snapshotter
.
build
(
platform:
platform
,
ios
Arch:
iosArch
,
darwin
Arch:
iosArch
,
buildMode:
buildMode
,
mainPath:
mainPath
,
packagesPath:
PackageMap
.
globalPackagesPath
,
...
...
@@ -160,7 +160,7 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
]);
}
else
{
status
?.
cancel
();
exitCodes
.
forEach
((
IOS
Arch
iosArch
,
Future
<
int
>
exitCodeFuture
)
async
{
exitCodes
.
forEach
((
Darwin
Arch
iosArch
,
Future
<
int
>
exitCodeFuture
)
async
{
final
int
buildExitCode
=
await
exitCodeFuture
;
printError
(
'Snapshotting (
$iosArch
) exited with non-zero exit code:
$buildExitCode
'
);
});
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
1df165ea
...
...
@@ -265,7 +265,7 @@ class IOSDevice extends Device {
printTrace
(
'Building
${package.name}
for
$id
'
);
final
String
cpuArchitecture
=
await
iMobileDevice
.
getInfoForDevice
(
id
,
'CPUArchitecture'
);
final
IOS
Arch
iosArch
=
getIOSArchForName
(
cpuArchitecture
);
final
Darwin
Arch
iosArch
=
getIOSArchForName
(
cpuArchitecture
);
// Step 1: Build the precompiled/DBC application if necessary.
final
XcodeBuildResult
buildResult
=
await
buildXcodeProject
(
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
1df165ea
...
...
@@ -201,7 +201,7 @@ Future<XcodeBuildResult> buildXcodeProject({
BuildInfo
buildInfo
,
String
targetOverride
,
bool
buildForDevice
,
IOS
Arch
activeArch
,
Darwin
Arch
activeArch
,
bool
codesign
=
true
,
bool
usesTerminalUi
=
true
,
})
async
{
...
...
@@ -317,7 +317,7 @@ Future<XcodeBuildResult> buildXcodeProject({
}
if
(
activeArch
!=
null
)
{
final
String
activeArchName
=
getNameFor
IOS
Arch
(
activeArch
);
final
String
activeArchName
=
getNameFor
Darwin
Arch
(
activeArch
);
if
(
activeArchName
!=
null
)
{
buildCommands
.
add
(
'ONLY_ACTIVE_ARCH=YES'
);
buildCommands
.
add
(
'ARCHS=
$activeArchName
'
);
...
...
packages/flutter_tools/test/general.shard/base/build_test.dart
View file @
1df165ea
...
...
@@ -50,7 +50,7 @@ class _FakeGenSnapshot implements GenSnapshot {
Future
<
int
>
run
({
SnapshotType
snapshotType
,
String
depfilePath
,
IOSArch
ios
Arch
,
DarwinArch
darwin
Arch
,
Iterable
<
String
>
additionalArgs
=
const
<
String
>[],
})
async
{
_callCount
+=
1
;
...
...
@@ -191,7 +191,7 @@ void main() {
mainPath:
'main.dill'
,
packagesPath:
'.packages'
,
outputPath:
outputPath
,
iosArch:
IOS
Arch
.
armv7
,
darwinArch:
Darwin
Arch
.
armv7
,
bitcode:
true
,
);
...
...
@@ -245,7 +245,7 @@ void main() {
mainPath:
'main.dill'
,
packagesPath:
'.packages'
,
outputPath:
outputPath
,
iosArch:
IOS
Arch
.
armv7
,
darwinArch:
Darwin
Arch
.
armv7
,
bitcode:
false
,
);
...
...
@@ -292,7 +292,7 @@ void main() {
mainPath:
'main.dill'
,
packagesPath:
'.packages'
,
outputPath:
outputPath
,
iosArch:
IOS
Arch
.
arm64
,
darwinArch:
Darwin
Arch
.
arm64
,
bitcode:
false
,
);
...
...
@@ -328,7 +328,7 @@ void main() {
mainPath:
'main.dill'
,
packagesPath:
'.packages'
,
outputPath:
outputPath
,
iosArch:
IOS
Arch
.
armv7
,
darwinArch:
Darwin
Arch
.
armv7
,
bitcode:
false
,
);
...
...
@@ -366,7 +366,7 @@ void main() {
mainPath:
'main.dill'
,
packagesPath:
'.packages'
,
outputPath:
outputPath
,
iosArch:
IOS
Arch
.
arm64
,
darwinArch:
Darwin
Arch
.
arm64
,
bitcode:
false
,
);
...
...
packages/flutter_tools/test/general.shard/build_system/targets/dart_test.dart
View file @
1df165ea
...
...
@@ -323,10 +323,10 @@ class MockXcode extends Mock implements Xcode {}
class
FakeGenSnapshot
implements
GenSnapshot
{
List
<
String
>
lastCallAdditionalArgs
;
@override
Future
<
int
>
run
({
SnapshotType
snapshotType
,
IOSArch
ios
Arch
,
Iterable
<
String
>
additionalArgs
=
const
<
String
>[]})
async
{
Future
<
int
>
run
({
SnapshotType
snapshotType
,
DarwinArch
darwin
Arch
,
Iterable
<
String
>
additionalArgs
=
const
<
String
>[]})
async
{
lastCallAdditionalArgs
=
additionalArgs
.
toList
();
final
Directory
out
=
fs
.
file
(
lastCallAdditionalArgs
.
last
).
parent
;
if
(
ios
Arch
==
null
)
{
if
(
darwin
Arch
==
null
)
{
out
.
childFile
(
'app.so'
).
createSync
();
out
.
childFile
(
'gen_snapshot.d'
).
createSync
();
return
0
;
...
...
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