Skip to content

Commit f99ba5a

Browse files
committed
A few more steps forward
1 parent ad5931b commit f99ba5a

File tree

10 files changed

+155
-71
lines changed

10 files changed

+155
-71
lines changed

build-tools/automation/azure-pipelines.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ extends:
122122
- template: /build-tools/automation/yaml-templates/stage-msbuild-tests.yaml@self
123123
parameters:
124124
runtimeName: "CoreCLR"
125+
testFilter: $(CoreCLRExcludedNunitCategories)
125126

126127
- template: /build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml@self
127128
parameters:

build-tools/automation/yaml-templates/stage-msbuild-tests.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
parameters:
44
runtimeName: ''
5+
testFilter: '' # Filter used to select tests (NUnit test selection language, not dotnet test filter language)
56
stageName: msbuild_dotnet
67
stageCondition: succeeded()
78
dependsOn: mac_build
@@ -22,6 +23,7 @@ stages:
2223
parameters:
2324
testOS: macOS
2425
runtimeName: ${{ parameters.runtimeName }}
26+
testFilter: ${{ parameters.testFilter }}
2527
jobName: mac_msbuild_tests
2628
jobDisplayName: macOS > Tests > MSBuild
2729
agentCount: 10
@@ -35,6 +37,7 @@ stages:
3537
parameters:
3638
testOS: Windows
3739
runtimeName: ${{ parameters.runtimeName }}
40+
testFilter: ${{ parameters.testFilter }}
3841
jobName: win_msbuild_tests
3942
jobDisplayName: Windows > Tests > MSBuild
4043
agentCount: 8

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bo
9999
});
100100
if (!runtimeIdentifiers.Contains (";")) {
101101
proj.SetProperty (KnownProperties.RuntimeIdentifier, runtimeIdentifiers);
102-
103-
// When targeting CoreCLR, XamarinAndroidApplicationProject sets `RuntimeIdentifiers` to make sure that only 64-bit
104-
// targets are built. It interferes with this test when `RuntimeIdentifier` is set.
105-
proj.RemoveProperty (KnownProperties.RuntimeIdentifiers);
106102
} else {
107103
proj.SetProperty (KnownProperties.RuntimeIdentifiers, runtimeIdentifiers);
108104
}
@@ -178,7 +174,13 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bo
178174
helper.AssertContainsEntry ($"assemblies/de-DE/{proj.ProjectName}.resources.dll", shouldContainEntry: expectEmbeddedAssembies);
179175
foreach (var abi in rids.Select (AndroidRidAbiHelper.RuntimeIdentifierToAbi)) {
180176
helper.AssertContainsEntry ($"lib/{abi}/libmonodroid.so");
181-
helper.AssertContainsEntry ($"lib/{abi}/libmonosgen-2.0.so");
177+
178+
if (TargetRuntimeHelper.UseCoreCLR) {
179+
helper.AssertContainsEntry ($"lib/{abi}/libcoreclr.so");
180+
} else {
181+
helper.AssertContainsEntry ($"lib/{abi}/libmonosgen-2.0.so");
182+
}
183+
182184
if (rids.Length > 1) {
183185
helper.AssertContainsEntry ($"assemblies/{abi}/System.Private.CoreLib.dll", shouldContainEntry: expectEmbeddedAssembies);
184186
} else {

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs

+26-26
Original file line numberDiff line numberDiff line change
@@ -370,15 +370,15 @@ public void BuildWithNativeLibraries ([Values (true, false)] bool isRelease)
370370
ProjectName = "Library1",
371371
IsRelease = isRelease,
372372
OtherBuildItems = {
373-
new AndroidItem.EmbeddedNativeLibrary ("foo\\armeabi-v7a\\libtest.so") {
373+
new AndroidItem.EmbeddedNativeLibrary ("foo\\arm64-v8a\\libtest.so") {
374374
BinaryContent = () => new byte[10],
375-
MetadataValues = "Link=libs\\armeabi-v7a\\libtest.so",
375+
MetadataValues = "Link=libs\\arm64-v8a\\libtest.so",
376376
},
377-
new AndroidItem.EmbeddedNativeLibrary ("foo\\x86\\libtest.so") {
377+
new AndroidItem.EmbeddedNativeLibrary ("foo\\x86_64\\libtest.so") {
378378
BinaryContent = () => new byte[10],
379-
MetadataValues = "Link=libs\\x86\\libtest.so",
379+
MetadataValues = "Link=libs\\x86_64\\libtest.so",
380380
},
381-
new AndroidItem.AndroidNativeLibrary ("armeabi-v7a\\libRSSupport.so") {
381+
new AndroidItem.AndroidNativeLibrary ("arm64-v8a\\libRSSupport.so") {
382382
BinaryContent = () => new byte[10],
383383
},
384384
},
@@ -390,13 +390,13 @@ public void BuildWithNativeLibraries ([Values (true, false)] bool isRelease)
390390
new BuildItem ("ProjectReference","..\\Library1\\Library1.csproj"),
391391
},
392392
OtherBuildItems = {
393-
new AndroidItem.EmbeddedNativeLibrary ("foo\\armeabi-v7a\\libtest1.so") {
393+
new AndroidItem.EmbeddedNativeLibrary ("foo\\arm64-v8a\\libtest1.so") {
394394
BinaryContent = () => new byte[10],
395-
MetadataValues = "Link=libs\\armeabi-v7a\\libtest1.so",
395+
MetadataValues = "Link=libs\\arm64-v8a\\libtest1.so",
396396
},
397-
new AndroidItem.EmbeddedNativeLibrary ("foo\\x86\\libtest1.so") {
397+
new AndroidItem.EmbeddedNativeLibrary ("foo\\x86_64\\libtest1.so") {
398398
BinaryContent = () => new byte[10],
399-
MetadataValues = "Link=libs\\x86\\libtest1.so",
399+
MetadataValues = "Link=libs\\x86_64\\libtest1.so",
400400
},
401401
},
402402
};
@@ -407,12 +407,12 @@ public void BuildWithNativeLibraries ([Values (true, false)] bool isRelease)
407407
new BuildItem ("ProjectReference","..\\Library2\\Library2.csproj"),
408408
},
409409
OtherBuildItems = {
410-
new AndroidItem.AndroidNativeLibrary ("armeabi-v7a\\libRSSupport.so") {
410+
new AndroidItem.AndroidNativeLibrary ("arm64-v8a\\libRSSupport.so") {
411411
BinaryContent = () => new byte[10],
412412
},
413413
}
414414
};
415-
proj.SetRuntimeIdentifiers (["armeabi-v7a", "x86"]);
415+
proj.SetRuntimeIdentifiers (["arm64-v8a", "x86_64"]);
416416
var path = Path.Combine (Root, "temp", string.Format ("BuildWithNativeLibraries_{0}", isRelease));
417417
using (var b1 = CreateDllBuilder (Path.Combine (path, dll2.ProjectName))) {
418418
Assert.IsTrue (b1.Build (dll2), "Build should have succeeded.");
@@ -423,23 +423,23 @@ public void BuildWithNativeLibraries ([Values (true, false)] bool isRelease)
423423
var apk = Path.Combine (Root, builder.ProjectDirectory,
424424
proj.OutputPath, $"{proj.PackageName}-Signed.apk");
425425
FileAssert.Exists (apk);
426-
Assert.IsTrue (StringAssertEx.ContainsText (builder.LastBuildOutput, "warning XA4301: APK already contains the item lib/armeabi-v7a/libRSSupport.so; ignoring."),
426+
Assert.IsTrue (StringAssertEx.ContainsText (builder.LastBuildOutput, "warning XA4301: APK already contains the item lib/arm64-v8a/libRSSupport.so; ignoring."),
427427
"warning about skipping libRSSupport.so should have been raised");
428428
using (var zipFile = ZipHelper.OpenZip (apk)) {
429-
var data = ZipHelper.ReadFileFromZip (zipFile, "lib/x86/libtest.so");
430-
Assert.IsNotNull (data, "libtest.so for x86 should exist in the apk.");
431-
data = ZipHelper.ReadFileFromZip (zipFile, "lib/armeabi-v7a/libtest.so");
432-
Assert.IsNotNull (data, "libtest.so for armeabi-v7a should exist in the apk.");
433-
data = ZipHelper.ReadFileFromZip (zipFile, "lib/x86/libtest1.so");
434-
Assert.IsNotNull (data, "libtest1.so for x86 should exist in the apk.");
435-
data = ZipHelper.ReadFileFromZip (zipFile, "lib/armeabi-v7a/libtest1.so");
436-
Assert.IsNotNull (data, "libtest1.so for armeabi-v7a should exist in the apk.");
437-
data = ZipHelper.ReadFileFromZip (zipFile, "lib/armeabi-v7a/libRSSupport.so");
438-
Assert.IsNotNull (data, "libRSSupport.so for armeabi-v7a should exist in the apk.");
439-
data = ZipHelper.ReadFileFromZip (zipFile, "lib/x86/libSystem.Native.so");
440-
Assert.IsNotNull (data, "libSystem.Native.so for x86 should exist in the apk.");
441-
data = ZipHelper.ReadFileFromZip (zipFile, "lib/armeabi-v7a/libSystem.Native.so");
442-
Assert.IsNotNull (data, "libSystem.Native.so for armeabi-v7a should exist in the apk.");
429+
var data = ZipHelper.ReadFileFromZip (zipFile, "lib/x86_64/libtest.so");
430+
Assert.IsNotNull (data, "libtest.so for x86_64 should exist in the apk.");
431+
data = ZipHelper.ReadFileFromZip (zipFile, "lib/arm64-v8a/libtest.so");
432+
Assert.IsNotNull (data, "libtest.so for arm64-v8a should exist in the apk.");
433+
data = ZipHelper.ReadFileFromZip (zipFile, "lib/x86_64/libtest1.so");
434+
Assert.IsNotNull (data, "libtest1.so for x86_64 should exist in the apk.");
435+
data = ZipHelper.ReadFileFromZip (zipFile, "lib/arm64-v8a/libtest1.so");
436+
Assert.IsNotNull (data, "libtest1.so for arm64-v8a should exist in the apk.");
437+
data = ZipHelper.ReadFileFromZip (zipFile, "lib/arm64-v8a/libRSSupport.so");
438+
Assert.IsNotNull (data, "libRSSupport.so for arm64-v8a should exist in the apk.");
439+
data = ZipHelper.ReadFileFromZip (zipFile, "lib/x86_64/libSystem.Native.so");
440+
Assert.IsNotNull (data, "libSystem.Native.so for x86_64 should exist in the apk.");
441+
data = ZipHelper.ReadFileFromZip (zipFile, "lib/arm64-v8a/libSystem.Native.so");
442+
Assert.IsNotNull (data, "libSystem.Native.so for arm64-v8a should exist in the apk.");
443443
}
444444
}
445445
}

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void DotNetPublish ([Values (false, true)] bool isRelease, [ValueSource(n
226226
IsRelease = isRelease,
227227
EnableDefaultItems = true,
228228
};
229-
proj.SetProperty (KnownProperties.RuntimeIdentifier, runtimeIdentifier);
229+
proj.SetRuntimeIdentifier (runtimeIdentifier);
230230

231231
var preview = IsPreviewFrameworkVersion (targetFramework);
232232
if (preview) {

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/IShortFormProject.cs

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ public interface IShortFormProject
1818
IList<IList<BuildItem>> ItemGroupList { get; }
1919
IList<Import> Imports { get; }
2020
void SetProperty (string name, string value, string condition = null);
21+
bool RemoveProperty (string name);
2122
}
2223
}

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64SimpleDotNet.apkdesc

+45-21
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,76 @@
55
"Size": 3036
66
},
77
"classes.dex": {
8-
"Size": 22484
8+
"Size": 22268
99
},
1010
"lib/arm64-v8a/lib__Microsoft.Android.Resource.Designer.dll.so": {
1111
"Size": 18288
1212
},
1313
"lib/arm64-v8a/lib_Java.Interop.dll.so": {
14-
"Size": 86688
14+
"Size": 91792
1515
},
1616
"lib/arm64-v8a/lib_Mono.Android.dll.so": {
17-
"Size": 117712
17+
"Size": 119960
1818
},
1919
"lib/arm64-v8a/lib_Mono.Android.Runtime.dll.so": {
20-
"Size": 22384
20+
"Size": 23240
21+
},
22+
"lib/arm64-v8a/lib_System.Collections.Immutable.dll.so": {
23+
"Size": 26432
2124
},
2225
"lib/arm64-v8a/lib_System.Console.dll.so": {
23-
"Size": 24392
26+
"Size": 24416
27+
},
28+
"lib/arm64-v8a/lib_System.Diagnostics.StackTrace.dll.so": {
29+
"Size": 22544
30+
},
31+
"lib/arm64-v8a/lib_System.IO.Compression.dll.so": {
32+
"Size": 30624
33+
},
34+
"lib/arm64-v8a/lib_System.IO.MemoryMappedFiles.dll.so": {
35+
"Size": 32664
2436
},
2537
"lib/arm64-v8a/lib_System.Linq.dll.so": {
26-
"Size": 25336
38+
"Size": 25464
2739
},
2840
"lib/arm64-v8a/lib_System.Private.CoreLib.dll.so": {
29-
"Size": 628216
41+
"Size": 827080
42+
},
43+
"lib/arm64-v8a/lib_System.Reflection.Metadata.dll.so": {
44+
"Size": 65952
3045
},
3146
"lib/arm64-v8a/lib_System.Runtime.dll.so": {
32-
"Size": 20056
47+
"Size": 20088
3348
},
3449
"lib/arm64-v8a/lib_System.Runtime.InteropServices.dll.so": {
35-
"Size": 21480
50+
"Size": 21496
3651
},
3752
"lib/arm64-v8a/lib_UnnamedProject.dll.so": {
3853
"Size": 20024
3954
},
40-
"lib/arm64-v8a/libarc.bin.so": {
41-
"Size": 18872
55+
"lib/arm64-v8a/libclrgc.so": {
56+
"Size": 972344
57+
},
58+
"lib/arm64-v8a/libclrgcexp.so": {
59+
"Size": 1025664
4260
},
43-
"lib/arm64-v8a/libmono-component-marshal-ilgen.so": {
44-
"Size": 36440
61+
"lib/arm64-v8a/libclrjit.so": {
62+
"Size": 3088992
63+
},
64+
"lib/arm64-v8a/libcoreclr.so": {
65+
"Size": 6649000
4566
},
4667
"lib/arm64-v8a/libmonodroid.so": {
47-
"Size": 1524752
68+
"Size": 1216032
69+
},
70+
"lib/arm64-v8a/libmscordaccore.so": {
71+
"Size": 2708168
4872
},
49-
"lib/arm64-v8a/libmonosgen-2.0.so": {
50-
"Size": 3101112
73+
"lib/arm64-v8a/libmscordbi.so": {
74+
"Size": 1946872
5175
},
5276
"lib/arm64-v8a/libSystem.Globalization.Native.so": {
53-
"Size": 71976
77+
"Size": 71952
5478
},
5579
"lib/arm64-v8a/libSystem.IO.Compression.Native.so": {
5680
"Size": 758896
@@ -62,16 +86,16 @@
6286
"Size": 165000
6387
},
6488
"lib/arm64-v8a/libxamarin-app.so": {
65-
"Size": 19536
89+
"Size": 30560
6690
},
6791
"META-INF/BNDLTOOL.RSA": {
6892
"Size": 1221
6993
},
7094
"META-INF/BNDLTOOL.SF": {
71-
"Size": 3266
95+
"Size": 4157
7296
},
7397
"META-INF/MANIFEST.MF": {
74-
"Size": 3139
98+
"Size": 4030
7599
},
76100
"res/drawable-hdpi-v4/icon.png": {
77101
"Size": 2178
@@ -98,5 +122,5 @@
98122
"Size": 1904
99123
}
100124
},
101-
"PackageSize": 3078677
125+
"PackageSize": 8490176
102126
}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
using System;
22

3+
using Xamarin.Android.Tasks;
4+
35
namespace Xamarin.ProjectTools
46
{
57
public static class AbiUtils
68
{
79
public static string AbiToRuntimeIdentifier (string androidAbi)
810
{
9-
if (androidAbi == "armeabi-v7a") {
10-
return "android-arm";
11-
} else if (androidAbi == "arm64-v8a") {
12-
return "android-arm64";
13-
} else if (androidAbi == "x86") {
14-
return "android-x86";
15-
} else if (androidAbi == "x86_64") {
16-
return "android-x64";
17-
}
18-
throw new InvalidOperationException ($"Unknown abi: {androidAbi}");
11+
return MonoAndroidHelper.AbiToRidMaybe (androidAbi);
1912
}
2013
}
2114
}

0 commit comments

Comments
 (0)