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
670bf871
Commit
670bf871
authored
Feb 19, 2016
by
Chinmay Garde
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1969 from chinmaygarde/master
iOS: Misc tooling updates
parents
5009f44a
9ed4e417
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
37 deletions
+83
-37
ISSUE_TEMPLATE.md
ISSUE_TEMPLATE.md
+14
-0
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+21
-8
device_ios.dart
packages/flutter_tools/lib/src/ios/device_ios.dart
+5
-1
plist_utils.dart
packages/flutter_tools/lib/src/ios/plist_utils.dart
+29
-0
setup_xcodeproj.dart
packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
+10
-26
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+4
-2
No files found.
ISSUE_TEMPLATE.md
0 → 100644
View file @
670bf871
_Detailed issue description here. More information at [https://flutter.io/bug_
reports/](https://flutter.io/bug_reports/)_
### Steps to Reproduce
*
_Add steps here. Provide verbose variants of
`flutter`
commands if necessary._
### Flutter Version
_Add flutter version here_
### Logs
_Paste relevant logs here_
### Crash Reports
_Add relevant crash reports here_
packages/flutter_tools/lib/src/application_package.dart
View file @
670bf871
...
...
@@ -10,6 +10,7 @@ import 'package:xml/xml.dart' as xml;
import
'artifacts.dart'
;
import
'build_configuration.dart'
;
import
'ios/plist_utils.dart'
;
abstract
class
ApplicationPackage
{
/// Path to the actual apk or bundle.
...
...
@@ -81,13 +82,25 @@ class AndroidApk extends ApplicationPackage {
}
class
IOSApp
extends
ApplicationPackage
{
static
const
String
_defaultId
=
'io.flutter.runner.Runner'
;
static
const
String
_defaultPath
=
'ios/.generated'
;
IOSApp
({
String
localPath:
_defaultPath
,
String
id:
_defaultId
})
:
super
(
localPath:
localPath
,
id:
id
);
String
iosProjectDir
,
String
iosProjectBundleId
})
:
super
(
localPath:
iosProjectDir
,
id:
iosProjectBundleId
);
factory
IOSApp
.
fromBuildConfiguration
(
BuildConfiguration
config
)
{
if
(
getCurrentHostPlatform
()
!=
HostPlatform
.
mac
)
{
return
null
;
}
String
plistPath
=
path
.
join
(
"ios"
,
"Info.plist"
);
String
id
=
plistValueForKey
(
plistPath
,
kCFBundleIdentifierKey
);
if
(
id
==
""
)
{
return
null
;
}
String
projectDir
=
path
.
join
(
"ios"
,
".generated"
);
return
new
IOSApp
(
iosProjectDir:
projectDir
,
iosProjectBundleId:
id
);
}
}
class
ApplicationPackageStore
{
...
...
@@ -138,12 +151,12 @@ class ApplicationPackageStore {
case
TargetPlatform
.
iOS
:
assert
(
iOS
==
null
);
iOS
=
new
IOSApp
(
);
iOS
=
new
IOSApp
.
fromBuildConfiguration
(
config
);
break
;
case
TargetPlatform
.
iOSSimulator
:
assert
(
iOSSimulator
==
null
);
iOSSimulator
=
new
IOSApp
(
);
iOSSimulator
=
new
IOSApp
.
fromBuildConfiguration
(
config
);
break
;
case
TargetPlatform
.
mac
:
...
...
packages/flutter_tools/lib/src/ios/device_ios.dart
View file @
670bf871
...
...
@@ -565,12 +565,16 @@ String _getIOSEngineRevision(ApplicationPackage app) {
}
Future
<
bool
>
_buildIOSXcodeProject
(
ApplicationPackage
app
,
{
bool
buildForDevice
})
async
{
String
flutterProjectPath
=
Directory
.
current
.
path
;
if
(
xcodeProjectRequiresUpdate
())
{
printTrace
(
'Initializing the Xcode project.'
);
if
((
await
setupXcodeProjectHarness
())
!=
0
)
{
if
((
await
setupXcodeProjectHarness
(
flutterProjectPath
))
!=
0
)
{
printError
(
'Could not initialize the Xcode project.'
);
return
false
;
}
}
else
{
updateXcodeLocalProperties
(
flutterProjectPath
);
}
if
(!
_validateEngineRevision
(
app
))
...
...
packages/flutter_tools/lib/src/ios/plist_utils.dart
0 → 100644
View file @
670bf871
// Copyright 2016 The Chromium 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
'package:path/path.dart'
as
path
;
import
'../base/process.dart'
;
const
String
kCFBundleIdentifierKey
=
"CFBundleIdentifier"
;
String
plistValueForKey
(
String
plistFilePath
,
String
plistKey
)
{
// TODO(chinmaygarde): For now, we only need to read from plist files on a
// mac host. If this changes, we will need our own Dart plist reader.
// Don't use PlistBuddy since that is not guaranteed to be installed.
// 'defaults' requires the path to be absolute and without the 'plist'
// extension.
String
normalizedPlistPath
=
path
.
withoutExtension
(
path
.
absolute
(
plistFilePath
));
try
{
return
runCheckedSync
([
'/usr/bin/defaults'
,
'read'
,
normalizedPlistPath
,
plistKey
]).
trim
();
}
catch
(
error
)
{
return
""
;
}
}
packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
View file @
670bf871
...
...
@@ -91,19 +91,7 @@ Future<bool> _inflateXcodeArchive(String directory, List<int> archiveBytes) asyn
return
true
;
}
void
_writeUserEditableFilesIfNecessary
(
String
directory
)
{
iosTemplateFiles
.
forEach
((
String
filePath
,
String
contents
)
{
File
file
=
new
File
(
filePath
);
if
(!
file
.
existsSync
())
{
file
.
parent
.
createSync
(
recursive:
true
);
file
.
writeAsStringSync
(
contents
);
printStatus
(
'Created
$filePath
.'
);
}
});
}
void
_setupXcodeProjXcconfig
(
String
filePath
)
{
void
updateXcodeLocalProperties
(
String
projectPath
)
{
StringBuffer
localsBuffer
=
new
StringBuffer
();
localsBuffer
.
writeln
(
'// This is a generated file; do not edit or check into version control.'
);
...
...
@@ -118,7 +106,7 @@ void _setupXcodeProjXcconfig(String filePath) {
String
dartSDKPath
=
path
.
normalize
(
path
.
join
(
Platform
.
resolvedExecutable
,
'..'
,
'..'
));
localsBuffer
.
writeln
(
'DART_SDK_PATH=
$dartSDKPath
'
);
File
localsFile
=
new
File
(
filePath
);
File
localsFile
=
new
File
(
path
.
join
(
projectPath
,
'ios'
,
'.generated'
,
'Local.xcconfig'
)
);
localsFile
.
createSync
(
recursive:
true
);
localsFile
.
writeAsStringSync
(
localsBuffer
.
toString
());
}
...
...
@@ -142,9 +130,9 @@ bool xcodeProjectRequiresUpdate() {
return
false
;
}
Future
<
int
>
setupXcodeProjectHarness
()
async
{
Future
<
int
>
setupXcodeProjectHarness
(
String
flutterProjectPath
)
async
{
// Step 1: Fetch the archive from the cloud
String
iosFilesPath
=
path
.
join
(
Directory
.
current
.
p
ath
,
'ios'
);
String
iosFilesPath
=
path
.
join
(
flutterProjectP
ath
,
'ios'
);
String
xcodeprojPath
=
path
.
join
(
iosFilesPath
,
'.generated'
);
List
<
int
>
archiveBytes
=
await
_fetchXcodeArchive
();
...
...
@@ -160,19 +148,15 @@ Future<int> setupXcodeProjectHarness() async {
return
1
;
}
// Step 3: Setup default user editable files if this is the first run of
// the init command.
_writeUserEditableFilesIfNecessary
(
iosFilesPath
);
// Step 4: Populate the Local.xcconfig with project specific paths
_setupXcodeProjXcconfig
(
path
.
join
(
xcodeprojPath
,
'Local.xcconfig'
));
// Step 3: Populate the Local.xcconfig with project specific paths
updateXcodeLocalProperties
(
flutterProjectPath
);
// Step
5
: Write the REVISION file
// Step
4
: Write the REVISION file
File
revisionFile
=
new
File
(
path
.
join
(
xcodeprojPath
,
'REVISION'
));
revisionFile
.
createSync
();
revisionFile
.
writeAsStringSync
(
ArtifactStore
.
engineRevision
);
// Step
6
: Tell the user the location of the generated project.
// Step
5
: Tell the user the location of the generated project.
printStatus
(
'Xcode project created at
$xcodeprojPath
/.'
);
printStatus
(
'User editable settings are in
$iosFilesPath
/.'
);
...
...
@@ -189,11 +173,11 @@ final String _infoPlistInitialContents = '''
<key>CFBundleExecutable</key>
<string>Runner</string>
<key>CFBundleIdentifier</key>
<string>
io.flutter.runner.Runner
</string>
<string>
com.example.{{projectName}}
</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>
Flutter
</string>
<string>
{{projectName}}
</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
...
...
packages/flutter_tools/test/src/mocks.dart
View file @
670bf871
...
...
@@ -14,8 +14,10 @@ import 'package:mockito/mockito.dart';
class
MockApplicationPackageStore
extends
ApplicationPackageStore
{
MockApplicationPackageStore
()
:
super
(
android:
new
AndroidApk
(
localPath:
'/mock/path/to/android/SkyShell.apk'
),
iOS:
new
IOSApp
(
localPath:
'/mock/path/to/iOS/SkyShell.app'
),
iOSSimulator:
new
IOSApp
(
localPath:
'/mock/path/to/iOSSimulator/SkyShell.app'
));
iOS:
new
IOSApp
(
iosProjectDir:
'/mock/path/to/iOS/SkyShell.app'
,
iosProjectBundleId:
'io.flutter.ios.mock'
),
iOSSimulator:
new
IOSApp
(
iosProjectDir:
'/mock/path/to/iOSSimulator/SkyShell.app'
,
iosProjectBundleId:
'io.flutter.ios.mock'
));
}
class
MockCompiler
extends
Mock
implements
Compiler
{
...
...
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