diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.OSS.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs
similarity index 91%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.OSS.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs
index 0424914214a..2cbc9bbb932 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.OSS.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs
@@ -72,6 +72,14 @@ public partial class BuildTest : BaseTest
/* embedassebmlies */ true ,
/* expectedResult */ "release",
},
+ new object[] {
+ /* supportedAbi */ new string[] { "armeabi-v7a"},
+ /* debugSymbols */ true ,
+ /* debugType */ "Full",
+ /* optimize */ true ,
+ /* embedassebmlies */ false ,
+ /* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
+ },
new object[] {
/* supportedAbi */ new string[] { "armeabi-v7a"},
/* debugSymbols */ true ,
@@ -102,7 +110,7 @@ public partial class BuildTest : BaseTest
/* debugType */ "",
/* optimize */ true ,
/* embedassebmlies */ false ,
- /* expectedResult */ "release",
+ /* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
},
new object[] {
/* supportedAbi */ new string[] { "armeabi-v7a"},
@@ -126,7 +134,7 @@ public partial class BuildTest : BaseTest
/* debugType */ "",
/* optimize */ null ,
/* embedassebmlies */ null ,
- /* expectedResult */ "release",
+ /* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
},
};
@@ -137,7 +145,7 @@ public partial class BuildTest : BaseTest
/* aotAssemblies */ false,
/* debugSymbols */ true,
/* debugType */ "Full",
- /* embedMdb */ true, // because we don't use FastDev in the OSS repo
+ /* embedMdb */ !CommercialBuildAvailable, // because we don't use FastDev in the OSS repo
/* expectedRuntime */ "debug",
},
new object[] {
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs
index 22bb9b029a1..a40c0c93ba4 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs
@@ -3666,6 +3666,20 @@ public void AssemblyWithMissingTargetFramework ()
FileAssert.Exists (javaStub);
}
}
+
+ [Test]
+ [Category ("Commercial")]
+ public void LibraryProjectsShouldSkipGetPrimaryCpuAbi ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+ const string target = "_GetPrimaryCpuAbi";
+ var proj = new XamarinAndroidLibraryProject ();
+ using (var b = CreateDllBuilder (Path.Combine ("temp", TestName))) {
+ Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
+ Assert.IsTrue (b.Output.IsTargetSkipped (target), $"`{target}` should be skipped!");
+ }
+ }
}
}
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InstallTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InstallTests.cs
new file mode 100644
index 00000000000..f4299d421fa
--- /dev/null
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InstallTests.cs
@@ -0,0 +1,302 @@
+using System;
+using NUnit.Framework;
+using Xamarin.ProjectTools;
+using System.IO;
+using System.Linq;
+using Microsoft.Build.Framework;
+using System.Text;
+using System.Xml.Linq;
+
+namespace Xamarin.Android.Build.Tests
+{
+ [TestFixture]
+ [NonParallelizable] //These tests deploy to devices
+ [Category ("Commercial")]
+ public class InstallTests : BaseTest
+ {
+ [Test]
+ public void ReInstallIfUserUninstalled ([Values (false, true)] bool isRelease)
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test Skipped no devices or emulators found.");
+ }
+
+ var proj = new XamarinAndroidApplicationProject () {
+ IsRelease = isRelease,
+ };
+ if (isRelease) {
+ var abis = new string [] { "armeabi-v7a", "x86" };
+ proj.SetProperty (KnownProperties.AndroidSupportedAbis, string.Join (";", abis));
+ }
+ using (var builder = CreateApkBuilder (Path.Combine ("temp", TestContext.CurrentContext.Test.Name))) {
+ builder.Verbosity = LoggerVerbosity.Diagnostic;
+ Assert.IsTrue (builder.Build (proj));
+ Assert.IsTrue (builder.Install (proj));
+ Assert.AreEqual ($"package:{proj.PackageName}", RunAdbCommand ($"shell pm list packages {proj.PackageName}").Trim (),
+ $"{proj.PackageName} is not installed on the device.");
+ Assert.AreEqual ("Success", RunAdbCommand ($"uninstall {proj.PackageName}").Trim (), $"{proj.PackageName} was not uninstalled.");
+ Assert.IsTrue (builder.Install (proj));
+ Assert.AreEqual ($"package:{proj.PackageName}", RunAdbCommand ($"shell pm list packages {proj.PackageName}").Trim (),
+ $"{proj.PackageName} is not installed on the device.");
+ }
+ }
+
+ [Test]
+ public void InstallAndUnInstall ([Values (false, true)] bool isRelease)
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test Skipped no devices or emulators found.");
+ }
+
+ var proj = new XamarinAndroidApplicationProject () {
+ IsRelease = isRelease,
+ };
+ if (isRelease) {
+ var abis = new string [] { "armeabi-v7a", "x86" };
+ proj.SetProperty (KnownProperties.AndroidSupportedAbis, string.Join (";", abis));
+ }
+ using (var builder = CreateApkBuilder (Path.Combine ("temp", TestContext.CurrentContext.Test.Name))) {
+ builder.Verbosity = LoggerVerbosity.Diagnostic;
+ Assert.IsTrue (builder.Build (proj));
+ Assert.IsTrue (builder.Install (proj));
+ Assert.AreEqual ($"package:{proj.PackageName}", RunAdbCommand ($"shell pm list packages {proj.PackageName}").Trim (),
+ $"{proj.PackageName} is not installed on the device.");
+
+ var overrideDirs = new string [] {
+ $"/storage/emulated/0/Android/data/{proj.PackageName}/files/.__override__",
+ $"/mnt/shell/emulated/0/Android/data/{proj.PackageName}/files/.__override__",
+ $"/storage/sdcard/Android/data/{proj.PackageName}/files/.__override__",
+ };
+ var directorylist = string.Empty;
+ foreach (var dir in overrideDirs) {
+ var listing = RunAdbCommand ($"shell ls {dir}");
+ if (!listing.Contains ("No such file or directory"))
+ directorylist += listing;
+ }
+ if (!isRelease) {
+ StringAssert.Contains ($"{proj.AssemblyName}", directorylist, $"{proj.AssemblyName} not found in fastdev directory.");
+ }
+ else {
+ StringAssert.IsMatch ("", directorylist.Trim (), "fastdev directory should NOT exist for Release builds.");
+ }
+
+ Assert.IsTrue (builder.Uninstall (proj));
+ Assert.AreNotEqual ($"package:{proj.PackageName}", RunAdbCommand ($"shell pm list packages {proj.PackageName}").Trim (),
+ $"{proj.PackageName} is installed on the device.");
+ }
+ }
+
+ [Test]
+ public void SwitchConfigurationsShouldRedeploy ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test Skipped no devices or emulators found.");
+ }
+
+ var proj = new XamarinAndroidApplicationProject () {
+ IsRelease = false,
+ };
+ var abis = new string [] { "armeabi-v7a", "x86" };
+ proj.SetProperty (KnownProperties.AndroidSupportedAbis, string.Join (";", abis));
+ using (var builder = CreateApkBuilder (Path.Combine ("temp", TestContext.CurrentContext.Test.Name))) {
+ builder.Verbosity = LoggerVerbosity.Diagnostic;
+ Assert.IsTrue (builder.Build (proj));
+ Assert.IsTrue (builder.Install (proj));
+ Assert.AreEqual ($"package:{proj.PackageName}", RunAdbCommand ($"shell pm list packages {proj.PackageName}").Trim (),
+ $"{proj.PackageName} is not installed on the device.");
+
+ var overrideDirs = new string [] {
+ $"/storage/emulated/0/Android/data/{proj.PackageName}/files/.__override__",
+ $"/mnt/shell/emulated/0/Android/data/{proj.PackageName}/files/.__override__",
+ $"/storage/sdcard/Android/data/{proj.PackageName}/files/.__override__",
+ };
+ var directorylist = string.Empty;
+ foreach (var dir in overrideDirs) {
+ var listing = RunAdbCommand ($"shell ls {dir}");
+ if (!listing.Contains ("No such file or directory"))
+ directorylist += listing;
+ }
+ StringAssert.Contains ($"{proj.AssemblyName}", directorylist, $"{proj.AssemblyName} not found in fastdev directory.");
+
+ proj.IsRelease = true;
+ Assert.IsTrue (builder.Build (proj));
+ Assert.IsTrue (builder.Install (proj));
+ Assert.AreEqual ($"package:{proj.PackageName}", RunAdbCommand ($"shell pm list packages {proj.PackageName}").Trim (),
+ $"{proj.PackageName} is not installed on the device.");
+
+ directorylist = string.Empty;
+ foreach (var dir in overrideDirs) {
+ var listing = RunAdbCommand ($"shell ls {dir}");
+ if (!listing.Contains ("No such file or directory"))
+ directorylist += listing;
+ }
+ StringAssert.IsMatch ("", directorylist.Trim (), "fastdev directory should NOT exist for Release builds.");
+
+ proj.IsRelease = false;
+ Assert.IsTrue (builder.Build (proj));
+ Assert.IsTrue (builder.Install (proj));
+ Assert.AreEqual ($"package:{proj.PackageName}", RunAdbCommand ($"shell pm list packages {proj.PackageName}").Trim (),
+ $"{proj.PackageName} is not installed on the device.");
+ directorylist = string.Empty;
+ foreach (var dir in overrideDirs) {
+ var listing = RunAdbCommand ($"shell ls {dir}");
+ if (!listing.Contains ("No such file or directory"))
+ directorylist += listing;
+ }
+ StringAssert.Contains ($"{proj.AssemblyName}", directorylist, $"{proj.AssemblyName} not found in fastdev directory.");
+
+ Assert.IsTrue (builder.Uninstall (proj));
+ Assert.AreNotEqual ($"package:{proj.PackageName}", RunAdbCommand ($"shell pm list packages {proj.PackageName}").Trim (),
+ $"{proj.PackageName} is installed on the device.");
+ }
+ }
+
+ [Test]
+ public void InstallWithoutSharedRuntime ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test Skipped no devices or emulators found.");
+ }
+
+ var proj = new XamarinAndroidApplicationProject () {
+ IsRelease = true,
+ };
+ proj.SetProperty (proj.ReleaseProperties, "Optimize", false);
+ proj.SetProperty (proj.ReleaseProperties, "DebugType", "none");
+ proj.SetProperty (proj.ReleaseProperties, "AndroidUseSharedRuntime", false);
+ proj.RemoveProperty (proj.ReleaseProperties, "EmbedAssembliesIntoApk");
+ var abis = new string [] { "armeabi-v7a", "x86" };
+ proj.SetProperty (KnownProperties.AndroidSupportedAbis, string.Join (";", abis));
+ using (var builder = CreateApkBuilder (Path.Combine ("temp", TestContext.CurrentContext.Test.Name), false, false)) {
+ builder.Verbosity = LoggerVerbosity.Diagnostic;
+ if (RunAdbCommand ("shell pm list packages Mono.Android.DebugRuntime").Trim ().Length != 0)
+ RunAdbCommand ("uninstall Mono.Android.DebugRuntime");
+ Assert.IsTrue (builder.Install (proj));
+ var runtimeInfo = builder.GetSupportedRuntimes ();
+ var apkPath = Path.Combine (Root, builder.ProjectDirectory,
+ proj.IntermediateOutputPath, "android", "bin", "UnnamedProject.UnnamedProject.apk");
+ using (var apk = ZipHelper.OpenZip (apkPath)) {
+ foreach (var abi in abis) {
+ var runtime = runtimeInfo.FirstOrDefault (x => x.Abi == abi && x.Runtime == "debug");
+ Assert.IsNotNull (runtime, "Could not find the expected runtime.");
+ var inApk = ZipHelper.ReadFileFromZip (apk, String.Format ("lib/{0}/{1}", abi, runtime.Name));
+ var inApkRuntime = runtimeInfo.FirstOrDefault (x => x.Abi == abi && x.Size == inApk.Length);
+ Assert.IsNotNull (inApkRuntime, "Could not find the actual runtime used.");
+ Assert.AreEqual (runtime.Size, inApkRuntime.Size, "expected {0} got {1}", "debug", inApkRuntime.Runtime);
+ }
+ }
+ //FIXME: https://github.com/xamarin/androidtools/issues/141
+ //Assert.AreEqual (0, RunAdbCommand ("shell pm list packages Mono.Android.DebugRuntime").Trim ().Length,
+ // "The Shared Runtime should not have been installed.");
+ var overrideDirs = new string [] {
+ $"/data/data/{proj.PackageName}/files/.__override__",
+ $"/storage/emulated/0/Android/data/{proj.PackageName}/files/.__override__",
+ $"/mnt/shell/emulated/0/Android/data/{proj.PackageName}/files/.__override__",
+ $"/storage/sdcard/Android/data/{proj.PackageName}/files/.__override__",
+ };
+ var directorylist = string.Empty;
+ foreach (var dir in overrideDirs) {
+ var listing = RunAdbCommand ($"shell ls {dir}");
+ if (!listing.Contains ("No such file or directory"))
+ directorylist += listing;
+ }
+ StringAssert.Contains ($"{proj.ProjectName}.dll", directorylist, $"{proj.ProjectName}.dll should exist in the .__override__ directory.");
+ StringAssert.Contains ($"System.dll", directorylist, $"System.dll should exist in the .__override__ directory.");
+ StringAssert.Contains ($"Mono.Android.dll", directorylist, $"Mono.Android.dll should exist in the .__override__ directory.");
+
+ }
+ }
+
+ [Test]
+ public void InstallErrorCode ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test Skipped no devices or emulators found.");
+ }
+
+ //Setup a situation where we get INSTALL_FAILED_NO_MATCHING_ABIS
+ var abi = "armeabi-v7a";
+ var proj = new XamarinAndroidApplicationProject ();
+ proj.SetProperty (proj.DebugProperties, "AndroidUseSharedRuntime", false);
+ proj.SetProperty (proj.DebugProperties, "EmbedAssembliesIntoApk", true);
+ proj.SetProperty (proj.DebugProperties, KnownProperties.AndroidSupportedAbis, abi);
+
+ using (var builder = CreateApkBuilder (Path.Combine ("temp", TestContext.CurrentContext.Test.Name))) {
+ builder.ThrowOnBuildFailure = false;
+ if (!builder.Install (proj)) {
+ Assert.IsTrue (StringAssertEx.ContainsText (builder.LastBuildOutput, "ADB0020"), "Should receive ADB0020 error code.");
+ } else {
+ Assert.Ignore ($"Install should have failed, but we might have an {abi} emulator attached.");
+ }
+ }
+ }
+
+ [Test]
+ public void ToggleFastDev ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test Skipped no devices or emulators found.");
+ }
+
+ var proj = new XamarinAndroidApplicationProject ();
+ proj.SetProperty (proj.DebugProperties, "AndroidUseSharedRuntime", true);
+ proj.SetProperty (proj.DebugProperties, "EmbedAssembliesIntoApk", false);
+
+ using (var builder = CreateApkBuilder (Path.Combine ("temp", TestContext.CurrentContext.Test.Name))) {
+ Assert.IsTrue (builder.Install (proj), "Install should have succeeded.");
+
+ var overrideDirs = new string [] {
+ $"/data/data/{proj.PackageName}/files/.__override__",
+ $"/storage/emulated/0/Android/data/{proj.PackageName}/files/.__override__",
+ $"/mnt/shell/emulated/0/Android/data/{proj.PackageName}/files/.__override__",
+ $"/storage/sdcard/Android/data/{proj.PackageName}/files/.__override__",
+ };
+ var directorylist = string.Empty;
+ foreach (var dir in overrideDirs) {
+ var listing = RunAdbCommand ($"shell ls {dir}");
+ if (!listing.Contains ("No such file or directory"))
+ directorylist += listing;
+ }
+ StringAssert.Contains ($"{proj.ProjectName}.dll", directorylist, $"{proj.ProjectName}.dll should exist in the .__override__ directory.");
+
+ //Now toggle FastDev to OFF
+ proj.SetProperty (proj.DebugProperties, "AndroidUseSharedRuntime", false);
+ proj.SetProperty (proj.DebugProperties, "EmbedAssembliesIntoApk", true);
+ var abis = new string [] { "armeabi-v7a", "x86" };
+ proj.SetProperty (KnownProperties.AndroidSupportedAbis, string.Join (";", abis));
+
+ Assert.IsTrue (builder.Install (proj), "Second install should have succeeded.");
+
+ directorylist = string.Empty;
+ foreach (var dir in overrideDirs) {
+ var listing = RunAdbCommand ($"shell ls {dir}");
+ if (!listing.Contains ("No such file or directory"))
+ directorylist += listing;
+ }
+
+ Assert.AreEqual ("", directorylist, "There should be no files in Fast Dev directories! Instead found: " + directorylist);
+
+ //Deploy one last time to verify install still works without the .__override__ directory existing
+ Assert.IsTrue (builder.Install (proj), "Third install should have succeeded.");
+ }
+ }
+ }
+}
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InstantRunTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InstantRunTest.cs
new file mode 100644
index 00000000000..076a7674fd4
--- /dev/null
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InstantRunTest.cs
@@ -0,0 +1,367 @@
+using System;
+using System.IO;
+using System.Linq;
+using NUnit.Framework;
+using Xamarin.ProjectTools;
+
+namespace Xamarin.Android.Build.Tests
+{
+ [TestFixture]
+ [NonParallelizable] //These tests deploy to devices
+ [Category ("Commercial")]
+ public class InstantRunTest : BaseTest
+ {
+ [Test]
+ public void InstantRunSimpleBuild ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test needs a device attached.");
+ return;
+ }
+
+ var proj = new XamarinAndroidApplicationProject () { AndroidFastDeploymentType = "Assemblies:Dexes", UseLatestPlatformSdk = true };
+ var b = CreateApkBuilder ("temp/InstantRunSimpleBuild");
+ Assert.IsTrue (b.Clean (proj), "Clean should have succeeded.");
+ Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
+
+ var manifest = b.Output.GetIntermediaryAsText (BuildOutputFiles.AndroidManifest);
+ Assert.IsTrue (File.Exists (b.Output.GetIntermediaryPath ("android/bin/dex/mono.android.dex")), "there should be mono.android.dex in the intermediaries.");
+
+ using (var apk = ((AndroidApplicationBuildOutput) b.Output).OpenApk ()) {
+ // 30000 is just to ensure that classes.dex contains minimum set of types, like, doesn't contain mono.android.jar classes.
+ var dex = apk.GetRaw (ApkContents.ClassesDex);
+ Assert.IsTrue (dex.Length < 30000, "classes.dex is unexpectedly big ({0} bytes). It likely contains extraneous code.", dex.Length);
+ }
+
+ b.Dispose ();
+ }
+
+ [Test]
+ public void TargetsSkipped ([Values(false, true)] bool useManagedResourceGenerator)
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test needs a device attached.");
+ return;
+ }
+
+ var proj = new XamarinAndroidApplicationProject () { AndroidFastDeploymentType = "Assemblies:Dexes", UseLatestPlatformSdk = true };
+ proj.SetProperty ("AndroidUseManagedDesignTimeResourceGenerator", useManagedResourceGenerator.ToString ());
+ var b = CreateApkBuilder ($"temp/InstantRunTargetsSkipped_{useManagedResourceGenerator}", cleanupOnDispose: false);
+ Assert.IsTrue (b.Build (proj), "1 build should have succeeded.");
+
+ // unchanged build
+ Assert.IsTrue (b.Build (proj, true, null, false), "2 build should have succeeded.");
+ // _UpdateAndroidResgen should not be built.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("_UpdateAndroidResgen"), "2 _UpdateAndroidResgen was not skipped");
+ // CoreCompile should not be built.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("CoreCompile"), "2 CoreCompile was not skipped");
+ // _CompileToDalvikWithDx should not be built either.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("_CompileToDalvikWithDx"), "2 _CompileToDalvikWithDx was not skipped");
+
+ // make insignificant changes in C# code and build
+ proj.MainActivity = proj.DefaultMainActivity + "// extra";
+ proj.Touch ("MainActivity.cs");
+ Assert.IsTrue (b.Build (proj, true, null, false), "3 build should have succeeded.");
+ // _UpdateAndroidResgen should not be built.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("_UpdateAndroidResgen"), "3 _UpdateAndroidResgen was not skipped");
+ // CoreCompile should be built.
+ Assert.IsTrue (!b.Output.IsTargetSkipped ("CoreCompile"), "3 CoreCompile was skipped");
+ // _CompileToDalvikWithDx should not be built either.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("_CompileToDalvikWithDx"), "3 _CompileToDalvikWithDx was not skipped");
+
+ // make significant changes (but doesn't impact Resource.Designer.cs) in layout XML resource and build
+ proj.LayoutMain = proj.LayoutMain.Replace ("LinearLayout", "RelativeLayout"); // without this, resource designer .cs will be identical and further tasks will be skipped.
+ proj.Touch ("Resources\\layout\\Main.axml");
+ Assert.IsTrue (b.Build (proj, true, null, false), "4 build should have succeeded.");
+ // _UpdateAndroidResgen should be built.
+ Assert.IsTrue (!b.Output.IsTargetSkipped ("_UpdateAndroidResgen"), "4 _UpdateAndroidResgen was skipped");
+ // CoreCompile should not be built.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("CoreCompile"), "4 CoreCompile was not skipped");
+ // _CompileToDalvikWithDx should not be built either.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("_CompileToDalvikWithDx"), "4 _CompileToDalvikWithDx was not skipped");
+
+ // make significant changes (but doesn't impact Resource.Designer.cs) in layout XML resource,
+ // then call AndroidUpdateResource, then build (which is what our IDEs do).
+ proj.LayoutMain = proj.LayoutMain.Replace ("RelativeLayout", "LinearLayout"); // change it again
+ proj.Touch ("Resources\\layout\\Main.axml");
+ b.Target = "Compile";
+ var designTimeParams = new string [] { "BuildingInsideVisualStudio=true", "BuildProject=false" };
+ Assert.IsTrue (b.Build (proj, true, designTimeParams, false), "5 update resources should have succeeded.");
+ // _UpdateAndroidResgen should be built.
+ if (useManagedResourceGenerator)
+ Assert.IsTrue (!b.Output.IsTargetSkipped ("_ManagedUpdateAndroidResgen"), $"5 first _ManagedUpdateAndroidResgen was skipped");
+ else
+ Assert.IsTrue (!b.Output.IsTargetSkipped ("_UpdateAndroidResgen"), $"5 first _UpdateAndroidResgen was skipped");
+ b.Target = "Build";
+ Assert.IsTrue (b.Build (proj, true, null, false), "5 build should have succeeded.");
+ // _UpdateAndroidResgen should not be built.
+ if (useManagedResourceGenerator) {
+ Assert.IsFalse (b.Output.IsTargetSkipped ("_UpdateAndroidResgen"), "5 second _UpdateAndroidResgen was skipped");
+ // CoreCompile should be built.
+ Assert.AreEqual (!b.RunningMSBuild, b.Output.IsTargetSkipped ("CoreCompile"), "5 CoreCompile was skipped");
+ } else {
+ Assert.IsTrue (b.Output.IsTargetSkipped ("_UpdateAndroidResgen"), "5 second _UpdateAndroidResgen was not skipped");
+ // CoreCompile should not be built.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("CoreCompile"), "5 CoreCompile was not skipped");
+ }
+
+ // _CompileToDalvikWithDx should not be built either.
+ Assert.IsTrue (b.Output.IsTargetSkipped ("_CompileToDalvikWithDx"), "5 _CompileToDalvikWithDx should be skipped");
+
+ b.Dispose ();
+ }
+
+ [Test]
+ public void SimpleInstallAndUninstall ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices)
+ return;
+
+ var proj = new XamarinAndroidApplicationProject () { AndroidFastDeploymentType = "Assemblies:Dexes", UseLatestPlatformSdk = true };
+ proj.SetDefaultTargetDevice ();
+ var b = CreateApkBuilder ("temp/InstantRunSimpleInstallAndUninstall");
+ Assert.IsTrue (b.Install (proj), "install should have succeeded.");
+ Assert.IsTrue (b.Uninstall (proj), "uninstall should have succeeded.");
+ b.Dispose ();
+ }
+
+ [Test]
+ public void SkipFastDevAlreadyInstalledFile ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices)
+ return;
+
+ var proj = new XamarinAndroidApplicationProject () { AndroidFastDeploymentType = "Assemblies:Dexes", UseLatestPlatformSdk = true };
+ proj.SetDefaultTargetDevice ();
+ proj.Packages.Add (KnownPackages.AndroidSupportV4_22_1_1_1);
+ proj.Packages.Add (KnownPackages.SupportV7AppCompat_22_1_1_1);
+ proj.MainActivity = proj.DefaultMainActivity.Replace (": Activity", ": Android.Support.V7.App.AppCompatActivity");
+ var b = CreateApkBuilder ("temp/SkipFastDevAlreadyInstalledFile");
+ Assert.IsTrue (b.Install (proj), "install should have succeeded.");
+ File.WriteAllLines (Path.Combine (Root, b.ProjectDirectory, b.BuildLogFile + ".bak"), b.LastBuildOutput);
+
+ // slightly (but significantly) modify the sources that causes dll changes.
+ proj.MainActivity = proj.MainActivity.Replace ("clicks", "CLICKS");
+ proj.Touch ("MainActivity.cs");
+ // make sure that the fastdev log tells that the relevant dll is updated but NOT for others.
+ Assert.IsTrue (b.Install (proj, doNotCleanupOnUpdate: true, saveProject: false), "install should have succeeded.");
+ Assert.IsFalse (b.Output.IsApkInstalled, "app apk was installed");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("UnnamedProject.dll") && l.Contains ("NotifySync CopyFile")), "app dll not uploaded");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("Xamarin.Android.Support.v4.dll") && l.Contains ("NotifySync SkipCopyFile")), "v4 should be skipped, but no relevant log line");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("Xamarin.Android.Support.v7.AppCompat.dll") && l.Contains ("NotifySync SkipCopyFile")), "v7 should be skipped, but no relevant log line");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("packaged_resources") && l.Contains ("NotifySync SkipCopyFile")), "packaged_resources should be skipped, but no relevant log line");
+
+ Assert.IsTrue (b.Uninstall (proj), "uninstall should have succeeded.");
+ b.Dispose ();
+ }
+
+ #pragma warning disable 414
+ static object [] SkipFastDevAlreadyInstalledResourcesSource = new object [] {
+ new object[] { new Package [0], null },
+ new object[] { new Package [] { KnownPackages.AndroidSupportV4_22_1_1_1, KnownPackages.SupportV7AppCompat_22_1_1_1}, "Android.Support.V7.App.AppCompatActivity" },
+ };
+ #pragma warning restore 414
+
+ [Test]
+ [TestCaseSource ("SkipFastDevAlreadyInstalledResourcesSource")] // test for both cases that there is external resources or there are some.
+ public void SkipFastDevAlreadyInstalledResources (Package [] packages, string baseActivityClass)
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices)
+ return;
+
+ var proj = new XamarinAndroidApplicationProject () { AndroidFastDeploymentType = "Assemblies:Dexes", UseLatestPlatformSdk = true };
+ proj.SetDefaultTargetDevice ();
+ foreach (var pkg in packages)
+ proj.Packages.Add (pkg);
+ if (baseActivityClass != null)
+ proj.MainActivity = proj.DefaultMainActivity.Replace (": Activity", ": " + baseActivityClass);
+ var b = CreateApkBuilder ("temp/SkipFastDevAlreadyInstalledResources");
+ Assert.IsTrue (b.Install (proj), "install should have succeeded.");
+
+ // slightly (but significantly) modify the resources that causes packaged_resources changes.
+ proj.LayoutMain = proj.LayoutMain.Replace ("LinearLayout", "RelativeLayout");
+ proj.Touch ("Resources\\Layout\\Main.axml");
+ Assert.IsTrue (b.Install (proj, doNotCleanupOnUpdate: true, saveProject: false), "install should have succeeded.");
+ Assert.IsFalse (b.Output.IsApkInstalled, "app apk was installed");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("packaged_resources") && l.Contains ("NotifySync CopyFile")), "packaged_resources not uploaded");
+
+ var axml = System.Text.Encoding.UTF8.GetString (ZipHelper.ReadFileFromZip (b.Output.GetIntermediaryPath (Path.Combine ("android", "bin", "packaged_resources")), "res/layout/main.xml"));
+ Assert.IsTrue (axml.Contains ("RelativeLayout"), "The packaged resources seem to be out of sync.");
+
+ Assert.IsTrue (b.Uninstall (proj), "uninstall should have succeeded.");
+ b.Dispose ();
+ }
+
+ [Test]
+ public void InstantRunResourceChange ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test needs a device attached.");
+ return;
+ }
+ var proj = new XamarinAndroidApplicationProject () {
+ AndroidFastDeploymentType = "Assemblies:Dexes",
+ UseLatestPlatformSdk = true,
+ };
+ proj.SetDefaultTargetDevice ();
+ using (var b = CreateApkBuilder (Path.Combine (Root, "temp/InstantRunResourceChange"), false, false)) {
+ Assert.IsTrue (b.Install (proj), "install should have succeeded. 0");
+ var logLines = b.LastBuildOutput;
+ Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_BuildApkFastDev\" completely.") ||
+ l.Contains ("Target _BuildApkFastDev needs to be built")),
+ "Apk should have been built");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("packaged_resources")), "packaged_resources should have been uploaded");
+
+ var layout = proj.AndroidResources.First (x => x.Include () == "Resources\\layout\\Main.axml");
+ layout.Timestamp = DateTime.UtcNow;
+ Assert.IsTrue (b.Install (proj, doNotCleanupOnUpdate: true, saveProject: false), "install should have succeeded. 1");
+ logLines = b.LastBuildOutput;
+ Assert.IsFalse (logLines.Any (l => l.Contains ("Building target \"_BuildApkFastDev\" completely.") ||
+ l.Contains ("Target _BuildApkFastDev needs to be built")),
+ "Apk should not have been built");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("packaged_resources")), "packaged_resources should have been uploaded");
+ }
+ }
+
+ [Test]
+ public void InstantRunFastDevTypemaps ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test needs a device attached.");
+ return;
+ }
+ var proj = new XamarinAndroidApplicationProject () {
+ AndroidFastDeploymentType = "Assemblies:Dexes",
+ UseLatestPlatformSdk = true,
+ };
+ proj.SetDefaultTargetDevice ();
+ using (var b = CreateApkBuilder (Path.Combine (Root, "temp/InstantRunFastDevTypemaps"), false, false)) {
+ Assert.IsTrue (b.Install (proj), "packaging should have succeeded. 0");
+ var apk = Path.Combine (Root, b.ProjectDirectory,
+ proj.IntermediateOutputPath, "android", "bin", "UnnamedProject.UnnamedProject.apk");
+ Assert.IsNull (ZipHelper.ReadFileFromZip (apk, "typemap.jm"), $"typemap.jm should NOT be in {apk}.");
+ Assert.IsNull (ZipHelper.ReadFileFromZip (apk, "typemap.mj"), $"typemap.mj should NOT be in {apk}.");
+ var logLines = b.LastBuildOutput;
+ Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_BuildApkFastDev\" completely.") ||
+ l.Contains ("Target _BuildApkFastDev needs to be built")),
+ "Apk should have been built");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("typemap.jm")), "typemap.jm should have been uploaded");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("typemap.mj")), "typemap.mj should have been uploaded");
+ }
+ }
+
+ [Test]
+ public void InstantRunNativeLibrary ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test needs a device attached.");
+ return;
+ }
+ var nativeLib = new AndroidItem.AndroidNativeLibrary ("foo\\x86\\libtest.so") {
+ BinaryContent = () => new byte [10],
+ MetadataValues = "Link=libs\\x86\\libtest.so",
+ };
+ var proj = new XamarinAndroidApplicationProject () {
+ AndroidFastDeploymentType = "Assemblies:Dexes",
+ UseLatestPlatformSdk = true,
+ OtherBuildItems = {
+ nativeLib,
+ },
+ };
+ proj.SetDefaultTargetDevice ();
+ using (var b = CreateApkBuilder (Path.Combine (Root, "temp/InstantRunNativeLibrary"), false, false)) {
+ Assert.IsTrue (b.Install (proj), "install should have succeeded. 0");
+ var logLines = b.LastBuildOutput;
+ Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_BuildApkFastDev\" completely.") ||
+ l.Contains ("Target _BuildApkFastDev needs to be built")),
+ "Apk should have been built");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("libtest.so")), "libtest.so should have been uploaded");
+
+ nativeLib.BinaryContent = () => new byte [20];
+ nativeLib.Timestamp = DateTime.UtcNow.AddSeconds(1);
+ Assert.IsTrue (b.Install (proj, doNotCleanupOnUpdate: true, saveProject: false), "install should have succeeded. 1");
+ logLines = b.LastBuildOutput;
+ Assert.IsFalse (logLines.Any (l => l.Contains ("Building target \"_BuildApkFastDev\" completely.") ||
+ l.Contains ("Target _BuildApkFastDev needs to be built")),
+ "Apk should not have been built");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
+ Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("libtest.so")), "libtest.so should have been uploaded");
+ }
+ }
+
+ [Test]
+ public void DisableInstantRunWhenAndroidManifestHasChanged ()
+ {
+ if (!CommercialBuildAvailable)
+ Assert.Ignore ("Not required on Open Source Builds");
+
+ if (!HasDevices) {
+ Assert.Ignore ("Test needs a device attached.");
+ return;
+ }
+
+ var proj = new XamarinAndroidApplicationProject () { AndroidFastDeploymentType = "Assemblies:Dexes", UseLatestPlatformSdk = true };
+ proj.SetDefaultTargetDevice ();
+ var b = CreateApkBuilder ("temp/DisableInstantRunWhenAndroidManifestHasChanged");
+ Assert.IsTrue (b.Build (proj), "packaging should have succeeded. 0");
+
+ // modify AndroidManifest.xml.
+ // (Cannot simple rename from "UnnamedProject" because it is a template. Also cannot simply set ProjectName once we built it...)
+ proj.AndroidManifest = proj.AndroidManifest.Replace ("${PROJECT_NAME}", "RenamedProject");
+ proj.Touch ("Properties\\AndroidManifest.xml");
+ // make sure that the fastdev log tells that it actually disabled fastdev.
+ Assert.IsTrue (b.Build (proj, true, null, false), "packaging should have succeeded. 1");
+ Assert.IsTrue (b.Output.AreTargetsAllBuilt ("_ExamineAndroidManifestFileUpdates"),
+ "AndroidManifest update check did not run. 1");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("Triggered force apk reinstallation")), "failed to detect AndroidManifest updates. 1");
+
+ // modify AndroidManifest.xml *to reference @app_name*.
+ proj.AndroidManifest = proj.AndroidManifest.Replace ("android:label=\"RenamedProject\"", "android:label=\"@string/app_name\"");
+ proj.Touch ("Properties\\AndroidManifest.xml");
+ // make sure that the fastdev log tells that it actually disabled fastdev.
+ Assert.IsTrue (b.Build (proj, true, null, false), "packaging should have succeeded. 2");
+ Assert.IsTrue (b.Output.AreTargetsAllBuilt ("_ExamineAndroidManifestFileUpdates"),
+ $"AndroidManifest update check did not run. 2. {string.Join (Environment.NewLine, b.LastBuildOutput )}");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("Triggered force apk reinstallation")), "failed to detect AndroidManifest updates. 2");
+
+ // Change app_name in Resources/values/Strings.xml that should trigger AndroidManifest.xml updates.
+ Assert.IsTrue (proj.StringsXml.Contains ("${PROJECT_NAME}"), "premise not met: StringsXml: " + proj.StringsXml);
+ proj.StringsXml = proj.StringsXml.Replace ("${PROJECT_NAME}", "UnnamedProjectChanged");
+ proj.Touch ("Resources\\values\\Strings.xml");
+ // make sure that the fastdev log tells that it actually disabled fastdev.
+ Assert.IsTrue (b.Build (proj, true, null, false), "install should have succeeded. 3");
+ Assert.IsTrue (b.Output.AreTargetsAllSkipped ("_ExamineAndroidManifestFileUpdates"),
+ "AndroidManifest file update check resulted in failure. 3");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("Triggered force apk reinstallation")), "failed to detect AndroidManifest updates. 3");
+ Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("ShouldTriggerForceUpdates: True")), "failed to disable Instant Run. 3");
+ }
+ }
+}
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManifestTest.OSS.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManifestTest.TestCaseSource.cs
similarity index 100%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManifestTest.OSS.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManifestTest.TestCaseSource.cs
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/SupportV7RecyclerViewTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/SupportV7RecyclerViewTest.cs
new file mode 100644
index 00000000000..396f7fd9bc9
--- /dev/null
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/SupportV7RecyclerViewTest.cs
@@ -0,0 +1,27 @@
+using System;
+using Microsoft.Build.Framework;
+using NUnit.Framework;
+using Xamarin.ProjectTools;
+using System.IO;
+
+namespace Xamarin.Android.Build.Tests
+{
+ [TestFixture]
+ [Parallelizable (ParallelScope.Fixtures)]
+ public class SupportV7RecyclerViewTest : BaseTest
+ {
+ [Test]
+ [Category ("Minor")]
+ public void Build ()
+ {
+ var app = new XamarinAndroidApplicationProject ();
+ app.Packages.Add (KnownPackages.AndroidSupportV4Beta);
+ app.Packages.Add (KnownPackages.SupportV7RecyclerView);
+ using (var b = CreateDllBuilder (Path.Combine ("temp", GetType ().Name))) {
+ b.Verbosity = LoggerVerbosity.Diagnostic;
+ Assert.IsTrue (b.Build (app), "Build should have succeeded.");
+ }
+ }
+ }
+}
+
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Aapt2Tests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/Aapt2Tests.cs
similarity index 100%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Aapt2Tests.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/Aapt2Tests.cs
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidRegExTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/AndroidRegExTests.cs
similarity index 100%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidRegExTests.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/AndroidRegExTests.cs
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidResourceTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/AndroidResourceTests.cs
similarity index 100%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidResourceTests.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/AndroidResourceTests.cs
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ConvertResourcesCasesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ConvertResourcesCasesTests.cs
similarity index 100%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ConvertResourcesCasesTests.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ConvertResourcesCasesTests.cs
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/Tasks/GetDependenciesTests.cs
similarity index 100%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/GetDependenciesTests.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/GetDependenciesTests.cs
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManagedResourceParserTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ManagedResourceParserTests.cs
similarity index 100%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManagedResourceParserTests.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ManagedResourceParserTests.cs
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ResolveSdksTaskTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ResolveSdksTaskTests.cs
similarity index 100%
rename from src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ResolveSdksTaskTests.cs
rename to src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ResolveSdksTaskTests.cs
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 30130fe589c..b660243f0ee 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
@@ -124,7 +124,7 @@ public string Root {
}
}
- public bool CommercialBuildAvailable => SetUp.CommercialBuildAvailable;
+ public static bool CommercialBuildAvailable => SetUp.CommercialBuildAvailable;
char [] invalidChars = { '{', '}', '(', ')', '$', ':', ';', '\"', '\'', ',', '=' };
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 735508b6090..5f1fa6dd62c 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
@@ -14,10 +14,15 @@
+
+
+
+
+
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 ca5f90ea85d..f7abad5a5ec 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
@@ -91,23 +91,21 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
+
-
+
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs
index 8be46e30b26..dfd26a292ab 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/ProjectBuilder.cs
@@ -82,12 +82,12 @@ public bool Build (XamarinProject project, bool doNotCleanupOnUpdate = false, st
return result;
}
- public bool Install (XamarinProject project, bool doNotCleanupOnUpdate = false)
+ public bool Install (XamarinProject project, bool doNotCleanupOnUpdate = false, bool saveProject = true)
{
- return RunTarget (project, "Install", doNotCleanupOnUpdate);
+ return RunTarget (project, "Install", doNotCleanupOnUpdate, saveProject: saveProject);
}
- public bool Uninstall (XamarinProject project, bool doNotCleanupOnUpdate = false)
+ public bool Uninstall (XamarinProject project, bool doNotCleanupOnUpdate = false, bool saveProject = true)
{
return RunTarget (project, "Uninstall", doNotCleanupOnUpdate);
}
@@ -112,12 +112,12 @@ public bool DesignTimeBuild (XamarinProject project, bool doNotCleanupOnUpdate =
return RunTarget (project, "Compile", doNotCleanupOnUpdate, parameters: new string [] { "DesignTimeBuild=True" });
}
- public bool RunTarget (XamarinProject project, string target, bool doNotCleanupOnUpdate = false, string [] parameters = null, Dictionary environmentVariables = null)
+ public bool RunTarget (XamarinProject project, string target, bool doNotCleanupOnUpdate = false, string [] parameters = null, Dictionary environmentVariables = null, bool saveProject = true)
{
var oldTarget = Target;
Target = target;
try {
- return Build (project, doNotCleanupOnUpdate: doNotCleanupOnUpdate, parameters: parameters, environmentVariables: environmentVariables);
+ return Build (project, doNotCleanupOnUpdate: doNotCleanupOnUpdate, parameters: parameters, saveProject: saveProject, environmentVariables: environmentVariables);
} finally {
Target = oldTarget;
}