From d536c7258071dae427f69667b1d9fe051add2456 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Sat, 10 Feb 2018 15:03:29 +0000 Subject: [PATCH 01/11] [Xamarin.Android.Build.Tasks] Add GetAndroidDependencies Target Fixes #1269 This commit adds the `GetAndroidDependencies` target to the `Xamarin.Android.Common.targets`. Its purpose is to examine the various settings in the project and report which android sdk build-tools, platform-tools etc are required. `GetAndroidDependencies` will output an @(AndroidDependency) with Version metadata Valid component names are platform, build-tool, platform-tool and tool. --- .../Tasks/CalculateProjectDependencies.cs | 57 +++++++++++++++++++ .../Xamarin.Android.Build.Tasks.csproj | 1 + .../Xamarin.Android.Common.targets | 19 +++++++ 3 files changed, 77 insertions(+) create mode 100644 src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs new file mode 100644 index 00000000000..d4d447031e0 --- /dev/null +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Xamarin.Android.Tools; + +namespace Xamarin.Android.Tasks +{ + public class CalculateProjectDependencies : Task + { + const int DefaultMinSDKVersion = 11; + + [Required] + public string TargetFrameworkVersion { get; set; } + + [Required] + public ITaskItem ManifestFile { get; set; } + + [Required] + public string BuildToolsVersion { get; set; } + + public string PlatformToolsVersion { get; set; } + + public string ToolsVersion { get; set; } + + [Output] + public ITaskItem [] Dependencies { get; set; } + + ITaskItem CreateAndroidDependency (string include, string version) + { + if (string.IsNullOrEmpty (version)) + return new TaskItem (include); + + return new TaskItem (include, new Dictionary { + { "Version", version } + }); + } + + public override bool Execute () + { + var dependencies = new List (); + var targetApiLevel = MonoAndroidHelper.SupportedVersions.GetApiLevelFromFrameworkVersion (TargetFrameworkVersion); + var manifest = AndroidAppManifest.Load (ManifestFile.ItemSpec, MonoAndroidHelper.SupportedVersions); + var manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; + dependencies.Add (CreateAndroidDependency ("platform", $"{Math.Max (targetApiLevel.Value, manifestApiLevel)}")); + dependencies.Add (CreateAndroidDependency ("build-tool", BuildToolsVersion)); + if (!string.IsNullOrEmpty (PlatformToolsVersion)) { + dependencies.Add (CreateAndroidDependency ("platform-tool", PlatformToolsVersion)); + } + if (!string.IsNullOrEmpty (ToolsVersion)) { + dependencies.Add (CreateAndroidDependency ("tool", ToolsVersion)); + } + Dependencies = dependencies.ToArray (); + return !Log.HasLoggedErrors; + } + } +} diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj index df83aad5b2a..6c60361d00f 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj @@ -187,6 +187,7 @@ + pdb2mdb\BitAccess.cs diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index f000033f5b6..9a31cf4b1ca 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -32,6 +32,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. + @@ -2767,6 +2768,24 @@ because xbuild doesn't support framework reference assemblies. DependsOnTargets="$(InstallDependsOnTargets)"> + + + + + <_ProjectAndroidManifest>$(ProjectDir)$(AndroidManifest) + + + + + + + From fce561c2797045e16bd65a48a355c74cbbde0cfb Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 10:45:28 +0000 Subject: [PATCH 02/11] Added Unit Tests --- .../Tasks/CalculateProjectDependencies.cs | 5 ++ .../GetDependenciesTests.cs | 69 +++++++++++++++ .../Utilities/MockBuildEngine.cs | 84 +++++++++++++++++++ ...marin.Android.Build.Tests.Shared.projitems | 3 +- .../Xamarin.Android.Common.targets | 1 + 5 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs create mode 100644 src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/MockBuildEngine.cs diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs index d4d447031e0..3a52c3d6af1 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs @@ -23,6 +23,8 @@ public class CalculateProjectDependencies : Task public string ToolsVersion { get; set; } + public string NdkVersion { get; set; } + [Output] public ITaskItem [] Dependencies { get; set; } @@ -50,6 +52,9 @@ public override bool Execute () if (!string.IsNullOrEmpty (ToolsVersion)) { dependencies.Add (CreateAndroidDependency ("tool", ToolsVersion)); } + if (!string.IsNullOrEmpty (NdkVersion)) { + dependencies.Add (CreateAndroidDependency ("ndk-bundle", NdkVersion)); + } Dependencies = dependencies.ToArray (); return !Log.HasLoggedErrors; } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs new file mode 100644 index 00000000000..bf283257114 --- /dev/null +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs @@ -0,0 +1,69 @@ +using System; +using NUnit.Framework; +using Xamarin.ProjectTools; +using System.IO; +using System.Linq; +using Microsoft.Build.Framework; +using System.Text; +using Xamarin.Android.Tasks; +using Microsoft.Build.Utilities; + +namespace Xamarin.Android.Build.Tests { + + [TestFixture] + [Parallelizable (ParallelScope.Children)] + public class GetDependenciesTest : BaseTest { + + [Test] + public void ManifestFileDoesNotExist () + { + IBuildEngine engine = new MockBuildEngine (TestContext.Out); + var task = new CalculateProjectDependencies { + BuildEngine = engine + }; + + task.BuildToolsVersion = "26.0.1"; + task.TargetFrameworkVersion = "v8.0"; + task.ManifestFile = new TaskItem ("AndroidManifest.xml"); + task.Execute (); + Assert.IsNotNull (task.Dependencies); + Assert.AreEqual (4, task.Dependencies.Length); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tool" && x.GetMetadata ("Version") == "26.0.1"), + "Dependencies should contains a build-tool version 26.0.1"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "26"), + "Dependencies should contains a platform version 26"); + } + + [Test] + public void ManifestFileExists () + { + IBuildEngine engine = new MockBuildEngine (TestContext.Out); + var task = new CalculateProjectDependencies { + BuildEngine = engine + }; + + var path = Path.Combine (Root, "temp", TestName); + Directory.CreateDirectory (path); + var manifestFile = Path.Combine (path, "AndroidManifest.xml"); + File.WriteAllText (manifestFile, @" + + +"); + + task.BuildToolsVersion = "26.0.1"; + task.TargetFrameworkVersion = "v8.0"; + task.ManifestFile = new TaskItem (manifestFile); + Assert.IsTrue(task.Execute ()); + Assert.IsNotNull (task.Dependencies); + Assert.AreEqual (5, task.Dependencies.Length); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tool" && x.GetMetadata ("Version") == "26.0.1"), + "Dependencies should contain a build-tool version 26.0.1"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "26"), + "Dependencies should contain a platform version 26"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "10"), + "Dependencies should contain a platform version 10"); + + Directory.Delete (path, recursive: true); + } + } +} diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/MockBuildEngine.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/MockBuildEngine.cs new file mode 100644 index 00000000000..38f36c65d7e --- /dev/null +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/MockBuildEngine.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Build.Framework; + +namespace Xamarin.Android.Build.Tests { + public class MockBuildEngine : IBuildEngine, IBuildEngine2, IBuildEngine3, IBuildEngine4 { + public MockBuildEngine (TextWriter output) + { + this.Output = output; + } + + private TextWriter Output { get; } + + int IBuildEngine.ColumnNumberOfTaskNode => -1; + + bool IBuildEngine.ContinueOnError => false; + + int IBuildEngine.LineNumberOfTaskNode => -1; + + string IBuildEngine.ProjectFileOfTaskNode => "this.xml"; + + bool IBuildEngine2.IsRunningMultipleNodes => false; + + bool IBuildEngine.BuildProjectFile (string projectFileName, string [] targetNames, IDictionary globalProperties, IDictionary targetOutputs) => true; + + void IBuildEngine.LogCustomEvent (CustomBuildEventArgs e) + { + this.Output.WriteLine ($"Custom: {e.Message}"); + } + + void IBuildEngine.LogErrorEvent (BuildErrorEventArgs e) + { + this.Output.WriteLine ($"Error: {e.Message}"); + } + + void IBuildEngine.LogMessageEvent (BuildMessageEventArgs e) + { + this.Output.WriteLine ($"Message: {e.Message}"); + } + + void IBuildEngine.LogWarningEvent (BuildWarningEventArgs e) + { + this.Output.WriteLine ($"Warning: {e.Message}"); + } + + private Dictionary Tasks = new Dictionary (); + + void IBuildEngine4.RegisterTaskObject (object key, object obj, RegisteredTaskObjectLifetime lifetime, bool allowEarlyCollection) + { + Tasks.Add (key, obj); + } + + object IBuildEngine4.GetRegisteredTaskObject (object key, RegisteredTaskObjectLifetime lifetime) + { + return null; + } + + object IBuildEngine4.UnregisterTaskObject (object key, RegisteredTaskObjectLifetime lifetime) + { + var obj = Tasks [key]; + Tasks.Remove (key); + return obj; + } + + BuildEngineResult IBuildEngine3.BuildProjectFilesInParallel (string [] projectFileNames, string [] targetNames, IDictionary [] globalProperties, IList [] removeGlobalProperties, string [] toolsVersion, bool returnTargetOutputs) + { + throw new NotImplementedException (); + } + + void IBuildEngine3.Yield () { } + + void IBuildEngine3.Reacquire () { } + + bool IBuildEngine2.BuildProjectFile (string projectFileName, string [] targetNames, IDictionary globalProperties, IDictionary targetOutputs, string toolsVersion) => true; + + bool IBuildEngine2.BuildProjectFilesInParallel (string [] projectFileNames, string [] targetNames, IDictionary [] globalProperties, IDictionary [] targetOutputsPerProject, string [] toolsVersion, bool useResultsCache, bool unloadProjectsOnCompletion) => true; + } +} diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.Shared.projitems b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.Shared.projitems index fb84fb55378..4caedf0eed4 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.Shared.projitems +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.Shared.projitems @@ -19,8 +19,9 @@ + - \ No newline at end of file + diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 9a31cf4b1ca..8e816b89216 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -2781,6 +2781,7 @@ because xbuild doesn't support framework reference assemblies. BuildToolsVersion="$(AndroidSdkBuildToolsVersion)" PlatformToolsVersion="$(AndroidSdkPlatformToolsVersion)" ToolsVersion="$(AndroidSdkToolsVersion)" + NdkVersion="$(AndroidNdkVersion)" > From 4e751da0662718fd33c9500ad08f84e6965b48fd Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 10:46:33 +0000 Subject: [PATCH 03/11] ff --- .../Xamarin.Android.Build.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj index 9a04c0c8228..45222dd1511 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj @@ -72,5 +72,6 @@ + From ac1ac279b7a54eec60621ab98daa1117990f754a Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 11:20:24 +0000 Subject: [PATCH 04/11] Fixed the tests --- .../Tasks/CalculateProjectDependencies.cs | 9 ++++--- .../GetDependenciesTests.cs | 16 +++++++++--- .../Utilities/BaseTest.cs | 25 +++++++++++++++---- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs index 3a52c3d6af1..68c5ee847d9 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs @@ -41,9 +41,12 @@ ITaskItem CreateAndroidDependency (string include, string version) public override bool Execute () { var dependencies = new List (); - var targetApiLevel = MonoAndroidHelper.SupportedVersions.GetApiLevelFromFrameworkVersion (TargetFrameworkVersion); - var manifest = AndroidAppManifest.Load (ManifestFile.ItemSpec, MonoAndroidHelper.SupportedVersions); - var manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; + var targetApiLevel = MonoAndroidHelper.SupportedVersions.g (TargetFrameworkVersion); + var manifestApiLevel = DefaultMinSDKVersion; + if (File.Exists (ManifestFile.ItemSpec)) { + var manifest = AndroidAppManifest.Load (ManifestFile.ItemSpec, MonoAndroidHelper.SupportedVersions); + var manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; + } dependencies.Add (CreateAndroidDependency ("platform", $"{Math.Max (targetApiLevel.Value, manifestApiLevel)}")); dependencies.Add (CreateAndroidDependency ("build-tool", BuildToolsVersion)); if (!string.IsNullOrEmpty (PlatformToolsVersion)) { diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs index bf283257114..b22d765545d 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs @@ -17,6 +17,11 @@ public class GetDependenciesTest : BaseTest { [Test] public void ManifestFileDoesNotExist () { + var path = Path.Combine ("temp", TestName); + var referencePath = CreateFauxReferencesDirectory (Path.Combine (path, "references"), new ApiInfo[] { + new ApiInfo () { Id = 26, Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, + } ); + MonoAndroidHelper.RefreshSupportedVersions (new string [] { referencePath }); IBuildEngine engine = new MockBuildEngine (TestContext.Out); var task = new CalculateProjectDependencies { BuildEngine = engine @@ -24,8 +29,8 @@ public void ManifestFileDoesNotExist () task.BuildToolsVersion = "26.0.1"; task.TargetFrameworkVersion = "v8.0"; - task.ManifestFile = new TaskItem ("AndroidManifest.xml"); - task.Execute (); + task.ManifestFile = new TaskItem (Path.Combine (path, "AndroidManifest.xml")); + Assert.IsTrue (task.Execute ()); Assert.IsNotNull (task.Dependencies); Assert.AreEqual (4, task.Dependencies.Length); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tool" && x.GetMetadata ("Version") == "26.0.1"), @@ -37,12 +42,17 @@ public void ManifestFileDoesNotExist () [Test] public void ManifestFileExists () { + var path = Path.Combine (Root, "temp", TestName); + var referencePath = CreateFauxReferencesDirectory (Path.Combine (path, "references"), new ApiInfo[] { + new ApiInfo () { Id = 26, Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, + } ); + MonoAndroidHelper.RefreshSupportedVersions (new string [] { referencePath }); IBuildEngine engine = new MockBuildEngine (TestContext.Out); var task = new CalculateProjectDependencies { BuildEngine = engine }; - var path = Path.Combine (Root, "temp", TestName); + Directory.CreateDirectory (path); var manifestFile = Path.Combine (path, "AndroidManifest.xml"); File.WriteAllText (manifestFile, @" diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/BaseTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/BaseTest.cs index d7160c07e37..b951d241601 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/BaseTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/BaseTest.cs @@ -131,14 +131,29 @@ protected string CreateFauxAndroidSdkDirectory (string path, string buildToolsVe return androidSdkDirectory; } - protected string CreateFauxReferencesDirectory (string path, string[] versions) + public struct ApiInfo { + public int Id; + public int Level; + public string Name; + public string FrameworkVersion; + public bool Stable; + } + + protected string CreateFauxReferencesDirectory (string path, ApiInfo [] versions) { + string referencesDirectory = Path.Combine (Root, path); Directory.CreateDirectory (referencesDirectory); - Directory.CreateDirectory (Path.Combine (referencesDirectory, "v1.0")); - File.WriteAllText (Path.Combine (referencesDirectory, "v1.0", "mscorlib.dll"), ""); - foreach (var v in versions){ - Directory.CreateDirectory (Path.Combine (referencesDirectory, v)); + Directory.CreateDirectory (Path.Combine (referencesDirectory, "MonoAndroid", "v1.0")); + File.WriteAllText (Path.Combine (referencesDirectory, "MonoAndroid", "v1.0", "mscorlib.dll"), ""); + foreach (var v in versions) { + Directory.CreateDirectory (Path.Combine (referencesDirectory, "MonoAndroid", v.FrameworkVersion)); + Directory.CreateDirectory (Path.Combine (referencesDirectory, "MonoAndroid", v.FrameworkVersion, "RedistList")); + File.WriteAllText (Path.Combine (referencesDirectory, "MonoAndroid", v.FrameworkVersion, "MonoAndroid.dll"), ""); + File.WriteAllText (Path.Combine (referencesDirectory, "MonoAndroid", v.FrameworkVersion, "AndroidApiInfo.xml"), + $"\n{v.Id}\n{v.Level}\n{v.Name}\n{v.FrameworkVersion}\n{v.Stable}\n"); + File.WriteAllText (Path.Combine (referencesDirectory, "MonoAndroid", v.FrameworkVersion, "RedistList", "FrameworkList.xml"), + $""); } return referencesDirectory; } From f719361170935fc6a4e12f4584917fd90f7e6a6d Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 11:30:49 +0000 Subject: [PATCH 05/11] Fixed the tests --- .../Tasks/CalculateProjectDependencies.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs index 68c5ee847d9..a8aeeecc061 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Collections.Generic; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -41,11 +42,11 @@ ITaskItem CreateAndroidDependency (string include, string version) public override bool Execute () { var dependencies = new List (); - var targetApiLevel = MonoAndroidHelper.SupportedVersions.g (TargetFrameworkVersion); + var targetApiLevel = MonoAndroidHelper.SupportedVersions.GetApiLevelFromFrameworkVersion (TargetFrameworkVersion); var manifestApiLevel = DefaultMinSDKVersion; if (File.Exists (ManifestFile.ItemSpec)) { var manifest = AndroidAppManifest.Load (ManifestFile.ItemSpec, MonoAndroidHelper.SupportedVersions); - var manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; + manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; } dependencies.Add (CreateAndroidDependency ("platform", $"{Math.Max (targetApiLevel.Value, manifestApiLevel)}")); dependencies.Add (CreateAndroidDependency ("build-tool", BuildToolsVersion)); From fe3fda9fc39cf28e529cc96f4a1f911781497b7a Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 11:51:52 +0000 Subject: [PATCH 06/11] ff --- .../Tasks/CalculateProjectDependencies.cs | 8 +++--- .../GetDependenciesTests.cs | 25 +++++++++++-------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs index a8aeeecc061..8ca1e527991 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs @@ -48,13 +48,13 @@ public override bool Execute () var manifest = AndroidAppManifest.Load (ManifestFile.ItemSpec, MonoAndroidHelper.SupportedVersions); manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; } - dependencies.Add (CreateAndroidDependency ("platform", $"{Math.Max (targetApiLevel.Value, manifestApiLevel)}")); - dependencies.Add (CreateAndroidDependency ("build-tool", BuildToolsVersion)); + dependencies.Add (CreateAndroidDependency ("platform", $"android-{Math.Max (targetApiLevel.Value, manifestApiLevel)}")); + dependencies.Add (CreateAndroidDependency ("build-tools", BuildToolsVersion)); if (!string.IsNullOrEmpty (PlatformToolsVersion)) { - dependencies.Add (CreateAndroidDependency ("platform-tool", PlatformToolsVersion)); + dependencies.Add (CreateAndroidDependency ("platform-tools", PlatformToolsVersion)); } if (!string.IsNullOrEmpty (ToolsVersion)) { - dependencies.Add (CreateAndroidDependency ("tool", ToolsVersion)); + dependencies.Add (CreateAndroidDependency ("tools", ToolsVersion)); } if (!string.IsNullOrEmpty (NdkVersion)) { dependencies.Add (CreateAndroidDependency ("ndk-bundle", NdkVersion)); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs index b22d765545d..2d912fbcaaf 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs @@ -27,16 +27,19 @@ public void ManifestFileDoesNotExist () BuildEngine = engine }; + task.PlatformToolsVersion = "26.0.3"; + task.ToolsVersion = "26.0.1"; + task.NdkVersion = "r12d"; task.BuildToolsVersion = "26.0.1"; task.TargetFrameworkVersion = "v8.0"; task.ManifestFile = new TaskItem (Path.Combine (path, "AndroidManifest.xml")); Assert.IsTrue (task.Execute ()); Assert.IsNotNull (task.Dependencies); - Assert.AreEqual (4, task.Dependencies.Length); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tool" && x.GetMetadata ("Version") == "26.0.1"), - "Dependencies should contains a build-tool version 26.0.1"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "26"), - "Dependencies should contains a platform version 26"); + Assert.AreEqual (5, task.Dependencies.Length); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tools" && x.GetMetadata ("Version") == "26.0.1"), + "Dependencies should contains a build-tools version 26.0.1"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "android-26"), + "Dependencies should contains a platform version android-26"); } [Test] @@ -66,12 +69,12 @@ public void ManifestFileExists () Assert.IsTrue(task.Execute ()); Assert.IsNotNull (task.Dependencies); Assert.AreEqual (5, task.Dependencies.Length); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tool" && x.GetMetadata ("Version") == "26.0.1"), - "Dependencies should contain a build-tool version 26.0.1"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "26"), - "Dependencies should contain a platform version 26"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "10"), - "Dependencies should contain a platform version 10"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tools" && x.GetMetadata ("Version") == "26.0.1"), + "Dependencies should contain a build-tools version 26.0.1"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "android-26"), + "Dependencies should contain a platform version android-26"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "android-10"), + "Dependencies should contain a platform version android-10"); Directory.Delete (path, recursive: true); } From 2ecff08b34ab4d6f8eefd4c9c07fbe0b18534b26 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 12:06:18 +0000 Subject: [PATCH 07/11] Updated Tests --- .../GetDependenciesTests.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs index 2d912fbcaaf..2b69c11598b 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs @@ -38,8 +38,14 @@ public void ManifestFileDoesNotExist () Assert.AreEqual (5, task.Dependencies.Length); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tools" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a build-tools version 26.0.1"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "tools" && x.GetMetadata ("Version") == "26.0.1"), + "Dependencies should contains a tools version 26.0.1"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "android-26"), "Dependencies should contains a platform version android-26"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), + "Dependencies should contains a platform-tools version 26.0.3"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "ndk-bundle" && x.GetMetadata ("Version") == "r12d"), + "Dependencies should contains a ndk-bundle version r12d"); } [Test] @@ -63,6 +69,9 @@ public void ManifestFileExists () "); + task.PlatformToolsVersion = "26.0.3"; + task.ToolsVersion = "26.0.1"; + task.NdkVersion = "r12d"; task.BuildToolsVersion = "26.0.1"; task.TargetFrameworkVersion = "v8.0"; task.ManifestFile = new TaskItem (manifestFile); @@ -70,11 +79,15 @@ public void ManifestFileExists () Assert.IsNotNull (task.Dependencies); Assert.AreEqual (5, task.Dependencies.Length); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tools" && x.GetMetadata ("Version") == "26.0.1"), - "Dependencies should contain a build-tools version 26.0.1"); + "Dependencies should contains a build-tools version 26.0.1"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "tools" && x.GetMetadata ("Version") == "26.0.1"), + "Dependencies should contains a tools version 26.0.1"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "android-26"), - "Dependencies should contain a platform version android-26"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "android-10"), - "Dependencies should contain a platform version android-10"); + "Dependencies should contains a platform version android-26"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), + "Dependencies should contains a platform-tools version 26.0.3"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "ndk-bundle" && x.GetMetadata ("Version") == "r12d"), + "Dependencies should contains a ndk-bundle version r12d"); Directory.Delete (path, recursive: true); } From 4312f6db88611e3ecf13d1dc4e694aad7d4588f3 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 12:22:35 +0000 Subject: [PATCH 08/11] fixed platform to be platforms --- .../Tasks/CalculateProjectDependencies.cs | 2 +- .../Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs index 8ca1e527991..09a84129219 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs @@ -48,7 +48,7 @@ public override bool Execute () var manifest = AndroidAppManifest.Load (ManifestFile.ItemSpec, MonoAndroidHelper.SupportedVersions); manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; } - dependencies.Add (CreateAndroidDependency ("platform", $"android-{Math.Max (targetApiLevel.Value, manifestApiLevel)}")); + dependencies.Add (CreateAndroidDependency ("platforms", $"android-{Math.Max (targetApiLevel.Value, manifestApiLevel)}")); dependencies.Add (CreateAndroidDependency ("build-tools", BuildToolsVersion)); if (!string.IsNullOrEmpty (PlatformToolsVersion)) { dependencies.Add (CreateAndroidDependency ("platform-tools", PlatformToolsVersion)); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs index 2b69c11598b..80c7126f77c 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs @@ -40,7 +40,7 @@ public void ManifestFileDoesNotExist () "Dependencies should contains a build-tools version 26.0.1"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "tools" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a tools version 26.0.1"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "android-26"), + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms" && x.GetMetadata ("Version") == "android-26"), "Dependencies should contains a platform version android-26"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), "Dependencies should contains a platform-tools version 26.0.3"); @@ -82,7 +82,7 @@ public void ManifestFileExists () "Dependencies should contains a build-tools version 26.0.1"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "tools" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a tools version 26.0.1"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform" && x.GetMetadata ("Version") == "android-26"), + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms" && x.GetMetadata ("Version") == "android-26"), "Dependencies should contains a platform version android-26"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), "Dependencies should contains a platform-tools version 26.0.3"); From 8785f1fcb7ffd8e5577b56dcb9608ad597c44a7e Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 13:20:12 +0000 Subject: [PATCH 09/11] Fixed metadata --- .../Tasks/CalculateProjectDependencies.cs | 5 +++-- .../Xamarin.Android.Build.Tests/GetDependenciesTests.cs | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs index 09a84129219..f603ae89c56 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs @@ -48,8 +48,9 @@ public override bool Execute () var manifest = AndroidAppManifest.Load (ManifestFile.ItemSpec, MonoAndroidHelper.SupportedVersions); manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; } - dependencies.Add (CreateAndroidDependency ("platforms", $"android-{Math.Max (targetApiLevel.Value, manifestApiLevel)}")); - dependencies.Add (CreateAndroidDependency ("build-tools", BuildToolsVersion)); + var sdkVersion = Math.Max (targetApiLevel.Value, manifestApiLevel); + dependencies.Add (CreateAndroidDependency ($"platforms;android-{sdkVersion}", $"android-{sdkVersion}")); + dependencies.Add (CreateAndroidDependency ($"build-tools;{BuildToolsVersion}", BuildToolsVersion)); if (!string.IsNullOrEmpty (PlatformToolsVersion)) { dependencies.Add (CreateAndroidDependency ("platform-tools", PlatformToolsVersion)); } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs index 80c7126f77c..aad11c47627 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs @@ -36,11 +36,11 @@ public void ManifestFileDoesNotExist () Assert.IsTrue (task.Execute ()); Assert.IsNotNull (task.Dependencies); Assert.AreEqual (5, task.Dependencies.Length); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tools" && x.GetMetadata ("Version") == "26.0.1"), + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tools;26.0.1" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a build-tools version 26.0.1"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "tools" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a tools version 26.0.1"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms" && x.GetMetadata ("Version") == "android-26"), + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms;android-26" && x.GetMetadata ("Version") == "android-26"), "Dependencies should contains a platform version android-26"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), "Dependencies should contains a platform-tools version 26.0.3"); @@ -78,11 +78,11 @@ public void ManifestFileExists () Assert.IsTrue(task.Execute ()); Assert.IsNotNull (task.Dependencies); Assert.AreEqual (5, task.Dependencies.Length); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tools" && x.GetMetadata ("Version") == "26.0.1"), + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "build-tools;26.0.1" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a build-tools version 26.0.1"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "tools" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a tools version 26.0.1"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms" && x.GetMetadata ("Version") == "android-26"), + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms;android-26" && x.GetMetadata ("Version") == "android-26"), "Dependencies should contains a platform version android-26"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), "Dependencies should contains a platform-tools version 26.0.3"); From 5d1770cdeefffd6eab6c30d18be9d6b2d207a092 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 13:33:53 +0000 Subject: [PATCH 10/11] Fixed the platforms output --- .../Tasks/CalculateProjectDependencies.cs | 2 +- .../Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs index f603ae89c56..2fad92a8a01 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/CalculateProjectDependencies.cs @@ -49,7 +49,7 @@ public override bool Execute () manifestApiLevel = manifest.TargetSdkVersion ?? manifest.MinSdkVersion ?? DefaultMinSDKVersion; } var sdkVersion = Math.Max (targetApiLevel.Value, manifestApiLevel); - dependencies.Add (CreateAndroidDependency ($"platforms;android-{sdkVersion}", $"android-{sdkVersion}")); + dependencies.Add (CreateAndroidDependency ($"platforms;android-{sdkVersion}", $"")); dependencies.Add (CreateAndroidDependency ($"build-tools;{BuildToolsVersion}", BuildToolsVersion)); if (!string.IsNullOrEmpty (PlatformToolsVersion)) { dependencies.Add (CreateAndroidDependency ("platform-tools", PlatformToolsVersion)); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs index aad11c47627..2c77750c62a 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs @@ -40,7 +40,7 @@ public void ManifestFileDoesNotExist () "Dependencies should contains a build-tools version 26.0.1"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "tools" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a tools version 26.0.1"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms;android-26" && x.GetMetadata ("Version") == "android-26"), + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms;android-26" && x.GetMetadata ("Version") == ""), "Dependencies should contains a platform version android-26"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), "Dependencies should contains a platform-tools version 26.0.3"); @@ -82,7 +82,7 @@ public void ManifestFileExists () "Dependencies should contains a build-tools version 26.0.1"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "tools" && x.GetMetadata ("Version") == "26.0.1"), "Dependencies should contains a tools version 26.0.1"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms;android-26" && x.GetMetadata ("Version") == "android-26"), + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platforms;android-26" && x.GetMetadata ("Version") == ""), "Dependencies should contains a platform version android-26"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), "Dependencies should contains a platform-tools version 26.0.3"); From 6df41a37b050b0cad65357dbe14e5c8f4ec27d7c Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 12 Feb 2018 14:46:35 +0000 Subject: [PATCH 11/11] Updated to 16.1 --- .../GetDependenciesTests.cs | 12 ++++++------ .../Xamarin.Android.Common.targets | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs index 2c77750c62a..4157009cab2 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs @@ -29,7 +29,7 @@ public void ManifestFileDoesNotExist () task.PlatformToolsVersion = "26.0.3"; task.ToolsVersion = "26.0.1"; - task.NdkVersion = "r12d"; + task.NdkVersion = "12.1"; task.BuildToolsVersion = "26.0.1"; task.TargetFrameworkVersion = "v8.0"; task.ManifestFile = new TaskItem (Path.Combine (path, "AndroidManifest.xml")); @@ -44,8 +44,8 @@ public void ManifestFileDoesNotExist () "Dependencies should contains a platform version android-26"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), "Dependencies should contains a platform-tools version 26.0.3"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "ndk-bundle" && x.GetMetadata ("Version") == "r12d"), - "Dependencies should contains a ndk-bundle version r12d"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "ndk-bundle" && x.GetMetadata ("Version") == "12.1"), + "Dependencies should contains a ndk-bundle version 12.1"); } [Test] @@ -71,7 +71,7 @@ public void ManifestFileExists () task.PlatformToolsVersion = "26.0.3"; task.ToolsVersion = "26.0.1"; - task.NdkVersion = "r12d"; + task.NdkVersion = "12.1"; task.BuildToolsVersion = "26.0.1"; task.TargetFrameworkVersion = "v8.0"; task.ManifestFile = new TaskItem (manifestFile); @@ -86,8 +86,8 @@ public void ManifestFileExists () "Dependencies should contains a platform version android-26"); Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "platform-tools" && x.GetMetadata ("Version") == "26.0.3"), "Dependencies should contains a platform-tools version 26.0.3"); - Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "ndk-bundle" && x.GetMetadata ("Version") == "r12d"), - "Dependencies should contains a ndk-bundle version r12d"); + Assert.IsNotNull (task.Dependencies.FirstOrDefault (x => x.ItemSpec == "ndk-bundle" && x.GetMetadata ("Version") == "12.1"), + "Dependencies should contains a ndk-bundle version 12.1"); Directory.Delete (path, recursive: true); } diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 8e816b89216..2fdca8ab239 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -238,7 +238,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. 27.0.3 27.0.1 26.1.1 - r14b + 16.1 None