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
612a097d
Commit
612a097d
authored
Jun 02, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --target support to flutter build ios (#4318)
Fixes #4298
parent
bc5d4074
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
12 deletions
+28
-12
xcode_backend.sh
packages/flutter_tools/bin/xcode_backend.sh
+2
-0
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+8
-3
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+1
-1
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+10
-4
setup_xcodeproj.dart
packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
+6
-3
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+1
-1
No files found.
packages/flutter_tools/bin/xcode_backend.sh
View file @
612a097d
...
...
@@ -49,6 +49,7 @@ BuildApp() {
RunCommand
${
FLUTTER_ROOT
}
/bin/flutter
--suppress-analytics
build aot
\
--target-platform
=
ios
\
--target
=
${
FLUTTER_TARGET
}
\
--release
\
${
interpreter_flag
}
\
${
local_engine_flag
}
...
...
@@ -69,6 +70,7 @@ BuildApp() {
fi
RunCommand
${
FLUTTER_ROOT
}
/bin/flutter
--suppress-analytics
build flx
\
--target
=
${
FLUTTER_TARGET
}
\
--output-file
=
${
derived_dir
}
/app.flx
\
${
precompilation_flag
}
\
${
local_engine_flag
}
\
...
...
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
612a097d
...
...
@@ -15,6 +15,7 @@ import '../runner/flutter_command.dart';
class
BuildIOSCommand
extends
FlutterCommand
{
BuildIOSCommand
()
{
usesTargetOption
();
addBuildModeFlags
();
argParser
.
addFlag
(
'simulator'
,
help:
'Build for the iOS simulator instead of the device.'
);
argParser
.
addFlag
(
'codesign'
,
negatable:
true
,
defaultsTo:
true
,
...
...
@@ -53,9 +54,13 @@ class BuildIOSCommand extends FlutterCommand {
String
typeName
=
path
.
basename
(
tools
.
getEngineArtifactsDirectory
(
TargetPlatform
.
ios
,
getBuildMode
()).
path
);
Status
status
=
logger
.
startProgress
(
'Building
$app
for
$logTarget
(
$typeName
)...'
);
XcodeBuildResult
result
=
await
buildXcodeProject
(
app
,
getBuildMode
(),
buildForDevice:
!
forSimulator
,
codesign:
shouldCodesign
);
XcodeBuildResult
result
=
await
buildXcodeProject
(
app:
app
,
mode:
getBuildMode
(),
target:
argResults
[
'target'
],
buildForDevice:
!
forSimulator
,
codesign:
shouldCodesign
);
status
.
stop
(
showElapsedTime:
true
);
if
(!
result
.
success
)
{
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
612a097d
...
...
@@ -180,7 +180,7 @@ class IOSDevice extends Device {
printTrace
(
'Building
${app.name}
for
$id
'
);
// Step 1: Install the precompiled/DBC application if necessary.
XcodeBuildResult
buildResult
=
await
buildXcodeProject
(
app
,
mode
,
buildForDevice:
true
);
XcodeBuildResult
buildResult
=
await
buildXcodeProject
(
app
:
app
,
mode:
mode
,
buildForDevice:
true
);
if
(!
buildResult
.
success
)
{
printError
(
'Could not build the precompiled application for the device.'
);
return
new
LaunchResult
.
failed
();
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
612a097d
...
...
@@ -13,6 +13,7 @@ import '../base/context.dart';
import
'../base/process.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
import
'../flx.dart'
as
flx
;
import
'../globals.dart'
;
import
'../services.dart'
;
import
'setup_xcodeproj.dart'
;
...
...
@@ -97,18 +98,23 @@ bool _xcodeVersionCheckValid(int major, int minor) {
return
false
;
}
Future
<
XcodeBuildResult
>
buildXcodeProject
(
ApplicationPackage
app
,
BuildMode
mode
,
{
bool
buildForDevice
,
bool
codesign:
true
})
async
{
Future
<
XcodeBuildResult
>
buildXcodeProject
({
ApplicationPackage
app
,
BuildMode
mode
,
String
target:
flx
.
defaultMainPath
,
bool
buildForDevice
,
bool
codesign:
true
})
async
{
String
flutterProjectPath
=
Directory
.
current
.
path
;
if
(
xcodeProjectRequiresUpdate
(
mode
))
{
printTrace
(
'Initializing the Xcode project.'
);
if
((
await
setupXcodeProjectHarness
(
flutterProjectPath
,
mode
))
!=
0
)
{
if
((
await
setupXcodeProjectHarness
(
flutterProjectPath
,
mode
,
target
))
!=
0
)
{
printError
(
'Could not initialize the Xcode project.'
);
return
new
XcodeBuildResult
(
false
);
}
}
else
{
updateXcodeGeneratedProperties
(
flutterProjectPath
,
mode
);
updateXcodeGeneratedProperties
(
flutterProjectPath
,
mode
,
target
);
}
if
(!
_validateEngineRevision
(
app
))
...
...
packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
View file @
612a097d
...
...
@@ -54,7 +54,7 @@ bool _inflateXcodeArchive(String directory, List<int> archiveBytes) {
return
true
;
}
void
updateXcodeGeneratedProperties
(
String
projectPath
,
BuildMode
mode
)
{
void
updateXcodeGeneratedProperties
(
String
projectPath
,
BuildMode
mode
,
String
target
)
{
StringBuffer
localsBuffer
=
new
StringBuffer
();
localsBuffer
.
writeln
(
'// This is a generated file; do not edit or check into version control.'
);
...
...
@@ -66,6 +66,9 @@ void updateXcodeGeneratedProperties(String projectPath, BuildMode mode) {
String
applicationRoot
=
path
.
normalize
(
Directory
.
current
.
path
);
localsBuffer
.
writeln
(
'FLUTTER_APPLICATION_PATH=
$applicationRoot
'
);
// Relative to FLUTTER_APPLICATION_PATH, which is [Directory.current].
localsBuffer
.
writeln
(
'FLUTTER_TARGET=
$target
'
);
String
flutterFrameworkDir
=
path
.
normalize
(
tools
.
getEngineArtifactsDirectory
(
TargetPlatform
.
ios
,
mode
).
path
);
localsBuffer
.
writeln
(
'FLUTTER_FRAMEWORK_DIR=
$flutterFrameworkDir
'
);
...
...
@@ -97,7 +100,7 @@ bool xcodeProjectRequiresUpdate(BuildMode mode) {
return
false
;
}
Future
<
int
>
setupXcodeProjectHarness
(
String
flutterProjectPath
,
BuildMode
mode
)
async
{
Future
<
int
>
setupXcodeProjectHarness
(
String
flutterProjectPath
,
BuildMode
mode
,
String
target
)
async
{
// Step 1: Fetch the archive from the cloud
String
iosFilesPath
=
path
.
join
(
flutterProjectPath
,
'ios'
);
String
xcodeprojPath
=
path
.
join
(
iosFilesPath
,
'.generated'
);
...
...
@@ -119,7 +122,7 @@ Future<int> setupXcodeProjectHarness(String flutterProjectPath, BuildMode mode)
}
// Step 3: Populate the Generated.xcconfig with project specific paths
updateXcodeGeneratedProperties
(
flutterProjectPath
,
mode
);
updateXcodeGeneratedProperties
(
flutterProjectPath
,
mode
,
target
);
// Step 4: Write the REVISION file
File
revisionFile
=
new
File
(
path
.
join
(
xcodeprojPath
,
'REVISION'
));
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
612a097d
...
...
@@ -548,7 +548,7 @@ class IOSSimulator extends Device {
Future
<
bool
>
_buildAndInstallApplicationBundle
(
ApplicationPackage
app
)
async
{
// Step 1: Build the Xcode project.
// The build mode for the simulator is always debug.
XcodeBuildResult
buildResult
=
await
buildXcodeProject
(
app
,
BuildMode
.
debug
,
buildForDevice:
false
);
XcodeBuildResult
buildResult
=
await
buildXcodeProject
(
app
:
app
,
mode:
BuildMode
.
debug
,
buildForDevice:
false
);
if
(!
buildResult
.
success
)
{
printError
(
'Could not build the application for the simulator.'
);
return
false
;
...
...
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