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
60aa49e0
Commit
60aa49e0
authored
Jan 30, 2019
by
KyleWong
Committed by
xster
Jan 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let injectPlugins integrate custom pods (#26970)
parent
4e68b7c7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
3 deletions
+45
-3
cocoapods.dart
packages/flutter_tools/lib/src/ios/cocoapods.dart
+6
-0
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+8
-1
project.dart
packages/flutter_tools/lib/src/project.dart
+2
-2
cocoapods_test.dart
packages/flutter_tools/test/ios/cocoapods_test.dart
+29
-0
No files found.
packages/flutter_tools/lib/src/ios/cocoapods.dart
View file @
60aa49e0
...
...
@@ -193,6 +193,12 @@ class CocoaPods {
));
podfileTemplate
.
copySync
(
podfile
.
path
);
}
addPodsDependencyToFlutterXcconfig
(
iosProject
);
}
/// Ensures all `Flutter/Xxx.xcconfig` files for the given iOS sub-project of
/// a parent Flutter project include pods configuration.
void
addPodsDependencyToFlutterXcconfig
(
IosProject
iosProject
)
{
_addPodsDependencyToFlutterXcconfig
(
iosProject
,
'Debug'
);
_addPodsDependencyToFlutterXcconfig
(
iosProject
,
'Release'
);
}
...
...
packages/flutter_tools/lib/src/plugins.dart
View file @
60aa49e0
...
...
@@ -298,10 +298,17 @@ Future<void> injectPlugins(FlutterProject project) async {
await
_writeAndroidPluginRegistrant
(
project
,
plugins
);
await
_writeIOSPluginRegistrant
(
project
,
plugins
);
if
(!
project
.
isModule
&&
project
.
ios
.
hostAppRoot
.
existsSync
())
{
final
IosProject
iosProject
=
IosProject
.
fromFlutter
(
project
);
final
CocoaPods
cocoaPods
=
CocoaPods
();
if
(
plugins
.
isNotEmpty
)
if
(
plugins
.
isNotEmpty
)
{
cocoaPods
.
setupPodfile
(
project
.
ios
);
}
/// The user may have a custom maintained Podfile that they're running `pod install`
/// on themselves.
else
if
(
iosProject
.
podfile
.
existsSync
()
&&
iosProject
.
podfileLock
.
existsSync
())
{
cocoaPods
.
addPodsDependencyToFlutterXcconfig
(
iosProject
);
}
}
}
/// Returns whether the specified Flutter [project] has any plugin dependencies.
...
...
packages/flutter_tools/lib/src/project.dart
View file @
60aa49e0
...
...
@@ -89,7 +89,7 @@ class FlutterProject {
}
/// The iOS sub project of this project.
IosProject
get
ios
=>
IosProject
.
_
(
this
);
IosProject
get
ios
=>
IosProject
.
fromFlutter
(
this
);
/// The Android sub project of this project.
AndroidProject
get
android
=>
AndroidProject
.
_
(
this
);
...
...
@@ -151,7 +151,7 @@ class FlutterProject {
/// Instances will reflect the contents of the `ios/` sub-folder of
/// Flutter applications and the `.ios/` sub-folder of Flutter module projects.
class
IosProject
{
IosProject
.
_
(
this
.
parent
);
IosProject
.
fromFlutter
(
this
.
parent
);
/// The parent of this project.
final
FlutterProject
parent
;
...
...
packages/flutter_tools/test/ios/cocoapods_test.dart
View file @
60aa49e0
...
...
@@ -9,6 +9,7 @@ import 'package:file/memory.dart';
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/plugins.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/ios/cocoapods.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
...
...
@@ -202,6 +203,34 @@ void main() {
});
});
group
(
'Update xcconfig'
,
()
{
testUsingContext
(
'includes Pod config in xcconfig files, if the user manually added Pod dependencies without using Flutter plugins'
,
()
async
{
projectUnderTest
.
ios
.
podfile
..
createSync
()..
writeAsStringSync
(
'Custom Podfile'
);
projectUnderTest
.
ios
.
podfileLock
..
createSync
()..
writeAsStringSync
(
'Podfile.lock from user executed `pod install`'
);
projectUnderTest
.
packagesFile
..
createSync
()..
writeAsStringSync
(
''
);
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'Existing debug config'
);
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Release'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'Existing release config'
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'project'
);
await
injectPlugins
(
project
);
final
String
debugContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
).
readAsStringSync
();
expect
(
debugContents
,
contains
(
'#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
\n
'
));
expect
(
debugContents
,
contains
(
'Existing debug config'
));
final
String
releaseContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Release'
).
readAsStringSync
();
expect
(
releaseContents
,
contains
(
'#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
\n
'
));
expect
(
releaseContents
,
contains
(
'Existing release config'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
});
});
group
(
'Process pods'
,
()
{
testUsingContext
(
'prints error, if CocoaPods is not installed'
,
()
async
{
pretendPodIsNotInstalled
();
...
...
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