Skip to content

Commit 38977de

Browse files
author
Stewart Miles
committed
Merge remote-tracking branch 'origin/master' into merge-upstream
Change-Id: Idd4d5a882a35c2e6422b82b39737a72fe84ed89e
2 parents 4de0916 + 158e321 commit 38977de

File tree

2 files changed

+57
-21
lines changed

2 files changed

+57
-21
lines changed

sample/Assets/PlayServicesResolver/Editor/SampleDependencies.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
<!-- iosPod supports the following attributes:
4040
* "name" (required)
4141
Name of the Cocoapod.
42+
* "path" (optional)
43+
Path to the local Cocoapod.
4244
* "version" (optional)
4345
Cocoapod version specification for the named pod.
4446
If this is not specified the latest version is used.
@@ -47,7 +49,7 @@
4749
generated Xcode project. This is "true" by default.
4850
* "minTargetSdk" (optional)
4951
The minimum iOS SDK required by this Cocoapod. -->
50-
<iosPod name="Google-Mobile-Ads-SDK" version="~> 7.0" bitcodeEnabled="true"
52+
<iosPod name="Google-Mobile-Ads-SDK" path="../google-mobile-ads-sdk" version="~> 7.0" bitcodeEnabled="true"
5153
minTargetSdk="6.0">
5254
<!-- Set of source URIs to search for this Cocoapod spec.
5355
By default Cocoapods will attempt to fetch the pod specs from:

source/IOSResolver/src/IOSResolver.cs

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ private class Pod {
4343
/// </summary>
4444
public string name = null;
4545

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+
4651
/// <summary>
4752
/// This is a preformatted version expression for pod declarations.
4853
///
@@ -88,16 +93,28 @@ private class Pod {
8893
/// </summary>
8994
public bool fromXmlFile = false;
9095

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+
91106
/// <summary>
92107
/// Format a "pod" line for a Podfile.
93108
/// </summary>
94109
public string PodFilePodLine {
95110
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);
99116
}
100-
return String.Format("pod '{0}'{1}", name, versionString);
117+
return String.Format("pod '{0}'{1}", name, versionOrPathString);
101118
}
102119
}
103120

@@ -114,9 +131,10 @@ public string PodFilePodLine {
114131
/// Each source is a URL that is injected in the source section of a Podfile
115132
/// See https://guides.cocoapods.org/syntax/podfile.html#source for the description of
116133
/// a source.</param>
117-
public Pod(string name, string version, bool bitcodeEnabled,
134+
public Pod(string name, string path, string version, bool bitcodeEnabled,
118135
string minTargetSdk, IEnumerable<string> sources) {
119136
this.name = name;
137+
this.path = path;
120138
this.version = version;
121139
this.bitcodeEnabled = bitcodeEnabled;
122140
this.minTargetSdk = minTargetSdk;
@@ -185,6 +203,7 @@ public IOSXmlDependencies() {
185203
/// <dependencies>
186204
/// <iosPods>
187205
/// <iosPod name="name"
206+
/// path="pathToLocal"
188207
/// version="versionSpec"
189208
/// bitcodeEnabled="enabled"
190209
/// minTargetSdk="sdk">
@@ -201,6 +220,7 @@ protected override bool Read(string filename, Logger logger) {
201220
var trueStrings = new HashSet<string> { "true", "1" };
202221
var falseStrings = new HashSet<string> { "false", "0" };
203222
string podName = null;
223+
string localPath = null;
204224
string versionSpec = null;
205225
bool bitcodeEnabled = true;
206226
string minTargetSdk = null;
@@ -217,6 +237,7 @@ protected override bool Read(string filename, Logger logger) {
217237
parentElementName == "iosPods") {
218238
if (isStart) {
219239
podName = reader.GetAttribute("name");
240+
localPath = reader.GetAttribute("path");
220241
versionSpec = reader.GetAttribute("version");
221242
var bitcodeEnabledString =
222243
(reader.GetAttribute("bitcode") ?? "").ToLower();
@@ -232,7 +253,7 @@ protected override bool Read(string filename, Logger logger) {
232253
return false;
233254
}
234255
} else {
235-
AddPodInternal(podName, preformattedVersion: versionSpec,
256+
AddPodInternal(podName, localPath, preformattedVersion: versionSpec,
236257
bitcodeEnabled: bitcodeEnabled,
237258
minTargetSdk: minTargetSdk,
238259
sources: sources,
@@ -398,7 +419,7 @@ protected override bool Read(string filename, Logger logger) {
398419
private static System.Object commandLineDialogLock = new System.Object();
399420

400421
// 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);
402423

403424
// Parses a source URL from a Podfile.
404425
private static Regex PODFILE_SOURCE_REGEX = new Regex(@"^\s*source\s+'([^']*)'");
@@ -876,11 +897,11 @@ private static string PodVersionExpressionFromVersionDep(string dependencyVersio
876897
/// Each source is a URL that is injected in the source section of a Podfile
877898
/// See https://guides.cocoapods.org/syntax/podfile.html#source for the description of
878899
/// 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,
880901
bool bitcodeEnabled = true,
881902
string minTargetSdk = null,
882903
IEnumerable<string> sources = null) {
883-
AddPodInternal(podName, preformattedVersion: PodVersionExpressionFromVersionDep(version),
904+
AddPodInternal(podName, localPath, preformattedVersion: PodVersionExpressionFromVersionDep(version),
884905
bitcodeEnabled: bitcodeEnabled, minTargetSdk: minTargetSdk,
885906
sources: sources);
886907
}
@@ -905,7 +926,9 @@ public static void AddPod(string podName, string version = null,
905926
/// <param name="overwriteExistingPod">Overwrite an existing pod.</param>
906927
/// <param name="createdBy">Tag of the object that added this pod.</param>
907928
/// <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,
909932
bool bitcodeEnabled = true,
910933
string minTargetSdk = null,
911934
IEnumerable<string> sources = null,
@@ -920,7 +943,7 @@ private static void AddPodInternal(string podName, string preformattedVersion =
920943
level: LogLevel.Warning);
921944
return;
922945
}
923-
var pod = new Pod(podName, preformattedVersion, bitcodeEnabled, minTargetSdk, sources);
946+
var pod = new Pod(podName, localPath, preformattedVersion, bitcodeEnabled, minTargetSdk, sources);
924947
pod.createdBy = createdBy ?? pod.createdBy;
925948
pod.fromXmlFile = fromXmlFile;
926949
pods[podName] = pod;
@@ -1515,19 +1538,30 @@ private static void ParseUnityDeps(string unityPodfilePath) {
15151538

15161539
// Add the version as is, if it was present in the original podfile.
15171540
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}\nat 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}\nat 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}\nat version: {1}", matchedName,
1554+
matchedVersion), verbose: true);
1555+
1556+
AddPodInternal(matchedName, null, preformattedVersion: matchedVersion,
1557+
bitcodeEnabled: true, sources: sources,
1558+
overwriteExistingPod: false);
1559+
}
15261560
} else {
15271561
string matchedName = matches[0].Groups[1].Captures[0].Value;
15281562
Log(String.Format("Preserving Unity Pod: {0}", matchedName), verbose: true);
15291563

1530-
AddPodInternal(matchedName, sources: sources,
1564+
AddPodInternal(matchedName, null, sources: sources,
15311565
overwriteExistingPod: false);
15321566
}
15331567
}

0 commit comments

Comments
 (0)