-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+ Add support to "podspec" parameter for #452 #453
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,11 +125,15 @@ public static string PropertyDictionaryToString( | |
/// <summary> | ||
/// Get the path of a pod without quotes. If the path isn't present, returns an empty | ||
/// string. | ||
/// This also support "podspecPath" parameters. It will prefer podspecPath parameter over path | ||
/// if present. | ||
/// </summary> | ||
public string LocalPath { | ||
get { | ||
string path; | ||
if (!propertiesByName.TryGetValue("path", out path)) return ""; | ||
if (!propertiesByName.TryGetValue("podspecPath", out path)){ | ||
if (!propertiesByName.TryGetValue("path", out path)) return ""; | ||
} | ||
if (path.StartsWith("'") && path.EndsWith("'")) { | ||
path = path.Substring(1, path.Length - 2); | ||
} | ||
|
@@ -149,7 +153,23 @@ public string PodFilePodLine { | |
var outputPropertiesByName = new Dictionary<string, string>(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)); | ||
} | ||
Comment on lines
+156
to
+172
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it is really nice to check redundancy here but I will leave that responsibility to the person who author I think it is much cleaner for you and your case now to just treat them as separate properties, like this
|
||
} | ||
var propertiesString = PropertyDictionaryToString(outputPropertiesByName); | ||
if (!String.IsNullOrEmpty(propertiesString)) podLine += ", " + propertiesString; | ||
|
@@ -268,15 +288,19 @@ 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", | ||
"modular_headers", | ||
"source", | ||
"subspecs", | ||
"path" | ||
"path", | ||
"podspecPath" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is better to be just |
||
}; | ||
|
||
public IOSXmlDependencies() { | ||
|
@@ -295,6 +319,7 @@ public IOSXmlDependencies() { | |
/// <iosPods> | ||
/// <iosPod name="name" | ||
/// path="pathToLocal" | ||
/// podspecPath="pathToPodSpec" | ||
/// version="versionSpec" | ||
/// bitcodeEnabled="enabled" | ||
/// minTargetSdk="sdk"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned. It is better to have two different properties for
path
andpodspecPath
, and handle them separately later.See the next comment.