Skip to content

Commit

Permalink
ff
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jul 26, 2017
1 parent 060b812 commit 7a5910c
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,17 @@ public string VersionCode {
doc.Root.SetAttributeValue (androidNs + "versionCode", value);
}
}
public string MinimumSdk {
get {
var uses = doc.Root.Element ("uses-sdk");
if (uses?.Attribute (androidNs + "minSdkVersion") == null) {
int minSdkVersion;
if (!int.TryParse (SdkVersionName, out minSdkVersion))
minSdkVersion = 11;
return Math.Min (minSdkVersion, 11).ToString ();
} else {
return uses.Attribute (androidNs + "minSdkVersion").Value;
}
public string GetMinimumSdk () {
var minAttr = doc.Root.Element ("uses-sdk")?.Attribute (androidNs + "minSdkVersion");
if (minAttr == null) {
int minSdkVersion;
if (!int.TryParse (SdkVersionName, out minSdkVersion))
minSdkVersion = 11;
return Math.Min (minSdkVersion, 11).ToString ();
}
return minAttr.Value;
}

TaskLoggingHelper log;

public ManifestDocument (string templateFilename, TaskLoggingHelper log) : base ()
Expand Down Expand Up @@ -877,7 +875,7 @@ public void CalculateVersionCode (string currentAbi, string versionCodePattern,
if (!kvp.ContainsKey ("versionCode"))
kvp.Add ("versionCode", int.Parse (VersionCode));
if (!kvp.ContainsKey ("minSDK")) {
kvp.Add ("minSDK", int.Parse (MinimumSdk));
kvp.Add ("minSDK", int.Parse (GetMinimumSdk ()));
}
var versionCode = String.Empty;
foreach (Match match in regex.Matches (versionCodePattern)) {
Expand Down

0 comments on commit 7a5910c

Please sign in to comment.