diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs
index 43d6b89a580..dd811c1d880 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs
@@ -1102,40 +1102,25 @@ public void BuildAppWithManagedResourceParserAndLibraries ()
}
[Test]
- [Category ("DotNetIgnore")] // n/a in .NET 5, not possible to use $(TFV) of v8.0
- public void CheckMaxResWarningIsEmittedAsAWarning([Values (false, true)] bool useAapt2)
+ public void CheckMaxResWarningIsEmittedAsAWarning()
{
- AssertAaptSupported (useAapt2);
var path = Path.Combine ("temp", TestName);
var proj = new XamarinAndroidApplicationProject () {
- TargetFrameworkVersion = "v8.0",
- TargetSdkVersion = "26",
- MinSdkVersion = null,
- UseLatestPlatformSdk = false,
IsRelease = true,
OtherBuildItems = {
- new BuildItem.Folder ("Resources\\values-v27\\") {
+ new BuildItem.Folder ("Resources\\values-v33\\") {
},
},
};
- proj.AndroidUseAapt2 = useAapt2;
- proj.AndroidResources.Add (new AndroidItem.AndroidResource ("Resources\\values-v27\\Strings.xml") {
+ proj.AndroidResources.Add (new AndroidItem.AndroidResource ("Resources\\values-v33\\Strings.xml") {
TextContent = () => @"
Test
",
});
using (var builder = CreateApkBuilder (path)) {
- if (!builder.TargetFrameworkExists (proj.TargetFrameworkVersion)) {
- Assert.Ignore ($"Skipping Test. TargetFrameworkVersion {proj.TargetFrameworkVersion} was not available.");
- }
Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
- if (useAapt2) {
- StringAssertEx.DoesNotContain ("APT0000", builder.LastBuildOutput, "Build output should not contain an APT0000 warning");
- } else {
- var expected = "warning APT1146: max res 26, skipping values-v27";
- StringAssertEx.Contains (expected, builder.LastBuildOutput, "Build output should contain an APT1146 warning about 'max res 26, skipping values-v27'");
- }
+ StringAssertEx.DoesNotContain ("APT0000", builder.LastBuildOutput, "Build output should not contain an APT0000 warning");
}
}
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs
index d258a865619..99142a257c8 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs
@@ -442,30 +442,6 @@ public void RemoveEventHandlerResolution ()
}
}
- [Test]
- [Category ("DotNetIgnore")]
- public void JavaDocJar ()
- {
- var binding = new XamarinAndroidBindingProject () {
- AndroidClassParser = "class-parse",
- };
- binding.SetProperty ("DocumentationFile", "UnnamedProject.xml");
- using (var bindingBuilder = CreateDllBuilder ()) {
- binding.Jars.Add (new AndroidItem.EmbeddedJar ("javasourcejartest.jar") {
- BinaryContent = () => ResourceData.JavaSourceJarTestJar,
- });
- binding.OtherBuildItems.Add (new BuildItem ("JavaDocJar", "javasourcejartest-javadoc.jar") {
- BinaryContent = () => ResourceData.JavaSourceJarTestJavadocJar,
- });
- Assert.IsTrue (bindingBuilder.Build (binding), "binding build should have succeeded");
-
- var cs_file = bindingBuilder.Output.GetIntermediaryPath (
- Path.Combine ("generated", "src", "Com.Xamarin.Android.Test.Msbuildtest.JavaSourceJarTest.cs"));
- FileAssert.Exists (cs_file);
- StringAssert.Contains ("Greet (string name, global::Java.Util.Date date)", File.ReadAllText (cs_file));
- }
- }
-
[Test]
public void JavaSourceJar ()
{
@@ -622,26 +598,6 @@ public void NothingToBind (string classParser)
}
}
- [Test]
- [Category ("DotNetIgnore")] //TODO: @(LibraryProjectProperties) not supported yet in .NET 5+
- public void BugzillaBug11964 ()
- {
- var proj = new XamarinAndroidBindingProject ();
-
- proj.Sources.Add (new BuildItem ("LibraryProjectProperties", "project.properties") {
- TextContent = () => ""
- });
-
- using (var builder = CreateDllBuilder ()) {
- builder.ThrowOnBuildFailure = false;
- Assert.IsFalse (builder.Build (proj), "Build should have failed.");
- string error = builder.LastBuildOutput
- .SkipWhile (x => !x.StartsWith ("Build FAILED.", StringComparison.Ordinal))
- .FirstOrDefault (x => x.Contains ("error XA1019:"));
- Assert.IsNotNull (error, "Build should have failed with XA1019.");
- }
- }
-
[Test]
public void BindingWithAndroidJavaSource ()
{
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 e748cc8155f..3705dda40d5 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
@@ -927,43 +927,6 @@ public void BuildAfterUpgradingNuget ()
}
}
- [Test]
- [Category ("DotNetIgnore")] // Xamarin.Forms version is too old, uses net45 MSBuild tasks
- [NonParallelizable]
- public void CompileBeforeUpgradingNuGet ()
- {
- var proj = new XamarinAndroidApplicationProject ();
- proj.MainActivity = proj.DefaultMainActivity.Replace ("public class MainActivity : Activity", "public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity");
-
- proj.PackageReferences.Add (KnownPackages.XamarinForms_2_3_4_231);
- proj.PackageReferences.Add (KnownPackages.AndroidSupportV4_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportCompat_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportCoreUI_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportCoreUtils_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportDesign_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportFragment_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportMediaCompat_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportV7AppCompat_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportV7CardView_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportV7MediaRouter_27_0_2_1);
-
- using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
- b.ThrowOnBuildFailure = false;
- var projectDir = Path.Combine (Root, b.ProjectDirectory);
- if (Directory.Exists (projectDir))
- Directory.Delete (projectDir, true);
- Assert.IsTrue (b.DesignTimeBuild (proj), "design-time build should have succeeded.");
-
- proj.PackageReferences.Clear ();
- //NOTE: we can get all the other dependencies transitively, yay!
- proj.PackageReferences.Add (KnownPackages.XamarinForms_4_4_0_991265);
- Assert.IsTrue (b.Restore (proj, doNotCleanupOnUpdate: true), "Restore should have worked.");
- Assert.IsTrue (b.Build (proj, saveProject: true, doNotCleanupOnUpdate: true), "second build should have succeeded.");
- Assert.IsTrue (StringAssertEx.ContainsText (b.LastBuildOutput, "Refreshing Xamarin.Android.Support.v7.AppCompat.dll"), "`ResolveLibraryProjectImports` should not skip `Xamarin.Android.Support.v7.AppCompat.dll`!");
- Assert.IsTrue (StringAssertEx.ContainsText (b.LastBuildOutput, "Deleting unknown jar: support-annotations.jar"), "`support-annotations.jar` should be deleted!");
- }
- }
-
[Test]
public void BuildInDesignTimeMode ([Values(false, true)] bool useManagedParser)
{
@@ -993,71 +956,6 @@ public void BuildInDesignTimeMode ([Values(false, true)] bool useManagedParser)
}
[Test]
- [Category ("DotNetIgnore")] // n/a in .NET 5+, test validates __AndroidLibraryProjects__.zip generation
- public void CheckLibraryImportsUpgrade ()
- {
- var path = Path.Combine ("temp", TestContext.CurrentContext.Test.Name);
- var libproj = new XamarinAndroidLibraryProject () {
- IsRelease = true,
- ProjectName = "Library1"
- };
- var proj = new XamarinAndroidApplicationProject () {
- IsRelease = true,
- ProjectName = "App1",
- };
- proj.References.Add (new BuildItem ("ProjectReference", $"..\\Library1\\Library1.csproj"));
- proj.SetProperty ("_AndroidLibrayProjectIntermediatePath", Path.Combine (proj.IntermediateOutputPath, "__library_projects__"));
- using (var libb = CreateDllBuilder (Path.Combine (path, libproj.ProjectName), false, false)) {
- Assert.IsTrue (libb.Build (libproj), "Build should have succeeded.");
- using (var builder = CreateApkBuilder (Path.Combine (path, proj.ProjectName), false, false)) {
- Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
- Assert.IsTrue (Directory.Exists (Path.Combine (Root, path, proj.ProjectName, proj.IntermediateOutputPath, "__library_projects__")),
- "The __library_projects__ directory should exist.");
- proj.RemoveProperty ("_AndroidLibrayProjectIntermediatePath");
- Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
- Assert.IsFalse (Directory.Exists (Path.Combine (Root, path, proj.ProjectName, proj.IntermediateOutputPath, "__library_projects__")),
- "The __library_projects__ directory should not exist, due to IncrementalClean.");
- Assert.IsTrue (libb.Clean (libproj), "Clean should have succeeded.");
- Assert.IsTrue (libb.Build (libproj), "Build should have succeeded.");
- Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
- var zipFile = libb.Output.GetIntermediaryPath ("__AndroidLibraryProjects__.zip");
- Assert.IsTrue (File.Exists (zipFile));
- using (var zip = ZipHelper.OpenZip (zipFile)) {
- Assert.IsTrue (zip.ContainsEntry ("library_project_imports/__res_name_case_map.txt"), $"{zipFile} should contain a library_project_imports/__res_name_case_map.txt entry");
- }
- Assert.IsFalse (Directory.Exists (Path.Combine (Root, path, proj.ProjectName, proj.IntermediateOutputPath, "__library_projects__")),
- "The __library_projects__ directory should not exist.");
- Assert.IsTrue (Directory.Exists (Path.Combine (Root, path, proj.ProjectName, proj.IntermediateOutputPath, "lp")),
- "The lp directory should exist.");
-
- }
- }
- }
-
- [Test]
- [Category ("DotNetIgnore")] // n/a in .NET 5+, because it uses 'netcoreapp1.0\pclcrypto.dll'
- public void ResolveLibraryImportsWithInvalidZip ()
- {
- var proj = new XamarinAndroidApplicationProject {
- PackageReferences = {
- KnownPackages.PCLCrypto_Alpha,
- },
- };
- using (var b = CreateApkBuilder ()) {
- b.Target = "Build";
- b.ThrowOnBuildFailure = false;
- if (b.Build (proj)) {
- //NOTE: `:` in a file path should fail on Windows, but passes on macOS
- if (IsWindows)
- Assert.Fail ("Build should have failed.");
- } else {
- Assert.IsTrue (StringAssertEx.ContainsText (b.LastBuildOutput, "error XA4303: Error extracting resources from"), "Should receive XA4303 error.");
- }
- }
- }
-
- [Test]
- [Category ("DotNetIgnore")] // n/a in .NET 5+, test validates __AndroidLibraryProjects__.zip generation
public void AndroidLibraryProjectsZipWithOddPaths ()
{
var proj = new XamarinAndroidLibraryProject ();
@@ -1075,10 +973,10 @@ public void AndroidLibraryProjectsZipWithOddPaths ()
using (var b = CreateDllBuilder ()) {
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
- var zipFile = Path.Combine (Root, b.ProjectDirectory, b.Output.IntermediateOutputPath, "foo", "__AndroidLibraryProjects__.zip");
+ var zipFile = Path.Combine (Root, b.ProjectDirectory, b.Output.OutputPath, $"{proj.ProjectName}.aar");
FileAssert.Exists (zipFile);
using (var zip = ZipHelper.OpenZip (zipFile)) {
- Assert.IsTrue (zip.ContainsEntry ("library_project_imports/res/values/foo.xml"), $"{zipFile} should contain a library_project_imports/res/values/foo.xml entry");
+ Assert.IsTrue (zip.ContainsEntry ("res/values/foo.xml"), $"{zipFile} should contain a res/values/foo.xml entry");
}
}
}
@@ -1097,14 +995,14 @@ public void AndroidLibraryProjectsZipWithOddPaths ()
/*buildToolsVersion*/ "24.0.1",
/*JavaVersion*/ "1.7.0_101",
/*latestSupportedJavaVersion*/ "1.8.0",
- /*expectedResult*/ false,
+ /*expectedResult*/ true,
},
new object [] {
/*targetFrameworkVersion*/ "v7.1",
/*buildToolsVersion*/ "24.0.1",
/*JavaVersion*/ "1.6.0_101",
/*latestSupportedJavaVersion*/ "1.8.0",
- /*expectedResult*/ false,
+ /*expectedResult*/ true,
},
new object [] {
/*targetFrameworkVersion*/ "v6.0",
@@ -1125,7 +1023,7 @@ public void AndroidLibraryProjectsZipWithOddPaths ()
/*buildToolsVersion*/ "24.0.0",
/*JavaVersion*/ "1.6.0_101",
/*latestSupportedJavaVersion*/ "1.8.0",
- /*expectedResult*/ false,
+ /*expectedResult*/ true,
},
new object [] {
/*targetFrameworkVersion*/ "v5.0",
@@ -1153,7 +1051,7 @@ public void AndroidLibraryProjectsZipWithOddPaths ()
/*buildToolsVersion*/ "24.0.1",
/*JavaVersion*/ "1.6.0_101",
/*latestSupportedJavaVersion*/ "1.8.0",
- /*expectedResult*/ false,
+ /*expectedResult*/ true,
},
new object [] {
/*targetFrameworkVersion*/ "v7.1",
@@ -1167,14 +1065,13 @@ public void AndroidLibraryProjectsZipWithOddPaths ()
/*buildToolsVersion*/ "24.0.1",
/*JavaVersion*/ "9.0.4",
/*latestSupportedJavaVersion*/ "1.8.0",
- /*expectedResult*/ false,
+ /*expectedResult*/ true,
},
};
#pragma warning restore 414
[Test]
[TestCaseSource (nameof (validateJavaVersionTestCases))]
- [Category ("DotNetIgnore")] // n/a under .NET 5+
public void ValidateJavaVersion (string targetFrameworkVersion, string buildToolsVersion, string javaVersion, string latestSupportedJavaVersion, bool expectedResult)
{
var path = Path.Combine ("temp", $"ValidateJavaVersion_{targetFrameworkVersion}_{buildToolsVersion}_{latestSupportedJavaVersion}_{javaVersion}");
@@ -1188,10 +1085,8 @@ public void ValidateJavaVersion (string targetFrameworkVersion, string buildTool
UseLatestPlatformSdk = false,
};
using (var builder = CreateApkBuilder (Path.Combine (path, proj.ProjectName), false, false)) {
- if (!Directory.Exists (Path.Combine (TestEnvironment.MonoAndroidFrameworkDirectory, targetFrameworkVersion)))
- Assert.Ignore ("This is a Pull Request Build. Ignoring test.");
builder.ThrowOnBuildFailure = false;
- builder.Target = "_SetLatestTargetFrameworkVersion";
+ builder.Target = "_ResolveSdks";
Assert.AreEqual (expectedResult, builder.Build (proj, parameters: new string[] {
$"JavaSdkDirectory={javaPath}",
$"JavaToolExe={javaExe}",
@@ -1232,77 +1127,6 @@ public void IfAndroidJarDoesNotExistThrowXA5207 ()
Directory.Delete (AndroidSdkDirectory, recursive: true);
}
- [Test]
- [Category ("DotNetIgnore")] // n/a under .NET 5+
- public void ValidateUseLatestAndroid ()
- {
- var apis = new ApiInfo [] {
- new ApiInfo () { Id = "23", Level = 23, Name = "Marshmallow", FrameworkVersion = "v6.0", Stable = true },
- new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true },
- new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true },
- new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion="v8.99", Stable = false },
- };
- var path = Path.Combine ("temp", TestName);
- var androidSdkPath = CreateFauxAndroidSdkDirectory (Path.Combine (path, "android-sdk"),
- "23.0.6", apis);
- var referencesPath = CreateFauxReferencesDirectory (Path.Combine (path, "xbuild-frameworks"), apis);
- var proj = new XamarinAndroidApplicationProject () {
- IsRelease = true,
- TargetFrameworkVersion = "v8.0",
- UseLatestPlatformSdk = false,
- };
- var parameters = new string [] {
- $"TargetFrameworkRootPath={referencesPath}",
- $"AndroidSdkDirectory={androidSdkPath}",
- };
- var envVar = new Dictionary {
- { "XBUILD_FRAMEWORK_FOLDERS_PATH", referencesPath },
- };
- using (var builder = CreateApkBuilder (Path.Combine (path, proj.ProjectName), false, false)) {
- builder.ThrowOnBuildFailure = false;
- builder.Target = "_SetLatestTargetFrameworkVersion";
- Assert.True (builder.Build (proj, parameters: parameters, environmentVariables: envVar),
- string.Format ("First Build should have succeeded"));
-
- //NOTE: these are generally of this form, from diagnostic log output:
- // Task Parameter:TargetFrameworkVersion=v8.0
- // ...
- // Output Property: TargetFrameworkVersion=v8.0
- // ValidateJavaVersion and ResolveAndroidTooling take input, ResolveAndroidTooling has final output
-
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Task Parameter:TargetFrameworkVersion=v8.0", 2), "TargetFrameworkVersion should initially be v8.0");
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Output Property: TargetFrameworkVersion=v8.0", 1), "TargetFrameworkVersion should be v8.0");
-
- proj.TargetFrameworkVersion = "v8.0";
- Assert.True (builder.Build (proj, parameters: parameters, environmentVariables: envVar),
- string.Format ("Second Build should have succeeded"));
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Task Parameter:TargetFrameworkVersion=v8.0", 2), "TargetFrameworkVersion should initially be v8.0");
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Output Property: TargetFrameworkVersion=v8.0", 1), "TargetFrameworkVersion should be v8.0");
-
- proj.UseLatestPlatformSdk = true;
- proj.TargetFrameworkVersion = "v8.1";
- Assert.True (builder.Build (proj, parameters: parameters, environmentVariables: envVar),
- string.Format ("Third Build should have succeeded"));
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Task Parameter:TargetFrameworkVersion=v8.1", 2), "TargetFrameworkVersion should initially be v8.1");
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Output Property: TargetFrameworkVersion=v8.1", 1), "TargetFrameworkVersion should be v8.1");
-
- proj.UseLatestPlatformSdk = true;
- proj.TargetFrameworkVersion = "v8.99";
- Assert.True (builder.Build (proj, parameters: parameters, environmentVariables: envVar),
- string.Format ("Third Build should have succeeded"));
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Task Parameter:TargetFrameworkVersion=v8.99", 2), "TargetFrameworkVersion should initially be v8.99");
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Output Property: TargetFrameworkVersion=v8.99", 1), "TargetFrameworkVersion should be v8.99");
-
- proj.UseLatestPlatformSdk = true;
- proj.TargetFrameworkVersion = "v6.0";
- Assert.True (builder.Build (proj, parameters: parameters, environmentVariables: envVar),
- string.Format ("Forth Build should have succeeded"));
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Task Parameter:TargetFrameworkVersion=v6.0", 2), "TargetFrameworkVersion should initially be v6.0");
- Assert.IsTrue (builder.LastBuildOutput.ContainsOccurances ("Output Property: TargetFrameworkVersion=v8.1", 1), "TargetFrameworkVersion should be v8.1");
- }
- Directory.Delete (referencesPath, recursive: true);
- }
-
[Test]
public void XA4212 ()
{
@@ -1333,27 +1157,6 @@ public void Dispose ()
}
}
- [Test]
- [Category ("DotNetIgnore")] // n/a for .NET 5+
- public void RunXABuildInParallel ()
- {
- var xabuild = new ProjectBuilder ("temp/RunXABuildInParallel").BuildTool;
- var psi = new ProcessStartInfo (xabuild, "/version") {
- CreateNoWindow = true,
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- WindowStyle = ProcessWindowStyle.Hidden,
- UseShellExecute = false,
- };
-
- Parallel.For (0, 10, i => {
- using (var p = Process.Start (psi)) {
- p.WaitForExit ();
- Assert.AreEqual (0, p.ExitCode);
- }
- });
- }
-
[Test]
public void Desugar ([Values (true, false)] bool isRelease, [Values ("", "r8")] string linkTool)
{
@@ -1477,7 +1280,6 @@ public void MissingOrgApacheHttpClient ()
//NOTE: tests type forwarders in Mono.Android.dll to System.Drawing.Common.dll
[Test]
- [Category ("DotNetIgnore")] // Fails with: error CS0433: The type 'Color' exists in both 'Splat' and 'System.Drawing.Primitives'
public void SystemDrawingCommon ()
{
var proj = new XamarinAndroidApplicationProject {
@@ -1489,7 +1291,6 @@ public void SystemDrawingCommon ()
},
PackageReferences = {
KnownPackages.Acr_UserDialogs,
- KnownPackages.Xamarin_Build_Download_0_4_11,
}
};
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
@@ -1526,22 +1327,6 @@ public void MicrosoftExtensionsHttp ()
}
}
- [Test]
- [Category ("DotNetIgnore")] // n/a on .NET 5+, does not use $(AndroidSupportedAbis)
- [TestCase ("armeabi;armeabi-v7a", TestName = "XA0115")]
- [TestCase ("armeabi,armeabi-v7a", TestName = "XA0115Commas")]
- public void XA0115 (string abis)
- {
- var proj = new XamarinAndroidApplicationProject ();
- proj.SetProperty (KnownProperties.AndroidSupportedAbis, abis);
- using (var builder = CreateApkBuilder ()) {
- builder.ThrowOnBuildFailure = false;
- Assert.IsFalse (builder.Build (proj), "Build should have failed with XA0115.");
- StringAssertEx.Contains ($"error XA0115", builder.LastBuildOutput, "Error should be XA0115");
- Assert.IsTrue (builder.Clean (proj), "Clean should have succeeded.");
- }
- }
-
[Test]
public void XA0119 ()
{
@@ -1918,17 +1703,6 @@ public void AllResourcesInClassLibrary ([Values (true, false)] bool useAapt2, [V
}
}
- [Test]
- [Category ("DotNetIgnore")] // n/a on .NET 5+, does not use $(AndroidSupportedAbis)
- public void AbiDelimiters ([Values ("armeabi-v7a%3bx86", "armeabi-v7a,x86")] string abis)
- {
- var proj = new XamarinAndroidApplicationProject ();
- proj.SetProperty (KnownProperties.AndroidSupportedAbis, abis);
- using (var b = CreateApkBuilder (Path.Combine ("temp", $"{nameof (AbiDelimiters)}_{abis.GetHashCode ()}"))) {
- Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
- }
- }
-
[Test]
public void WorkManager ()
{
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs
index 219fa75914f..539ee7c8242 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs
@@ -816,12 +816,10 @@ public void AndroidResourceNotExist ()
}
[Test]
- [Category ("DotNetIgnore")] // n/a for .NET 5+
public void TargetFrameworkMonikerAssemblyAttributesPath ()
{
- const string filePattern = "MonoAndroid,Version=v*.AssemblyAttributes.cs";
+ const string filePattern = ".NETCoreApp,Version=*.AssemblyAttributes.cs";
var proj = new XamarinAndroidApplicationProject {
- TargetFrameworkVersion = "v6.0",
};
proj.SetProperty ("AndroidUseLatestPlatformSdk", "True");
@@ -829,12 +827,9 @@ public void TargetFrameworkMonikerAssemblyAttributesPath ()
Assert.IsTrue (b.Build (proj), "build should have succeeded.");
var intermediate = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath);
- var old_assemblyattributespath = Path.Combine (intermediate, $"MonoAndroid,Version={proj.TargetFrameworkVersion}.AssemblyAttributes.cs");
- FileAssert.DoesNotExist (old_assemblyattributespath, "TargetFrameworkMonikerAssemblyAttributesPath should have the newer TargetFrameworkVersion.");
var new_assemblyattributespath = Directory.EnumerateFiles (intermediate, filePattern).SingleOrDefault ();
Assert.IsNotNull (new_assemblyattributespath, $"A *single* file of pattern {filePattern} should exist in `$(IntermediateOutputPath)`.");
- StringAssert.DoesNotContain (proj.TargetFrameworkVersion, File.ReadAllText (new_assemblyattributespath), $"`{new_assemblyattributespath}` should not contain `{proj.TargetFrameworkVersion}`!");
}
}
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/EnvironmentContentTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/EnvironmentContentTests.cs
index 24b03b51b49..99608f4f796 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/EnvironmentContentTests.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/EnvironmentContentTests.cs
@@ -242,57 +242,5 @@ public void CheckHttpClientHandlerType ()
Assert.AreEqual (expectedUpdatedValue, envvars[httpClientHandlerVarName]);
}
}
-
- static object [] TlsProviderTestCases =
- {
- // androidTlsProvider, isRelease, extpected
- new object[] { "", true, true, },
- new object[] { "default", true, true, },
- new object[] { "legacy", true, true, },
- new object[] { "btls", true, true, }
- };
-
- [Test]
- [Category ("DotNetIgnore")] // .NET 5+ does not use these native libraries
- [TestCaseSource (nameof (TlsProviderTestCases))]
- public void BuildWithTlsProvider (string androidTlsProvider, bool isRelease, bool expected)
- {
- var proj = new XamarinAndroidApplicationProject () {
- IsRelease = isRelease,
- };
- var supportedAbis = new string [] { "armeabi-v7a", "arm64-v8a" };
- proj.SetAndroidSupportedAbis (supportedAbis);
-
- using (var b = CreateApkBuilder (Path.Combine ("temp", $"BuildWithTlsProvider_{androidTlsProvider}_{isRelease}_{expected}"))) {
- proj.SetProperty ("AndroidTlsProvider", androidTlsProvider);
- Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
- var intermediateOutputDir = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath);
- var outpath = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath);
- var apk = Path.Combine (outpath, $"{proj.PackageName}-Signed.apk");
- using (var zipFile = ZipHelper.OpenZip (apk)) {
- foreach (var abi in supportedAbis) {
- if (expected) {
- Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile,
- $"lib/{abi}/libmono-btls-shared.so"),
- $"lib/{abi}/libmono-btls-shared.so should exist in the apk.");
- }
- else {
- Assert.IsNull (ZipHelper.ReadFileFromZip (zipFile,
- $"lib/{abi}/libmono-btls-shared.so"),
- $"lib/{abi}/libmono-btls-shared.so should not exist in the apk.");
- }
- }
- }
- List envFiles = EnvironmentHelper.GatherEnvironmentFiles (intermediateOutputDir, string.Join (";", supportedAbis), true);
- Dictionary envvars = EnvironmentHelper.ReadEnvironmentVariables (envFiles);
- Assert.IsTrue (envvars.ContainsKey ("XA_TLS_PROVIDER"), "Environment should contain XA_TLS_PROVIDER.");
- if (androidTlsProvider == string.Empty) {
- Assert.AreEqual ("btls", envvars["XA_TLS_PROVIDER"], "'XA_TLS_PROVIDER' should have been 'btls' when provider is not set.");
- } else {
- Assert.AreEqual (androidTlsProvider, envvars["XA_TLS_PROVIDER"], $"'XA_TLS_PROVIDER' should have been '{androidTlsProvider}'.");
- }
- }
- }
-
}
}
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/MSBuildSdkExtrasTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/MSBuildSdkExtrasTests.cs
deleted file mode 100644
index 09346a9f2a9..00000000000
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/MSBuildSdkExtrasTests.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System.IO;
-using System.Linq;
-using Mono.Cecil;
-using NUnit.Framework;
-using Xamarin.ProjectTools;
-
-namespace Xamarin.Android.Build.Tests
-{
- [TestFixture]
- [NonParallelizable] // On MacOS, parallel /restore causes issues
- [Category ("DotNetIgnore")] // Uses MSBuild.Sdk.Extras
- public class MSBuildSdkExtrasTests : BaseTest
- {
- [Test]
- public void ClassLibrary ()
- {
- var proj = new MSBuildSdkExtrasProject ();
- using (var b = CreateDllBuilder (Path.Combine ("temp", TestName))) {
- Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
- var output = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, proj.ProjectName + ".dll");
- FileAssert.Exists (output);
- AssertContainsClass (output, "Class1", contains: true);
- }
- }
-
- [Test]
- public void ClassLibraryNoResources ()
- {
- var proj = new MSBuildSdkExtrasProject ();
- proj.Sources.Remove (proj.Sources.First (s => s.BuildAction == "AndroidResource"));
- using (var b = CreateDllBuilder (Path.Combine ("temp", TestName))) {
- Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
- var output = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, proj.ProjectName + ".dll");
- FileAssert.Exists (output);
- AssertContainsClass (output, "Class1", contains: true);
- }
- }
-
- [Test]
- public void BindingProject ()
- {
- var proj = new MSBuildSdkExtrasProject {
- IsBindingProject = true,
- };
- proj.OtherBuildItems.Add (new AndroidItem.EmbeddedJar ("Jars\\svg-android.jar") {
- WebContent = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/svg-android/svg-android.jar"
- });
- using (var b = CreateDllBuilder (Path.Combine ("temp", TestName))) {
- Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
- var output = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, proj.ProjectName + ".dll");
- FileAssert.Exists (output);
- AssertContainsClass (output, "Com.Larvalabs.Svgandroid.SVG", contains: true);
- }
- }
-
- [Test]
- public void MultiTargeting ()
- {
- var proj = new MSBuildSdkExtrasProject ();
- proj.TargetFrameworks += ";netstandard2.0";
- proj.Sources.Add (new BuildItem.Source ("MyView.cs") {
- TextContent = () =>
-@"#if __ANDROID__
-class MyView : Android.Views.View
-{
- public MyView (Android.Content.Context c) : base (c) { }
-}
-#endif",
- });
- using (var b = CreateDllBuilder (Path.Combine ("temp", TestName))) {
- Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
- var output = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, proj.ProjectName + ".dll");
- FileAssert.Exists (output);
- AssertContainsClass (output, "MyView", contains: true);
- output = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, "..", "netstandard2.0", proj.ProjectName + ".dll");
- FileAssert.Exists (output);
- AssertContainsClass (output, "MyView", contains: false);
- }
- }
-
- void AssertContainsClass (string assemblyFile, string className, bool contains)
- {
- using (var assembly = AssemblyDefinition.ReadAssembly(assemblyFile)) {
- bool result = assembly.MainModule.Types.Select (t => t.FullName).Contains (className);
- if (contains) {
- Assert.IsTrue (result, $"{assemblyFile} should contain {className}!");
- } else {
- Assert.IsFalse (result, $"{assemblyFile} should *not* contain {className}!");
- }
- }
- }
- }
-}
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs
index cd353e5001d..2d2be7136da 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs
@@ -468,45 +468,6 @@ int GetVersionCodeFromIntermediateManifest (string manifestFilePath)
}
}
- [Test]
- [Category ("DotNetIgnore")] // Xamarin.Forms version is too old, uses net45 MSBuild tasks
- [NonParallelizable] // Commonly fails NuGet restore
- public void CheckAapt2WarningsDoNotGenerateErrors ()
- {
- //https://github.com/xamarin/xamarin-android/issues/3083
- var proj = new XamarinAndroidApplicationProject () {
- IsRelease = true,
- TargetFrameworkVersion = Xamarin.ProjectTools.Versions.Oreo_27,
- UseLatestPlatformSdk = false,
- };
- proj.PackageReferences.Add (KnownPackages.XamarinForms_2_3_4_231);
- proj.PackageReferences.Add (KnownPackages.AndroidSupportV4_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportCompat_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportCoreUI_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportCoreUtils_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportDesign_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportFragment_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportMediaCompat_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportV7AppCompat_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportV7CardView_27_0_2_1);
- proj.PackageReferences.Add (KnownPackages.SupportV7MediaRouter_27_0_2_1);
- proj.SetProperty (proj.ReleaseProperties, KnownProperties.AndroidCreatePackagePerAbi, true);
- proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86");
- using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
- if (!b.TargetFrameworkExists (proj.TargetFrameworkVersion))
- Assert.Ignore ($"Skipped as {proj.TargetFrameworkVersion} not available.");
- Assert.IsTrue (b.Build (proj), "first build should have succeeded.");
- string intermediateDir = TestEnvironment.IsWindows
- ? Path.Combine (proj.IntermediateOutputPath, proj.TargetFrameworkAbbreviated) : proj.IntermediateOutputPath;
- var packagedResource = Path.Combine (b.Root, b.ProjectDirectory, intermediateDir, "android", "bin", "packaged_resources");
- FileAssert.Exists (packagedResource, $"{packagedResource} should have been created.");
- var packagedResourcearm = packagedResource + "-armeabi-v7a";
- FileAssert.Exists (packagedResourcearm, $"{packagedResourcearm} should have been created.");
- var packagedResourcex86 = packagedResource + "-x86";
- FileAssert.Exists (packagedResourcex86, $"{packagedResourcex86} should have been created.");
- }
- }
-
[Test]
public void CheckAppBundle ([Values (true, false)] bool isRelease)
{
@@ -535,291 +496,6 @@ public void CheckAppBundle ([Values (true, false)] bool isRelease)
}
}
- [Test]
- [Category ("DotNetIgnore")] // Xamarin.Forms version is too old, uses net45 MSBuild tasks
- public void NetStandardReferenceTest ()
- {
- var netStandardProject = new DotNetStandard () {
- ProjectName = "XamFormsSample",
- ProjectGuid = Guid.NewGuid ().ToString (),
- Sdk = "Microsoft.NET.Sdk",
- TargetFramework = "netstandard1.4",
- IsRelease = true,
- PackageTargetFallback = "portable-net45+win8+wpa81+wp8",
- PackageReferences = {
- KnownPackages.XamarinForms_2_3_4_231,
- new Package () {
- Id = "System.IO.Packaging",
- Version = "4.4.0",
- },
- new Package () {
- Id = "Newtonsoft.Json",
- Version = "13.0.1"
- },
- },
- OtherBuildItems = {
- new BuildItem ("None") {
- Remove = () => "**\\*.xaml",
- },
- new BuildItem ("Compile") {
- Update = () => "**\\*.xaml.cs",
- DependentUpon = () => "%(Filename)"
- },
- new BuildItem ("EmbeddedResource") {
- Include = () => "**\\*.xaml",
- SubType = () => "Designer",
- Generator = () => "MSBuild:UpdateDesignTimeXaml",
- },
- },
- Sources = {
- new BuildItem.Source ("App.xaml.cs") {
- TextContent = () => @"using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Newtonsoft.Json;
-using System.IO.Packaging;
-
-using Xamarin.Forms;
-
-namespace XamFormsSample
-{
- public partial class App : Application
- {
- Package package;
-
- public App()
- {
- try {
- JsonConvert.DeserializeObject(""test"");
- package = Package.Open ("""");
- } catch {
- }
- InitializeComponent();
-
- MainPage = new ContentPage ();
- }
-
- protected override void OnStart()
- {
- // Handle when your app starts
- }
-
- protected override void OnSleep()
- {
- // Handle when your app sleeps
- }
-
- protected override void OnResume()
- {
- // Handle when your app resumes
- }
- }
-}",
- },
- new BuildItem.Source ("App.xaml") {
- TextContent = () => @"
-
-
-
-
-",
- },
- },
- };
-
- var app = new XamarinAndroidApplicationProject () {
- ProjectName = "App1",
- IsRelease = true,
- UseLatestPlatformSdk = true,
- References = {
- new BuildItem.Reference ("Mono.Android.Export"),
- new BuildItem.ProjectReference ($"..\\{netStandardProject.ProjectName}\\{netStandardProject.ProjectName}.csproj",
- netStandardProject.ProjectName, netStandardProject.ProjectGuid),
- },
- PackageReferences = {
- KnownPackages.SupportDesign_27_0_2_1,
- KnownPackages.SupportV7CardView_27_0_2_1,
- KnownPackages.AndroidSupportV4_27_0_2_1,
- KnownPackages.SupportCoreUtils_27_0_2_1,
- KnownPackages.SupportMediaCompat_27_0_2_1,
- KnownPackages.SupportFragment_27_0_2_1,
- KnownPackages.SupportCoreUI_27_0_2_1,
- KnownPackages.SupportCompat_27_0_2_1,
- KnownPackages.SupportV7AppCompat_27_0_2_1,
- KnownPackages.SupportV7MediaRouter_27_0_2_1,
- KnownPackages.XamarinForms_2_3_4_231,
- new Package () {
- Id = "System.Runtime.Loader",
- Version = "4.3.0",
- },
- }
- };
- app.SetProperty ("AndroidUseAssemblyStore", "False");
- app.MainActivity = @"using System;
-using Android.App;
-using Android.Content;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
-using Android.OS;
-using XamFormsSample;
-
-namespace App1
-{
- [Activity (Label = ""App1"", MainLauncher = true, Icon = ""@drawable/icon"")]
- public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity {
- protected override void OnCreate (Bundle bundle)
- {
- base.OnCreate (bundle);
-
- global::Xamarin.Forms.Forms.Init (this, bundle);
-
- LoadApplication (new App ());
- }
- }
- }";
- app.SetAndroidSupportedAbis ("x86", "armeabi-v7a");
- var expectedFiles = new string [] {
- "Java.Interop.dll",
- "Mono.Android.dll",
- "mscorlib.dll",
- "System.Core.dll",
- "System.Data.dll",
- "System.dll",
- "System.Runtime.Serialization.dll",
- "System.IO.Packaging.dll",
- "System.IO.Compression.dll",
- "Mono.Android.Export.dll",
- "App1.dll",
- "FormsViewGroup.dll",
- "Xamarin.Android.Arch.Lifecycle.Common.dll",
- "Xamarin.Android.Support.Compat.dll",
- "Xamarin.Android.Support.Core.UI.dll",
- "Xamarin.Android.Support.Core.Utils.dll",
- "Xamarin.Android.Support.Design.dll",
- "Xamarin.Android.Support.Fragment.dll",
- "Xamarin.Android.Support.v7.AppCompat.dll",
- "Xamarin.Android.Support.v7.CardView.dll",
- "Xamarin.Forms.Core.dll",
- "Xamarin.Forms.Platform.Android.dll",
- "Xamarin.Forms.Platform.dll",
- "Xamarin.Forms.Xaml.dll",
- "XamFormsSample.dll",
- "Mono.Security.dll",
- "System.Xml.dll",
- "System.Net.Http.dll",
- "System.ServiceModel.Internals.dll",
- "Newtonsoft.Json.dll",
- "System.Numerics.dll",
- "System.Xml.Linq.dll",
- };
- var path = Path.Combine ("temp", TestContext.CurrentContext.Test.Name);
- using (var builder = CreateDllBuilder (Path.Combine (path, netStandardProject.ProjectName), cleanupOnDispose: false)) {
- using (var ab = CreateApkBuilder (Path.Combine (path, app.ProjectName), cleanupOnDispose: false)) {
- Assert.IsTrue (builder.Build (netStandardProject), "XamFormsSample should have built.");
- Assert.IsTrue (ab.Build (app), "App should have built.");
- var apk = Path.Combine (Root, ab.ProjectDirectory,
- app.OutputPath, $"{app.PackageName}-Signed.apk");
- using (var zip = ZipHelper.OpenZip (apk)) {
- var existingFiles = zip.Where (a => a.FullName.StartsWith ("assemblies/", StringComparison.InvariantCultureIgnoreCase));
- var missingFiles = expectedFiles.Where (x => !zip.ContainsEntry ("assemblies/" + Path.GetFileName (x)));
- Assert.IsFalse (missingFiles.Any (),
- string.Format ("The following Expected files are missing. {0}",
- string.Join (Environment.NewLine, missingFiles)));
- var additionalFiles = existingFiles.Where (x => !expectedFiles.Contains (Path.GetFileName (x.FullName)));
- Assert.IsTrue (!additionalFiles.Any (),
- string.Format ("Unexpected Files found! {0}",
- string.Join (Environment.NewLine, additionalFiles.Select (x => x.FullName))));
- }
- }
- }
- }
-
- [Test]
- [Category ("DotNetIgnore")] // Uses MSBuild.Sdk.Extras
- public void CheckTheCorrectRuntimeAssemblyIsUsedFromNuget ()
- {
- string monoandroidFramework = "monoandroid10.0";
- string path = Path.Combine (Root, "temp", TestName);
- var ns = new DotNetStandard () {
- ProjectName = "Dummy",
- Sdk = "MSBuild.Sdk.Extras/2.0.54",
- Sources = {
- new BuildItem.Source ("Class1.cs") {
- TextContent = () => @"public class Class1 {
-#if __ANDROID__
- public static string Library => ""Android"";
-#else
- public static string Library => "".NET Standard"";
-#endif
-}",
- },
- },
- OtherBuildItems = {
- new BuildItem.NoActionResource ("$(OutputPath)netstandard2.0\\$(AssemblyName).dll") {
- TextContent = null,
- BinaryContent = null,
- Metadata = {
- { "PackagePath", "ref\\netstandard2.0" },
- { "Pack", "True" }
- },
- },
- new BuildItem.NoActionResource ($"$(OutputPath){monoandroidFramework}\\$(AssemblyName).dll") {
- TextContent = null,
- BinaryContent = null,
- Metadata = {
- { "PackagePath", $"lib\\{monoandroidFramework}" },
- { "Pack", "True" }
- },
- },
- },
- };
- ns.SetProperty ("TargetFrameworks", $"netstandard2.0;{monoandroidFramework}");
- ns.SetProperty ("PackageId", "dummy.package.foo");
- ns.SetProperty ("PackageVersion", "1.0.0");
- ns.SetProperty ("GeneratePackageOnBuild", "True");
- ns.SetProperty ("IncludeBuildOutput", "False");
- ns.SetProperty ("Summary", "Test");
- ns.SetProperty ("Description", "Test");
- ns.SetProperty ("PackageOutputPath", path);
-
-
- var xa = new XamarinAndroidApplicationProject () {
- ProjectName = "App",
- PackageReferences = {
- new Package () {
- Id = "dummy.package.foo",
- Version = "1.0.0",
- },
- },
- OtherBuildItems = {
- new BuildItem.NoActionResource ("NuGet.config") {
- },
- },
- };
- xa.SetProperty ("RestoreNoCache", "true");
- xa.SetProperty ("RestorePackagesPath", "$(MSBuildThisFileDirectory)packages");
- using (var nsb = CreateDllBuilder (Path.Combine (path, ns.ProjectName), cleanupAfterSuccessfulBuild: false, cleanupOnDispose: false))
- using (var xab = CreateApkBuilder (Path.Combine (path, xa.ProjectName), cleanupAfterSuccessfulBuild: false, cleanupOnDispose: false)) {
- nsb.ThrowOnBuildFailure = xab.ThrowOnBuildFailure = false;
- Assert.IsTrue (nsb.Build (ns), "Build of NetStandard Library should have succeeded.");
- Assert.IsFalse (xab.Build (xa, doNotCleanupOnUpdate: true), "Build of App Library should have failed.");
- File.WriteAllText (Path.Combine (Root, xab.ProjectDirectory, "NuGet.config"), @"
-
-
-
-
-
-");
- Assert.IsTrue (xab.Build (xa, doNotCleanupOnUpdate: true), "Build of App Library should have succeeded.");
- string expected = Path.Combine ("dummy.package.foo", "1.0.0", "lib", monoandroidFramework, "Dummy.dll");
- Assert.IsTrue (xab.LastBuildOutput.ContainsText (expected), $"Build should be using {expected}");
- }
- }
-
[Test]
public void MissingSatelliteAssemblyInLibrary ()
{
diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownPackages.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownPackages.cs
index c4dca5c2b42..5caf109940b 100644
--- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownPackages.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownPackages.cs
@@ -525,16 +525,7 @@ public static class KnownPackages
};
public static Package Acr_UserDialogs = new Package {
Id = "Acr.UserDialogs",
- Version = "6.5.1",
- TargetFramework = "MonoAndroid10",
- References = {
- new BuildItem.Reference ("Acr.UserDialogs") {
- MetadataValues = "HintPath=..\\packages\\Acr.UserDialogs.6.5.1\\lib\\MonoAndroid10\\Acr.UserDialogs.dll"
- },
- new BuildItem.Reference ("Acr.UserDialogs.Interfaces") {
- MetadataValues = "HintPath=..\\packages\\Acr.UserDialogs.6.5.1\\lib\\MonoAndroid10\\Acr.UserDialogs.Interfaces.dll"
- }
- },
+ Version = "8.0.1",
};
public static Package CircleImageView = new Package {
Id = "Refractored.Controls.CircleImageView",
diff --git a/tests/MSBuildDeviceIntegration/Tests/DeleteBinObjTest.cs b/tests/MSBuildDeviceIntegration/Tests/DeleteBinObjTest.cs
deleted file mode 100644
index 532b5abb21e..00000000000
--- a/tests/MSBuildDeviceIntegration/Tests/DeleteBinObjTest.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using NUnit.Framework;
-using System.Collections.Generic;
-using System.IO;
-using Xamarin.ProjectTools;
-
-namespace Xamarin.Android.Build.Tests
-{
- [TestFixture]
- [Category ("DotNetIgnore")] // .csproj files are legacy projects that won't build under dotnet
- public class DeleteBinObjTest : DeviceTest
- {
- const string BaseUrl = "https://github.com/dellis1972/xamarin-android-unittest-files/blob/main/";
- readonly DownloadedCache Cache = new DownloadedCache ();
-
- string HostOS => IsWindows ? "Windows" : "Darwin";
- void RunTest (string name, string sln, string csproj, string version, string revision, string packageName, string javaPackageName, bool isRelease)
- {
- var configuration = isRelease ? "Release" : "Debug";
- var zipPath = Cache.GetAsFile ($"{BaseUrl}{name}-{version}-{HostOS}-{revision}.7z?raw=true");
- using (var builder = CreateApkBuilder (Path.Combine ("temp", TestName)))
- using (var zip = SevenZipHelper.Open (zipPath, FileMode.Open)) {
- builder.AutomaticNuGetRestore = false;
-
- if (!builder.TargetFrameworkExists ("v9.0")) {
- Assert.Ignore ("TargetFrameworkVersion=v9.0 required for this test.");
- return;
- }
-
- var projectDir = Path.Combine (Root, builder.ProjectDirectory);
- if (Directory.Exists (projectDir))
- Directory.Delete (projectDir, recursive: true);
- zip.ExtractAll (projectDir);
-
- var solution = new ExistingProject {
- IsRelease = isRelease,
- ProjectFilePath = Path.Combine (projectDir, sln),
- };
- // RestoreNoCache will bypass a global cache on CI machines
- Assert.IsTrue (builder.Restore (solution, doNotCleanupOnUpdate: true, parameters: new [] { "RestoreNoCache=True" }), "Restore should have succeeded.");
-
- var project = new ExistingProject {
- IsRelease = isRelease,
- ProjectFilePath = Path.Combine (projectDir, csproj),
- };
- var parameters = new List {
- "Configuration=" + configuration,
- // Move the $(IntermediateOutputPath) directory to match zips
- "IntermediateOutputPath=" + Path.Combine ("obj", isRelease ? "Release" : "Debug", "90") + Path.DirectorySeparatorChar
- };
- if (isRelease || !CommercialBuildAvailable) {
- parameters.Add (KnownProperties.AndroidSupportedAbis + "=\"armeabi-v7a;x86;x86_64\"");
- } else {
- parameters.Add (KnownProperties.AndroidSupportedAbis + "=\"armeabi-v7a;arm64-v8a;x86;x86_64\"");
- }
- if (IsDeviceAttached ()) {
- Assert.IsTrue (builder.Install (project, doNotCleanupOnUpdate: true, parameters: parameters.ToArray (), saveProject: false),
- "Install should have succeeded.");
- ClearAdbLogcat ();
- if (CommercialBuildAvailable)
- Assert.True (builder.RunTarget (project, "_Run", doNotCleanupOnUpdate: true, parameters: parameters.ToArray ()), "Project should have run.");
- else
- AdbStartActivity ($"{packageName}/{javaPackageName}.MainActivity");
- Assert.True (WaitForActivityToStart (packageName, "MainActivity",
- Path.Combine (Root, builder.ProjectDirectory, "logcat.log"), 30), "Activity should have started.");
- } else {
- Assert.IsTrue (builder.Build (project, doNotCleanupOnUpdate: true, parameters: parameters.ToArray (), saveProject: false),
- "Build should have succeeded.");
- }
- }
- }
-
- [Test, Category ("UsesDevice")]
- public void HelloForms15_9 ([Values (false, true)] bool isRelease)
- {
- RunTest ("HelloForms",
- "HelloForms.sln",
- Path.Combine ("HelloForms.Android", "HelloForms.Android.csproj"),
- "15.9",
- "ecb13a9",
- "com.companyname",
- "crc6450e568c951913723",
- isRelease);
- }
-
- [Test, Category ("UsesDevice")]
- public void HelloForms16_4 ([Values (false, true)] bool isRelease)
- {
- RunTest ("HelloForms",
- "HelloForms.sln",
- Path.Combine ("HelloForms.Android", "HelloForms.Android.csproj"),
- "16.4",
- "dea8b8d",
- "com.companyname",
- "crc6450e568c951913723",
- isRelease);
- }
- }
-}
diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
index e6331a607d1..2286d0fed22 100644
--- a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
+++ b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
@@ -301,59 +301,6 @@ public string GetData() {
}
}
- public static string [] ProfilerOptions () => new string [] {
- "log:heapshot", // Heapshot
- "log:sample", // Sample
- "log:nodefaults,exception,monitor,counter,sample", // Sample5_8
- "log:nodefaults,exception,monitor,counter,sample-real", // SampleReal
- "log:alloc", // Allocations
- "log:nodefaults,gc,gcalloc,gcroot,gcmove,counter", // Allocations5_8
- "log:nodefaults,gc,nogcalloc,gcroot,gcmove,counter", // LightAllocations
- "log:calls,alloc,heapshot", // All
- };
-
- [Test]
- [Category ("DotNetIgnore")] // TODO: libmono-profiler-log.so is missing in .NET 6
- public void ProfilerLogOptions_ShouldCreateMlpdFiles ([ValueSource (nameof (ProfilerOptions))] string profilerOption)
- {
- AssertCommercialBuild ();
-
- proj = new XamarinAndroidApplicationProject () {
- };
- builder = CreateApkBuilder ();
- Assert.IsTrue (builder.Install (proj), "Install should have succeeded.");
- string mlpdDestination = Path.Combine (Root, builder.ProjectDirectory, "profile.mlpd");
- if (File.Exists (mlpdDestination))
- File.Delete (mlpdDestination);
-
- RunAdbCommand ($"shell setprop debug.mono.profile {profilerOption}");
- RunProjectAndAssert (proj, builder);
- Assert.True (WaitForActivityToStart (proj.PackageName, "MainActivity",
- Path.Combine (Root, builder.ProjectDirectory, "logcat.log"), 30), "Activity should have started.");
-
- // Wait for seven seconds after the activity is displayed to get profiler results
- WaitFor (7000);
- string profilerFileDir = null;
- foreach (var dir in GetOverrideDirectoryPaths (proj.PackageName)) {
- var listing = RunAdbCommand ($"shell run-as {proj.PackageName} ls {dir}");
- if (listing.Contains ("profile.mlpd")) {
- profilerFileDir = dir;
- break;
- }
- }
-
- Assert.IsTrue (!string.IsNullOrEmpty (profilerFileDir), $"Unable to locate 'profile.mlpd' in any override directories.");
- var profilerContent = RunAdbCommand ($"shell run-as {proj.PackageName} cat {profilerFileDir}/profile.mlpd");
- File.WriteAllText (mlpdDestination, profilerContent);
- RunAdbCommand ($"shell run-as {proj.PackageName} rm {profilerFileDir}/profile.mlpd");
- RunAdbCommand ($"shell am force-stop {proj.PackageName}");
- RunAdbCommand ("shell setprop debug.mono.profile \"\"");
- Assert.IsTrue (new FileInfo (mlpdDestination).Length > 5000,
- $"profile.mlpd file created with option '{profilerOption}' was not larger than 5 kb. The application may have crashed.");
- Assert.IsTrue (profilerContent.Contains ("String") && profilerContent.Contains ("Java"),
- $"profile.mlpd file created with option '{profilerOption}' did not contain expected data.");
- }
-
[Test]
public void CustomLinkDescriptionPreserve ([Values (AndroidLinkMode.SdkOnly, AndroidLinkMode.Full)] AndroidLinkMode linkMode)
{