Skip to content

Commit 43511e9

Browse files
Add a way to disable the error
1 parent 5f00712 commit 43511e9

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,32 @@ public static void Foo () {
298298
sb.Dispose ();
299299
}
300300

301+
static readonly object [] HybridAOTSource = new object [] {
302+
new object [] {
303+
/* abis */ "armeabi-v7a;arm64-v8a",
304+
/* validateAbi */ null,
305+
/* expectedBuildResult */ false
306+
},
307+
new object [] {
308+
/* abis */ "armeabi-v7a",
309+
/* validateAbi */ null,
310+
/* expectedBuildResult */ false
311+
},
312+
new object [] {
313+
/* abis */ "arm64-v8a",
314+
/* validateAbi */ null,
315+
/* expectedBuildResult */ true
316+
},
317+
new object [] {
318+
/* abis */ "armeabi-v7a;arm64-v8a",
319+
/* validateAbi */ "false",
320+
/* expectedBuildResult */ true
321+
}
322+
};
323+
301324
[Test]
302-
public void HybridAOT ([Values ("armeabi-v7a;arm64-v8a", "armeabi-v7a", "arm64-v8a")] string abis)
325+
[TestCaseSource (nameof (HybridAOTSource))]
326+
public void HybridAOT (string abis, string validateAbi, bool expectedBuildResult)
303327
{
304328
var proj = new XamarinAndroidApplicationProject () {
305329
IsRelease = true,
@@ -309,10 +333,11 @@ public static void Foo () {
309333
// So we can use Mono.Cecil to open assemblies directly
310334
proj.SetProperty ("AndroidEnableAssemblyCompression", "False");
311335
proj.SetAndroidSupportedAbis (abis);
336+
proj.SetProperty ("AndroidAotModeValidateAbi", validateAbi);
312337

313338
using (var b = CreateApkBuilder ()) {
314339

315-
if (abis.Contains ("armeabi-v7a")) {
340+
if (!expectedBuildResult) {
316341
b.ThrowOnBuildFailure = false;
317342
Assert.IsFalse (b.Build (proj), "Build should have failed.");
318343
string error = b.LastBuildOutput

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,7 @@ because xbuild doesn't support framework reference assemblies.
21662166
/>
21672167
<AndroidError Code="XA1025"
21682168
ResourceName="XA1025"
2169-
Condition=" '%(_BuildTargetAbis.Identity)' == 'armeabi-v7a' AND '$(AndroidAotMode)' == 'Hybrid' " />
2169+
Condition=" '$(AndroidAotModeValidateAbi)' != 'false' AND '%(_BuildTargetAbis.Identity)' == 'armeabi-v7a' AND '$(AndroidAotMode)' == 'Hybrid' " />
21702170
</Target>
21712171

21722172
<PropertyGroup>

0 commit comments

Comments
 (0)