Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4826fdc
Aidl tests ListAndMap, NamespaceResolution and PrimitiveTypes work ac…
grendello Nov 18, 2025
99b35c1
AndroidDependenciesTests.InstallAndroidDependenciesTest not tested lo…
grendello Nov 18, 2025
28e85f5
AndroidDependenciesTests.GetDependencyNdkRequiredConditions works
grendello Nov 18, 2025
54ea8ac
AndroidDependenciesTests.GetDependencyWhenBuildToolsAreMissingTest works
grendello Nov 18, 2025
2ae61e8
AndroidDependenciesTests.GetDependencyWhenSDKIsMissingTest works
grendello Nov 18, 2025
24d77f3
AndroidGradleProjectTests.BuildApp works across all 3 runtimes
grendello Nov 18, 2025
e55c40e
AndroidGradleProjectTests.BindLibrary works across all 3 runtimes
grendello Nov 18, 2025
c0a30d7
AndroidGradleProjectTests.BindPackLibrary works across all 3 runtimes
grendello Nov 18, 2025
cc02ba3
AndroidGradleProjectTests.BuildIncremental works across all 3 runtimes
grendello Nov 18, 2025
6f8ac2f
AndroidGradleProjectTests.BuildCustomOutputPaths works across all 3 r…
grendello Nov 18, 2025
8e50a93
AndroidGradleProjectTests.BuildArtifactsOutputPaths works across all …
grendello Nov 18, 2025
7957a85
AndroidGradleProjectTests.BuildMultipleModules works across all 3 run…
grendello Nov 18, 2025
be2a590
AndroidGradleProjectTests.BuildMultipleLibraries works across all 3 r…
grendello Nov 18, 2025
8484ed4
AndroidGradleProjectTests.InvalidItemRefError works across all 3 runt…
grendello Nov 18, 2025
1f0a3f7
AndroidGradleProjectTests.InvalidModuleNameError works across all 3 r…
grendello Nov 18, 2025
fd55735
AndroidGradleProjectTests.BindFacebook works across all 3 runtimes
grendello Nov 18, 2025
90fcb81
AndroidUpdateResourcesTest.CheckMultipleLibraryProjectReferenceAlias …
grendello Nov 18, 2025
ef6629e
AndroidUpdateResourcesTest.BuildAppWithSystemNamespace works
grendello Nov 18, 2025
d44a7b4
AndroidUpdateResourcesTest.DesignTimeBuild works across all 3 runtimes
grendello Nov 18, 2025
c2524fb
AndroidUpdateResourcesTest.CheckEmbeddedAndroidXResources works
grendello Nov 18, 2025
9026447
AndroidUpdateResourcesTest.MoveResource works across all 3 runtimes
grendello Nov 18, 2025
9afeeb3
AndroidUpdateResourcesTest.ReportAaptErrorsInOriginalFileName works
grendello Nov 18, 2025
70debb0
AndroidUpdateResourcesTest.ReportAaptWarningsForBlankLevel works
grendello Nov 18, 2025
39382af
AndroidUpdateResourcesTest.RepetiviteBuildUpdateSingleResource works
grendello Nov 18, 2025
3fe4a42
AndroidUpdateResourcesTest.Check9PatchFilesAreProcessed works
grendello Nov 18, 2025
b3d7f8c
AndroidUpdateResourcesTest.CheckXmlResourcesFilesAreProcessed works o…
grendello Nov 18, 2025
9b1524e
AndroidUpdateResourcesTest.CheckResourceDesignerIsCreated works
grendello Nov 19, 2025
fa763fe
AndroidUpdateResourcesTest.CheckResourceDesignerIsUpdatedWhenReadOnly…
grendello Nov 19, 2025
1d95238
AndroidUpdateResourcesTest.CheckOldResourceDesignerIsNotUsed works
grendello Nov 19, 2025
91a155f
AndroidUpdateResourcesTest.CheckOldResourceDesignerWithWrongCasingIsR…
grendello Nov 19, 2025
32b4055
AndroidUpdateResourcesTest.GenerateResourceDesigner_false works
grendello Nov 19, 2025
63018e5
AndroidUpdateResourcesTest.CheckThatXA1034IsRaisedForInvalidConfigura…
grendello Nov 19, 2025
8206dbe
AndroidUpdateResourcesTest.CheckAaptErrorRaisedForMissingResource works
grendello Nov 19, 2025
d0dca18
AndroidUpdateResourcesTest.CheckAaptErrorRaisedForInvalidFileName works
grendello Nov 19, 2025
24fe639
AndroidUpdateResourcesTest.CheckAaptErrorRaisedForInvalidDirectoryNam…
grendello Nov 19, 2025
b8f42c3
AndroidUpdateResourcesTest.CheckAaptErrorNotRaisedForInvalidFileNameW…
grendello Nov 19, 2025
3a91454
AndroidUpdateResourcesTest.CheckAaptErrorRaisedForDuplicateResourcein…
grendello Nov 19, 2025
36d17a6
AndroidUpdateResourcesTest.CheckFilesAreRemoved works
grendello Nov 19, 2025
278679d
AndroidUpdateResourcesTest.CheckDontUpdateResourceIfNotNeeded works
grendello Nov 19, 2025
ed5dbdb
AndroidUpdateResourcesTest.BuildAppWithManagedResourceParser works
grendello Nov 19, 2025
b960727
AndroidUpdateResourcesTest.BuildAppWithManagedResourceParserAndLibrar…
grendello Nov 19, 2025
9f84292
AndroidUpdateResourcesTest.CheckMaxResWarningIsEmittedAsAWarning works
grendello Nov 19, 2025
f9fa37e
AndroidUpdateResourcesTest.CheckCodeBehindIsGenerated works
grendello Nov 19, 2025
7f74a36
AndroidUpdateResourcesTest.CheckInvalidXmlInManagedResourceParser works
grendello Nov 19, 2025
648ba6e
AndroidUpdateResourcesTest.LightlyModifyLayout works
grendello Nov 19, 2025
234d6a6
AndroidUpdateResourcesTest.CustomViewAddResourceId works
grendello Nov 19, 2025
eb316b7
AndroidUpdateResourcesTest.CheckNoVersionVectors works
grendello Nov 19, 2025
a8b1d4c
AndroidUpdateResourcesTest.InvalidFilenames works
grendello Nov 19, 2025
c59293f
AndroidUpdateResourcesTest.SolutionBuildSeveralProjects works
grendello Nov 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@
using System.Linq;
using Microsoft.Build.Framework;
using System.Text;
using Xamarin.Android.Tasks;

namespace Xamarin.Android.Build.Tests
{
[TestFixture]
[Parallelizable (ParallelScope.Children)]
public class AidlTest : BaseTest
{
void TestAidl (string testName, string aidl)
void TestAidl (string testName, string aidl, AndroidRuntime runtime)
{
var proj = new XamarinAndroidApplicationProject () {
IsRelease = true,
};
proj.SetRuntime (runtime);
proj.OtherBuildItems.Add (new BuildItem (AndroidBuildActions.AndroidInterfaceDescription, "Test.aidl") { TextContent = () => aidl });
using (var p = CreateApkBuilder (testName)) {
using (var p = CreateApkBuilder (Path.Combine ("temp", testName))) {
Assert.IsTrue (p.Build (proj), "Build should have succeeded.");
}
}

[Test]
public void ListAndMap ()
public void ListAndMap ([Values] AndroidRuntime runtime)
{
if (IgnoreUnsupportedConfiguration (runtime, release: true)) {
return;
}

string aidl = @"
import android.os;
import android.view;
Expand All @@ -36,12 +42,16 @@ interface Test {
void map(inout Map m);
}
";
TestAidl ($"temp/AidlTest.{nameof (ListAndMap)}", aidl);
TestAidl (TestName, aidl, runtime);
}

[Test]
public void NamespaceResolution ()
public void NamespaceResolution ([Values] AndroidRuntime runtime)
{
if (IgnoreUnsupportedConfiguration (runtime, release: true)) {
return;
}

string aidl = @"
import android.os;
import android.view;
Expand All @@ -50,12 +60,16 @@ public void NamespaceResolution ()
interface Test {
}
";
TestAidl ("temp/AidlTest.NamespaceResolution", aidl);
TestAidl (TestName, aidl, runtime);
}

[Test]
public void PrimitiveTypes ()
public void PrimitiveTypes ([Values] AndroidRuntime runtime)
{
if (IgnoreUnsupportedConfiguration (runtime, release: true)) {
return;
}

string aidl = @"
package com.xamarin.test;
interface Test {
Expand All @@ -71,18 +85,18 @@ interface Test {
double test8 (inout double [] args);
String test9 (inout String [] args);
// thought that it's missing 'short' ? It's not supported - http://stackoverflow.com/questions/6742167/android-aidl-support-short-type

void test10 (in byte [] args);
void test11 (out byte [] args);
void test12 (inout byte [] args);

int [] test20 ();
boolean [] test21 ();
byte [] test22 ();
String [] test23 ();
}
";
TestAidl ("temp/AidlTest.PrimitiveTypes", aidl);
TestAidl (TestName, aidl, runtime);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ public class AndroidDependenciesTests : BaseTest
{
[Test]
[NonParallelizable] // Do not run environment modifying tests in parallel.
public void InstallAndroidDependenciesTest ([Values ("GoogleV2", "Xamarin")] string manifestType)
public void InstallAndroidDependenciesTest ([Values ("GoogleV2", "Xamarin")] string manifestType, [Values] AndroidRuntime runtime)
{
bool isRelease = runtime == AndroidRuntime.NativeAOT;
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}

// Set to true when we are marking a new Android API level as stable, but it has not
// been added to the Xamarin manifest yet.
var xamarin_manifest_needs_updating = false;
Expand All @@ -39,7 +44,10 @@ public void InstallAndroidDependenciesTest ([Values ("GoogleV2", "Xamarin")] str
Directory.CreateDirectory (path);
}

var proj = new XamarinAndroidApplicationProject ();
var proj = new XamarinAndroidApplicationProject {
IsRelease = isRelease,
};
proj.SetRuntime (runtime);
var buildArgs = new List<string> {
"AcceptAndroidSDKLicenses=true",
$"AndroidManifestType={manifestType}",
Expand Down Expand Up @@ -117,14 +125,52 @@ static string GetCurrentPlatformToolsVersion ()
return $"{revision.Element ("major")?.Value}.{revision.Element ("minor")?.Value}.{revision.Element ("micro")?.Value}";
}

static IEnumerable<object[]> Get_GetDependencyNdkRequiredConditionsData ()
{
var ret = new List<object[]> ();

foreach (AndroidRuntime runtime in Enum.GetValues (typeof (AndroidRuntime))) {
AddTestData ("AotAssemblies", false, runtime);
AddTestData ("AndroidEnableProfiledAot", false, runtime);
AddTestData ("EnableLLVM", true, runtime);
}

return ret;

void AddTestData (string property, bool ndkRequired, AndroidRuntime runtime)
{
ret.Add (new object[] {
property,
ndkRequired,
runtime,
});
}
}

[Test]
[TestCase ("AotAssemblies", false)]
[TestCase ("AndroidEnableProfiledAot", false)]
[TestCase ("EnableLLVM", true)]
public void GetDependencyNdkRequiredConditions (string property, bool ndkRequired)
[TestCaseSource (nameof (Get_GetDependencyNdkRequiredConditionsData))]
public void GetDependencyNdkRequiredConditions (string property, bool ndkRequired, AndroidRuntime runtime)
{
var proj = new XamarinAndroidApplicationProject ();
proj.AotAssemblies = true;
bool isRelease = runtime == AndroidRuntime.NativeAOT;
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}

// CoreCLR doesn't support AOT so it doesn't ever need the NDK and it doesn't support profiled AOT
if (runtime == AndroidRuntime.CoreCLR && (ndkRequired || property == "AndroidEnableProfiledAot")) {
Assert.Ignore ("CoreCLR doesn't support AOT, it doesn't ever require the NDK");
}

// NativeAOT doesn't support profiled AOT
if (runtime == AndroidRuntime.NativeAOT && property == "AndroidEnableProfiledAot") {
Assert.Ignore ("NativeAOT doesn't support profiled AOT");
}

var proj = new XamarinAndroidApplicationProject {
IsRelease = isRelease,
};
proj.SetRuntime (runtime);
proj.AotAssemblies = runtime == AndroidRuntime.MonoVM;
proj.SetProperty (property, "true");
using (var builder = CreateApkBuilder ()) {
builder.Verbosity = LoggerVerbosity.Detailed;
Expand All @@ -143,18 +189,24 @@ public void GetDependencyNdkRequiredConditions (string property, bool ndkRequire
}

[Test]
public void GetDependencyWhenBuildToolsAreMissingTest ()
public void GetDependencyWhenBuildToolsAreMissingTest ([Values] AndroidRuntime runtime)
{
const bool isRelease = true;
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}

var apis = new ApiInfo [] {
};
var path = Path.Combine ("temp", TestName);
var androidSdkPath = CreateFauxAndroidSdkDirectory (Path.Combine (path, "android-sdk"),
null, apis);
var referencesPath = CreateFauxReferencesDirectory (Path.Combine (path, "xbuild-frameworks"), apis);
var proj = new XamarinAndroidApplicationProject () {
IsRelease = true,
IsRelease = isRelease,
TargetSdkVersion = "26",
};
proj.SetRuntime (runtime);
var parameters = new string [] {
$"TargetFrameworkRootPath={referencesPath}",
$"AndroidSdkDirectory={androidSdkPath}",
Expand All @@ -177,8 +229,13 @@ public void GetDependencyWhenBuildToolsAreMissingTest ()
}

[Test]
public void GetDependencyWhenSDKIsMissingTest ([Values (true, false)] bool createSdkDirectory, [Values (true, false)] bool installJavaDeps)
public void GetDependencyWhenSDKIsMissingTest ([Values] bool createSdkDirectory, [Values] bool installJavaDeps, [Values] AndroidRuntime runtime)
{
const bool isRelease = true;
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}

var apis = new ApiInfo [] {
};
var path = Path.Combine ("temp", TestName);
Expand All @@ -189,7 +246,7 @@ public void GetDependencyWhenSDKIsMissingTest ([Values (true, false)] bool creat
Directory.Delete (androidSdkPath, recursive: true);
var referencesPath = CreateFauxReferencesDirectory (Path.Combine (path, "xbuild-frameworks"), apis);
var proj = new XamarinAndroidApplicationProject () {
IsRelease = true,
IsRelease = isRelease,
TargetSdkVersion = "26",
};
var requestedJdkVersion = "17.0.8.1";
Expand Down
Loading
Loading