From a97b71d71ef373adb64c5688fa4f00a620189545 Mon Sep 17 00:00:00 2001 From: camphongdinh Date: Wed, 14 Jul 2021 15:59:26 +0700 Subject: [PATCH 1/3] + Add support to "podspec" parameter for #452 --- source/IOSResolver/src/IOSResolver.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/IOSResolver/src/IOSResolver.cs b/source/IOSResolver/src/IOSResolver.cs index 8acd6465..79ea8221 100644 --- a/source/IOSResolver/src/IOSResolver.cs +++ b/source/IOSResolver/src/IOSResolver.cs @@ -125,11 +125,15 @@ public static string PropertyDictionaryToString( /// /// Get the path of a pod without quotes. If the path isn't present, returns an empty /// string. + /// This also support podspec parameters. It will prefer podspec parameter over path + /// if present. /// public string LocalPath { get { string path; - if (!propertiesByName.TryGetValue("path", out path)) return ""; + if (!propertiesByName.TryGetValue("podspec", out path)){ + if (!propertiesByName.TryGetValue("path", out path)) return ""; + } if (path.StartsWith("'") && path.EndsWith("'")) { path = path.Substring(1, path.Length - 2); } @@ -276,7 +280,8 @@ private class IOSXmlDependencies : XmlDependencies { "modular_headers", "source", "subspecs", - "path" + "path", + "podspec" }; public IOSXmlDependencies() { @@ -295,6 +300,7 @@ public IOSXmlDependencies() { /// /// From 81167dffa103beed45ba5f1299623a55d1865fa5 Mon Sep 17 00:00:00 2001 From: camphongdinh Date: Fri, 30 Jul 2021 21:55:42 +0700 Subject: [PATCH 2/3] Update IOSResolver.cs * Rename podspec parameter to podspecPath to avoid conflicts *Support http for podspecPath --- source/IOSResolver/src/IOSResolver.cs | 31 +++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/source/IOSResolver/src/IOSResolver.cs b/source/IOSResolver/src/IOSResolver.cs index 79ea8221..854d3f0d 100644 --- a/source/IOSResolver/src/IOSResolver.cs +++ b/source/IOSResolver/src/IOSResolver.cs @@ -125,13 +125,13 @@ public static string PropertyDictionaryToString( /// /// Get the path of a pod without quotes. If the path isn't present, returns an empty /// string. - /// This also support podspec parameters. It will prefer podspec parameter over path + /// This also support "podspecPath" parameters. It will prefer podspecPath parameter over path /// if present. /// public string LocalPath { get { string path; - if (!propertiesByName.TryGetValue("podspec", out path)){ + if (!propertiesByName.TryGetValue("podspecPath", out path)){ if (!propertiesByName.TryGetValue("path", out path)) return ""; } if (path.StartsWith("'") && path.EndsWith("'")) { @@ -153,7 +153,23 @@ public string PodFilePodLine { var outputPropertiesByName = new Dictionary(propertiesByName); var path = LocalPath; if (!String.IsNullOrEmpty(path)) { - outputPropertiesByName["path"] = String.Format("'{0}'", Path.GetFullPath(path)); + if(outputPropertiesByName.ContainsKey("podspecPath")) { + // Check if it is a local folder or http:// + // If it is local folder add full path into OutputProperties + // If it is URI, kept as-is + if(Uri.IsWellFormedUriString(path, UriKind.Absolute)) { + outputPropertiesByName.Add("podspec", String.Format("'{0}'", path)); + } + else { + outputPropertiesByName.Add("podspec", String.Format("'{0}'", Path.GetFullPath(path))); + } + // Remove "path" parameter and temporary "podspecPath" parameter + outputPropertiesByName.Remove("path"); + outputPropertiesByName.Remove("podspecPath"); + } + else { + outputPropertiesByName["path"] = String.Format("'{0}'", Path.GetFullPath(path)); + } } var propertiesString = PropertyDictionaryToString(outputPropertiesByName); if (!String.IsNullOrEmpty(propertiesString)) podLine += ", " + propertiesString; @@ -272,8 +288,11 @@ private class IOSXmlDependencies : XmlDependencies { // Properties to parse from a XML pod specification and store in the propert1iesByName // dictionary of the Pod class. These are eventually expanded to the named arguments of the // pod declaration in a Podfile. - // The value of each attribute with the exception of "path" is included as-is. + // The value of each attribute with the exception of "path" and "podspecPath" is included as-is. // "path" is converted to a full path on the local filesystem when the Podfile is generated. + // "podspecPath": If the value is a directory it is converted to a full path on the local filesystem when the Podfile is generated. + // If the value is a URI then it is kept as-is. + // "podspecPath" will replace "path" if present private static string[] PODFILE_POD_PROPERTIES = new string[] { "configurations", "configuration", @@ -281,7 +300,7 @@ private class IOSXmlDependencies : XmlDependencies { "source", "subspecs", "path", - "podspec" + "podspecPath" }; public IOSXmlDependencies() { @@ -300,7 +319,7 @@ public IOSXmlDependencies() { /// /// From 62a0aa6cde4ff9c8c29d275eb598700a0a96d1cc Mon Sep 17 00:00:00 2001 From: camphongdinh Date: Fri, 30 Jul 2021 22:04:13 +0700 Subject: [PATCH 3/3] Update IOSResolver.cs - Update comments for podspecPath --- source/IOSResolver/src/IOSResolver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/IOSResolver/src/IOSResolver.cs b/source/IOSResolver/src/IOSResolver.cs index 854d3f0d..e05c04b0 100644 --- a/source/IOSResolver/src/IOSResolver.cs +++ b/source/IOSResolver/src/IOSResolver.cs @@ -319,7 +319,7 @@ public IOSXmlDependencies() { /// ///