@@ -43,6 +43,11 @@ private class Pod {
43
43
/// </summary>
44
44
public string name = null ;
45
45
46
+ /// <summary>
47
+ /// Path to pod on local file system relative to project directory (for development pods)
48
+ /// </summary>
49
+ public string path = null ;
50
+
46
51
/// <summary>
47
52
/// This is a preformatted version expression for pod declarations.
48
53
///
@@ -88,16 +93,28 @@ private class Pod {
88
93
/// </summary>
89
94
public bool fromXmlFile = false ;
90
95
96
+ /// <summary>
97
+ /// Returns the absolute path to the local pod
98
+ /// </summary>
99
+ /// <value></value>
100
+ public string absPath {
101
+ get {
102
+ return Path . GetFullPath ( path ) ;
103
+ }
104
+ }
105
+
91
106
/// <summary>
92
107
/// Format a "pod" line for a Podfile.
93
108
/// </summary>
94
109
public string PodFilePodLine {
95
110
get {
96
- string versionString = "" ;
97
- if ( ! String . IsNullOrEmpty ( version ) ) {
98
- versionString = String . Format ( ", '{0}'" , version ) ;
111
+ string versionOrPathString = "" ;
112
+ if ( ! String . IsNullOrEmpty ( path ) ) {
113
+ versionOrPathString = String . Format ( ", :path => '{0}'" , absPath ) ;
114
+ } else if ( ! String . IsNullOrEmpty ( version ) ) {
115
+ versionOrPathString = String . Format ( ", '{0}'" , version ) ;
99
116
}
100
- return String . Format ( "pod '{0}'{1}" , name , versionString ) ;
117
+ return String . Format ( "pod '{0}'{1}" , name , versionOrPathString ) ;
101
118
}
102
119
}
103
120
@@ -114,9 +131,10 @@ public string PodFilePodLine {
114
131
/// Each source is a URL that is injected in the source section of a Podfile
115
132
/// See https://guides.cocoapods.org/syntax/podfile.html#source for the description of
116
133
/// a source.</param>
117
- public Pod ( string name , string version , bool bitcodeEnabled ,
134
+ public Pod ( string name , string path , string version , bool bitcodeEnabled ,
118
135
string minTargetSdk , IEnumerable < string > sources ) {
119
136
this . name = name ;
137
+ this . path = path ;
120
138
this . version = version ;
121
139
this . bitcodeEnabled = bitcodeEnabled ;
122
140
this . minTargetSdk = minTargetSdk ;
@@ -185,6 +203,7 @@ public IOSXmlDependencies() {
185
203
/// <dependencies>
186
204
/// <iosPods>
187
205
/// <iosPod name="name"
206
+ /// path="pathToLocal"
188
207
/// version="versionSpec"
189
208
/// bitcodeEnabled="enabled"
190
209
/// minTargetSdk="sdk">
@@ -201,6 +220,7 @@ protected override bool Read(string filename, Logger logger) {
201
220
var trueStrings = new HashSet < string > { "true" , "1" } ;
202
221
var falseStrings = new HashSet < string > { "false" , "0" } ;
203
222
string podName = null ;
223
+ string localPath = null ;
204
224
string versionSpec = null ;
205
225
bool bitcodeEnabled = true ;
206
226
string minTargetSdk = null ;
@@ -217,6 +237,7 @@ protected override bool Read(string filename, Logger logger) {
217
237
parentElementName == "iosPods" ) {
218
238
if ( isStart ) {
219
239
podName = reader . GetAttribute ( "name" ) ;
240
+ localPath = reader . GetAttribute ( "path" ) ;
220
241
versionSpec = reader . GetAttribute ( "version" ) ;
221
242
var bitcodeEnabledString =
222
243
( reader . GetAttribute ( "bitcode" ) ?? "" ) . ToLower ( ) ;
@@ -232,7 +253,7 @@ protected override bool Read(string filename, Logger logger) {
232
253
return false ;
233
254
}
234
255
} else {
235
- AddPodInternal ( podName , preformattedVersion : versionSpec ,
256
+ AddPodInternal ( podName , localPath , preformattedVersion : versionSpec ,
236
257
bitcodeEnabled : bitcodeEnabled ,
237
258
minTargetSdk : minTargetSdk ,
238
259
sources : sources ,
@@ -398,7 +419,7 @@ protected override bool Read(string filename, Logger logger) {
398
419
private static System . Object commandLineDialogLock = new System . Object ( ) ;
399
420
400
421
// Regex for parsing comma separated values, as used in the pod dependency specification.
401
- private static Regex CSV_SPLIT_REGEX = new Regex ( @"(?:^|,\s*)'([^']*)'" , RegexOptions . Compiled ) ;
422
+ private static Regex CSV_SPLIT_REGEX = new Regex ( @"(?:^|,\s*|, :(.*) => )'([^']*)'" , RegexOptions . Compiled ) ;
402
423
403
424
// Parses a source URL from a Podfile.
404
425
private static Regex PODFILE_SOURCE_REGEX = new Regex ( @"^\s*source\s+'([^']*)'" ) ;
@@ -876,11 +897,11 @@ private static string PodVersionExpressionFromVersionDep(string dependencyVersio
876
897
/// Each source is a URL that is injected in the source section of a Podfile
877
898
/// See https://guides.cocoapods.org/syntax/podfile.html#source for the description of
878
899
/// a source.</param>
879
- public static void AddPod ( string podName , string version = null ,
900
+ public static void AddPod ( string podName , string localPath = null , string version = null ,
880
901
bool bitcodeEnabled = true ,
881
902
string minTargetSdk = null ,
882
903
IEnumerable < string > sources = null ) {
883
- AddPodInternal ( podName , preformattedVersion : PodVersionExpressionFromVersionDep ( version ) ,
904
+ AddPodInternal ( podName , localPath , preformattedVersion : PodVersionExpressionFromVersionDep ( version ) ,
884
905
bitcodeEnabled : bitcodeEnabled , minTargetSdk : minTargetSdk ,
885
906
sources : sources ) ;
886
907
}
@@ -905,7 +926,9 @@ public static void AddPod(string podName, string version = null,
905
926
/// <param name="overwriteExistingPod">Overwrite an existing pod.</param>
906
927
/// <param name="createdBy">Tag of the object that added this pod.</param>
907
928
/// <param name="fromXmlFile">Whether this was added via an XML dependency.</param>
908
- private static void AddPodInternal ( string podName , string preformattedVersion = null ,
929
+ private static void AddPodInternal ( string podName ,
930
+ string localPath = null ,
931
+ string preformattedVersion = null ,
909
932
bool bitcodeEnabled = true ,
910
933
string minTargetSdk = null ,
911
934
IEnumerable < string > sources = null ,
@@ -920,7 +943,7 @@ private static void AddPodInternal(string podName, string preformattedVersion =
920
943
level : LogLevel . Warning ) ;
921
944
return ;
922
945
}
923
- var pod = new Pod ( podName , preformattedVersion , bitcodeEnabled , minTargetSdk , sources ) ;
946
+ var pod = new Pod ( podName , localPath , preformattedVersion , bitcodeEnabled , minTargetSdk , sources ) ;
924
947
pod . createdBy = createdBy ?? pod . createdBy ;
925
948
pod . fromXmlFile = fromXmlFile ;
926
949
pods [ podName ] = pod ;
@@ -1515,19 +1538,30 @@ private static void ParseUnityDeps(string unityPodfilePath) {
1515
1538
1516
1539
// Add the version as is, if it was present in the original podfile.
1517
1540
if ( matches . Count > 1 ) {
1518
- string matchedName = matches [ 0 ] . Groups [ 1 ] . Captures [ 0 ] . Value ;
1519
- string matchedVersion = matches [ 1 ] . Groups [ 1 ] . Captures [ 0 ] . Value ;
1520
- Log ( String . Format ( "Preserving Unity Pod: {0}\n at version: {1}" , matchedName ,
1521
- matchedVersion ) , verbose : true ) ;
1522
-
1523
- AddPodInternal ( matchedName , preformattedVersion : matchedVersion ,
1524
- bitcodeEnabled : true , sources : sources ,
1525
- overwriteExistingPod : false ) ;
1541
+ if ( matches [ 1 ] . Groups . Count > 2 ) {
1542
+ string matchedName = matches [ 0 ] . Groups [ 1 ] . Captures [ 0 ] . Value ;
1543
+ string matchedPath = matches [ 1 ] . Groups [ 2 ] . Captures [ 0 ] . Value ;
1544
+ Log ( String . Format ( "Preserving Unity Pod: {0}\n at path: {1}" , matchedName ,
1545
+ matchedPath ) , verbose : true ) ;
1546
+
1547
+ AddPodInternal ( matchedName , matchedPath , preformattedVersion : null ,
1548
+ bitcodeEnabled : true , sources : sources ,
1549
+ overwriteExistingPod : false ) ;
1550
+ } else {
1551
+ string matchedName = matches [ 0 ] . Groups [ 1 ] . Captures [ 0 ] . Value ;
1552
+ string matchedVersion = matches [ 1 ] . Groups [ 1 ] . Captures [ 0 ] . Value ;
1553
+ Log ( String . Format ( "Preserving Unity Pod: {0}\n at version: {1}" , matchedName ,
1554
+ matchedVersion ) , verbose : true ) ;
1555
+
1556
+ AddPodInternal ( matchedName , null , preformattedVersion : matchedVersion ,
1557
+ bitcodeEnabled : true , sources : sources ,
1558
+ overwriteExistingPod : false ) ;
1559
+ }
1526
1560
} else {
1527
1561
string matchedName = matches [ 0 ] . Groups [ 1 ] . Captures [ 0 ] . Value ;
1528
1562
Log ( String . Format ( "Preserving Unity Pod: {0}" , matchedName ) , verbose : true ) ;
1529
1563
1530
- AddPodInternal ( matchedName , sources : sources ,
1564
+ AddPodInternal ( matchedName , null , sources : sources ,
1531
1565
overwriteExistingPod : false ) ;
1532
1566
}
1533
1567
}
0 commit comments