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
704814c6
Unverified
Commit
704814c6
authored
Feb 06, 2019
by
Dan Field
Committed by
GitHub
Feb 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use CP_REPOS_DIR if it's set (#27553)
* Allow CP_REPOS_DIR
parent
914f77f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
3 deletions
+62
-3
cocoapods.dart
packages/flutter_tools/lib/src/ios/cocoapods.dart
+13
-2
cocoapods_test.dart
packages/flutter_tools/test/ios/cocoapods_test.dart
+49
-1
No files found.
packages/flutter_tools/lib/src/ios/cocoapods.dart
View file @
704814c6
...
...
@@ -11,6 +11,7 @@ import '../base/context.dart';
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/process_manager.dart'
;
import
'../base/version.dart'
;
...
...
@@ -85,8 +86,18 @@ class CocoaPods {
}
}
/// Whether CocoaPods ran '
pod
setup
' once where the costly pods'
specs
are
cloned
.
Future
<
bool
>
get
isCocoaPodsInitialized
=>
fs
.
isDirectory
(
fs
.
path
.
join
(
homeDirPath
,
'.cocoapods'
,
'repos'
,
'master'
));
/// Whether CocoaPods ran '
pod
setup
' once where the costly pods'
specs
are
/// cloned.
///
/// A user can override the default location via the CP_REPOS_DIR environment
/// variable.
///
/// See https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/config.rb#L138
/// for details of this variable.
Future
<
bool
>
get
isCocoaPodsInitialized
{
final
String
cocoapodsReposDir
=
platform
.
environment
[
'CP_REPOS_DIR'
]
??
fs
.
path
.
join
(
homeDirPath
,
'.cocoapods'
,
'repos'
);
return
fs
.
isDirectory
(
fs
.
path
.
join
(
cocoapodsReposDir
,
'master'
));
}
Future
<
bool
>
processPods
({
@required
IosProject
iosProject
,
...
...
packages/flutter_tools/test/ios/cocoapods_test.dart
View file @
704814c6
...
...
@@ -8,6 +8,7 @@ import 'package:file/file.dart';
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/base/platform.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/plugins.dart'
;
import
'package:flutter_tools/src/project.dart'
;
...
...
@@ -41,6 +42,16 @@ void main() {
resultOfPodVersion
=
()
async
=>
exitsHappy
(
versionText
);
}
void
podsIsInHomeDir
()
{
fs
.
directory
(
fs
.
path
.
join
(
homeDirPath
,
'.cocoapods'
,
'repos'
,
'master'
)).
createSync
(
recursive:
true
);
}
String
podsIsInCustomDir
({
String
cocoapodsReposDir
})
{
cocoapodsReposDir
??=
fs
.
path
.
join
(
homeDirPath
,
'cache'
,
'cocoapods'
,
'repos'
);
fs
.
directory
(
fs
.
path
.
join
(
cocoapodsReposDir
,
'master'
)).
createSync
(
recursive:
true
);
return
cocoapodsReposDir
;
}
setUp
(()
async
{
Cache
.
flutterRoot
=
'flutter'
;
fs
=
MemoryFileSystem
();
...
...
@@ -60,7 +71,6 @@ void main() {
))
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'Swift podfile template'
);
fs
.
directory
(
fs
.
path
.
join
(
homeDirPath
,
'.cocoapods'
,
'repos'
,
'master'
)).
createSync
(
recursive:
true
);
when
(
mockProcessManager
.
run
(
<
String
>[
'pod'
,
'--version'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
...
...
@@ -232,6 +242,10 @@ void main() {
});
group
(
'Process pods'
,
()
{
setUp
(()
{
podsIsInHomeDir
();
});
testUsingContext
(
'prints error, if CocoaPods is not installed'
,
()
async
{
pretendPodIsNotInstalled
();
projectUnderTest
.
ios
.
podfile
.
createSync
();
...
...
@@ -519,6 +533,40 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
ProcessManager:
()
=>
mockProcessManager
,
});
});
group
(
'Pods repos dir is custom'
,
()
{
String
cocoapodsRepoDir
;
Map
<
String
,
String
>
environment
;
setUp
(()
{
cocoapodsRepoDir
=
podsIsInCustomDir
();
environment
=
<
String
,
String
>{
'FLUTTER_FRAMEWORK_DIR'
:
'engine/path'
,
'COCOAPODS_DISABLE_STATS'
:
'true'
,
'CP_REPOS_DIR'
:
cocoapodsRepoDir
,
};
});
testUsingContext
(
'succeeds, if specs repo is in CP_REPOS_DIR.'
,
()
async
{
fs
.
file
(
fs
.
path
.
join
(
'project'
,
'ios'
,
'Podfile'
))
..
createSync
()
..
writeAsStringSync
(
'Existing Podfile'
);
when
(
mockProcessManager
.
run
(
<
String
>[
'pod'
,
'install'
,
'--verbose'
],
workingDirectory:
'project/ios'
,
environment:
environment
,
)).
thenAnswer
((
_
)
async
=>
exitsHappy
());
final
bool
success
=
await
cocoaPodsUnderTest
.
processPods
(
iosProject:
projectUnderTest
.
ios
,
iosEngineDir:
'engine/path'
,
);
expect
(
success
,
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
mockProcessManager
,
Platform:
()
=>
FakePlatform
(
environment:
environment
),
});
});
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
...
...
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