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
89637e4e
Unverified
Commit
89637e4e
authored
Jul 27, 2021
by
Jenn Magder
Committed by
GitHub
Jul 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace iOS physical/simulator bools with enum (#87138)
parent
32c2e2ba
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
30 deletions
+30
-30
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+8
-8
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+1
-1
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+15
-15
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+1
-1
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+5
-5
No files found.
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
89637e4e
...
...
@@ -50,7 +50,7 @@ class BuildIOSCommand extends _BuildIOSSubCommand {
final
XcodeBuildAction
xcodeBuildAction
=
XcodeBuildAction
.
build
;
@override
bool
get
forSimulator
=>
boolArg
(
'simulator'
)
;
EnvironmentType
get
environmentType
=>
boolArg
(
'simulator'
)
?
EnvironmentType
.
simulator
:
EnvironmentType
.
physical
;
@override
bool
get
configOnly
=>
boolArg
(
'config-only'
);
...
...
@@ -91,7 +91,7 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
final
XcodeBuildAction
xcodeBuildAction
=
XcodeBuildAction
.
archive
;
@override
final
bool
forSimulator
=
false
;
final
EnvironmentType
environmentType
=
EnvironmentType
.
physical
;
@override
final
bool
configOnly
=
false
;
...
...
@@ -208,7 +208,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
};
XcodeBuildAction
get
xcodeBuildAction
;
bool
get
forSimulator
;
EnvironmentType
get
environmentType
;
bool
get
configOnly
;
bool
get
shouldCodesign
;
...
...
@@ -229,19 +229,19 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
defaultBuildMode
=
forS
imulator
?
BuildMode
.
debug
:
BuildMode
.
release
;
defaultBuildMode
=
environmentType
==
EnvironmentType
.
s
imulator
?
BuildMode
.
debug
:
BuildMode
.
release
;
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
if
(!
supported
)
{
throwToolExit
(
'Building for iOS is only supported on macOS.'
);
}
if
(
forS
imulator
&&
!
buildInfo
.
supportsSimulator
)
{
if
(
environmentType
==
EnvironmentType
.
s
imulator
&&
!
buildInfo
.
supportsSimulator
)
{
throwToolExit
(
'
${toTitleCase(buildInfo.friendlyModeName)}
mode is not supported for simulators.'
);
}
if
(
configOnly
&&
buildInfo
.
codeSizeDirectory
!=
null
)
{
throwToolExit
(
'Cannot analyze code size without performing a full build.'
);
}
if
(
!
forSimulator
&&
!
shouldCodesign
)
{
if
(
environmentType
==
EnvironmentType
.
physical
&&
!
shouldCodesign
)
{
globals
.
printStatus
(
'Warning: Building for device with codesigning disabled. You will '
'have to manually codesign before deploying to device.'
,
...
...
@@ -254,7 +254,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
throwToolExit
(
'Application not configured for iOS'
);
}
final
String
logTarget
=
forS
imulator
?
'simulator'
:
'device'
;
final
String
logTarget
=
environmentType
==
EnvironmentType
.
s
imulator
?
'simulator'
:
'device'
;
final
String
typeName
=
globals
.
artifacts
.
getEngineType
(
TargetPlatform
.
ios
,
buildInfo
.
mode
);
if
(
xcodeBuildAction
==
XcodeBuildAction
.
build
)
{
globals
.
printStatus
(
'Building
$app
for
$logTarget
(
$typeName
)...'
);
...
...
@@ -265,7 +265,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
app:
app
,
buildInfo:
buildInfo
,
targetOverride:
targetFile
,
buildForDevice:
!
forSimulator
,
environmentType:
environmentType
,
codesign:
shouldCodesign
,
configOnly:
configOnly
,
buildAction:
xcodeBuildAction
,
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
89637e4e
...
...
@@ -327,7 +327,7 @@ class IOSDevice extends Device {
app:
package
as
BuildableIOSApp
,
buildInfo:
debuggingOptions
.
buildInfo
,
targetOverride:
mainPath
,
buildForDevice:
true
,
environmentType:
EnvironmentType
.
physical
,
activeArch:
cpuArchitecture
,
deviceID:
id
,
);
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
89637e4e
...
...
@@ -96,7 +96,7 @@ Future<XcodeBuildResult> buildXcodeProject({
BuildableIOSApp
app
,
BuildInfo
buildInfo
,
String
targetOverride
,
bool
buildForDevice
,
EnvironmentType
environmentType
=
EnvironmentType
.
physical
,
DarwinArch
activeArch
,
bool
codesign
=
true
,
String
deviceID
,
...
...
@@ -181,10 +181,10 @@ Future<XcodeBuildResult> buildXcodeProject({
final
Map
<
String
,
String
>
buildSettings
=
await
app
.
project
.
buildSettingsForBuildInfo
(
buildInfo
,
environmentType:
buildForDevice
?
EnvironmentType
.
physical
:
EnvironmentType
.
simulator
,
environmentType:
environmentType
)
??
<
String
,
String
>{};
if
(
codesign
&&
buildForDevice
)
{
if
(
codesign
&&
environmentType
==
EnvironmentType
.
physical
)
{
autoSigningConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
buildSettings:
buildSettings
,
processManager:
globals
.
processManager
,
...
...
@@ -251,18 +251,18 @@ Future<XcodeBuildResult> buildXcodeProject({
// The -sdk argument has to be omitted if a watchOS companion app exists.
// Otherwise the build will fail as WatchKit dependencies cannot be build using the iOS SDK.
globals
.
printStatus
(
'Watch companion app found. Adjusting build settings.'
);
if
(
!
buildForDevice
&&
(
deviceID
==
null
||
deviceID
==
''
))
{
if
(
environmentType
==
EnvironmentType
.
simulator
&&
(
deviceID
==
null
||
deviceID
==
''
))
{
globals
.
printError
(
'No simulator device ID has been set.'
);
globals
.
printError
(
'A device ID is required to build an app with a watchOS companion app.'
);
globals
.
printError
(
'Please run "flutter devices" to get a list of available device IDs'
);
globals
.
printError
(
'and specify one using the -d, --device-id flag.'
);
return
XcodeBuildResult
(
success:
false
);
}
if
(
!
buildForDevice
)
{
if
(
environmentType
==
EnvironmentType
.
simulator
)
{
buildCommands
.
addAll
(<
String
>[
'-destination'
,
'id=
$deviceID
'
]);
}
}
else
{
if
(
buildForDevice
)
{
if
(
environmentType
==
EnvironmentType
.
physical
)
{
buildCommands
.
addAll
(<
String
>[
'-sdk'
,
'iphoneos'
]);
}
else
{
buildCommands
.
addAll
(<
String
>[
'-sdk'
,
'iphonesimulator'
]);
...
...
@@ -378,7 +378,7 @@ Future<XcodeBuildResult> buildXcodeProject({
xcodeBuildExecution:
XcodeBuildExecution
(
buildCommands:
buildCommands
,
appDirectory:
app
.
project
.
hostAppRoot
.
path
,
buildForPhysicalDevice:
buildForDevic
e
,
environmentType:
environmentTyp
e
,
buildSettings:
buildSettings
,
),
);
...
...
@@ -390,7 +390,7 @@ Future<XcodeBuildResult> buildXcodeProject({
// actual directory will end with 'iphonesimulator' for simulator builds.
// The value of TARGET_BUILD_DIR is adjusted to accommodate for this effect.
String
targetBuildDir
=
buildSettings
[
'TARGET_BUILD_DIR'
];
if
(
hasWatchCompanion
&&
!
buildForDevice
)
{
if
(
hasWatchCompanion
&&
environmentType
==
EnvironmentType
.
simulator
)
{
globals
.
printTrace
(
'Replacing iphoneos with iphonesimulator in TARGET_BUILD_DIR.'
);
targetBuildDir
=
targetBuildDir
.
replaceFirst
(
'iphoneos'
,
'iphonesimulator'
);
}
...
...
@@ -437,7 +437,7 @@ Future<XcodeBuildResult> buildXcodeProject({
xcodeBuildExecution:
XcodeBuildExecution
(
buildCommands:
buildCommands
,
appDirectory:
app
.
project
.
hostAppRoot
.
path
,
buildForPhysicalDevice:
buildForDevic
e
,
environmentType:
environmentTyp
e
,
buildSettings:
buildSettings
,
),
);
...
...
@@ -508,7 +508,7 @@ return result.exitCode != 0 &&
Future
<
void
>
diagnoseXcodeBuildFailure
(
XcodeBuildResult
result
,
Usage
flutterUsage
,
Logger
logger
)
async
{
if
(
result
.
xcodeBuildExecution
!=
null
&&
result
.
xcodeBuildExecution
.
buildForPhysicalDevice
&&
result
.
xcodeBuildExecution
.
environmentType
==
EnvironmentType
.
physical
&&
result
.
stdout
?.
toUpperCase
()?.
contains
(
'BITCODE'
)
==
true
)
{
BuildEvent
(
'xcode-bitcode-failure'
,
type:
'ios'
,
...
...
@@ -533,7 +533,7 @@ Future<void> diagnoseXcodeBuildFailure(XcodeBuildResult result, Usage flutterUsa
}
if
(
result
.
xcodeBuildExecution
!=
null
&&
result
.
xcodeBuildExecution
.
buildForPhysicalDevice
&&
result
.
xcodeBuildExecution
.
environmentType
==
EnvironmentType
.
physical
&&
result
.
stdout
?.
contains
(
'BCEROR'
)
==
true
&&
// May need updating if Xcode changes its outputs.
result
.
stdout
?.
contains
(
"Xcode couldn't find a provisioning profile matching"
)
==
true
)
{
...
...
@@ -544,14 +544,14 @@ Future<void> diagnoseXcodeBuildFailure(XcodeBuildResult result, Usage flutterUsa
// * DEVELOPMENT_TEAM (automatic signing)
// * PROVISIONING_PROFILE (manual signing)
if
(
result
.
xcodeBuildExecution
!=
null
&&
result
.
xcodeBuildExecution
.
buildForPhysicalDevice
&&
result
.
xcodeBuildExecution
.
environmentType
==
EnvironmentType
.
physical
&&
!<
String
>[
'DEVELOPMENT_TEAM'
,
'PROVISIONING_PROFILE'
].
any
(
result
.
xcodeBuildExecution
.
buildSettings
.
containsKey
))
{
logger
.
printError
(
noDevelopmentTeamInstruction
,
emphasis:
true
);
return
;
}
if
(
result
.
xcodeBuildExecution
!=
null
&&
result
.
xcodeBuildExecution
.
buildForPhysicalDevice
&&
result
.
xcodeBuildExecution
.
environmentType
==
EnvironmentType
.
physical
&&
result
.
xcodeBuildExecution
.
buildSettings
[
'PRODUCT_BUNDLE_IDENTIFIER'
]?.
contains
(
'com.example'
)
==
true
)
{
logger
.
printError
(
''
);
logger
.
printError
(
'It appears that your application still contains the default signing identifier.'
);
...
...
@@ -609,14 +609,14 @@ class XcodeBuildExecution {
XcodeBuildExecution
({
@required
this
.
buildCommands
,
@required
this
.
appDirectory
,
@required
this
.
buildForPhysicalDevic
e
,
@required
this
.
environmentTyp
e
,
@required
this
.
buildSettings
,
});
/// The original list of Xcode build commands used to produce this build result.
final
List
<
String
>
buildCommands
;
final
String
appDirectory
;
final
bool
buildForPhysicalDevic
e
;
final
EnvironmentType
environmentTyp
e
;
/// The build settings corresponding to the [buildCommands] invocation.
final
Map
<
String
,
String
>
buildSettings
;
}
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
89637e4e
...
...
@@ -529,7 +529,7 @@ class IOSSimulator extends Device {
app:
app
,
buildInfo:
buildInfo
,
targetOverride:
mainPath
,
buildForDevice:
false
,
environmentType:
EnvironmentType
.
simulator
,
deviceID:
id
,
);
if
(!
buildResult
.
success
)
{
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
89637e4e
...
...
@@ -149,7 +149,7 @@ void main() {
xcodeBuildExecution:
XcodeBuildExecution
(
buildCommands:
buildCommands
,
appDirectory:
'/blah/blah'
,
buildForPhysicalDevice:
true
,
environmentType:
EnvironmentType
.
physical
,
buildSettings:
buildSettings
,
),
);
...
...
@@ -229,7 +229,7 @@ Error launching application on iPhone.''',
xcodeBuildExecution: XcodeBuildExecution(
buildCommands: <String>['
xcrun
', '
xcodebuild
', '
blah
'],
appDirectory: '
/
blah
/
blah
',
buildForPhysicalDevice: true
,
environmentType: EnvironmentType.physical
,
buildSettings: buildSettings,
),
);
...
...
@@ -310,7 +310,7 @@ Could not build the precompiled application for the device.''',
xcodeBuildExecution: XcodeBuildExecution(
buildCommands: <String>['xcrun', 'xcodebuild', 'blah'],
appDirectory: '/blah/blah',
buildForPhysicalDevice: true
,
environmentType: EnvironmentType.physical
,
buildSettings: buildSettings,
),
);
...
...
@@ -347,7 +347,7 @@ Exited (sigterm)''',
xcodeBuildExecution: XcodeBuildExecution(
buildCommands: <String>['xcrun', 'xcodebuild', 'blah'],
appDirectory: '/blah/blah',
buildForPhysicalDevice: true
,
environmentType: EnvironmentType.physical
,
buildSettings: buildSettings,
),
);
...
...
@@ -384,7 +384,7 @@ Exited (sigterm)''',
xcodeBuildExecution: XcodeBuildExecution(
buildCommands: <String>['xcrun', 'xcodebuild', 'blah'],
appDirectory: '/blah/blah',
buildForPhysicalDevice: true
,
environmentType: EnvironmentType.physical
,
buildSettings: buildSettings,
),
);
...
...
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