Skip to content

Commit c013f09

Browse files
[xabt] default $(AndroidEnableMarshalMethods)=false for CoreCLR (#10492)
Fixes: #10491 Context: #10245 In 9861b57, We enabled `$(PublishReadyToRun)` by default in `Release` mode, and so we also need to disable `$(AndroidEnableMarshalMethods)` as it does not work in combination with R2R yet. This is really a build ordering issue, that we'll need to significantly rework in the future. We didn't notice this issue, because we were explicitly passing `-p:AndroidEnableMarshalMethods=false` to the CoreCLR on-device tests. I also cleaned up a few MSBuild tests to use the `EnableMarshalMethods` property.
1 parent d72e109 commit c013f09

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ stages:
194194
testName: Mono.Android.NET_Tests-CoreCLR
195195
project: tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj
196196
testResultsFiles: TestResult-Mono.Android.NET_Tests-$(XA.Build.Configuration)CoreCLR.xml
197-
extraBuildArgs: -p:TestsFlavor=CoreCLR -p:UseMonoRuntime=false -p:AndroidEnableMarshalMethods=false
197+
extraBuildArgs: -p:TestsFlavor=CoreCLR -p:UseMonoRuntime=false
198198
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
199199
artifactFolder: $(DotNetTargetFramework)-CoreCLR
200200

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public void MarshalMethodsDefaultEnabledStatus (bool isRelease, bool marshalMeth
4848
AndroidTargetArch.X86,
4949
};
5050
var proj = new XamarinAndroidApplicationProject {
51-
IsRelease = isRelease
51+
IsRelease = isRelease,
52+
EnableMarshalMethods = marshalMethodsEnabled,
5253
};
53-
proj.SetProperty (KnownProperties.AndroidEnableMarshalMethods, marshalMethodsEnabled.ToString ());
5454
proj.SetRuntimeIdentifiers (abis);
5555
bool shouldMarshalMethodsBeEnabled = isRelease && marshalMethodsEnabled;
5656

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ public void BuildSolutionWithMultipleProjectsInParallel ()
251251
PackageName = $"com.companyname.App{i}",
252252
AotAssemblies = true,
253253
IsRelease = true,
254+
EnableMarshalMethods = true,
254255
};
255-
app1.SetProperty ("AndroidEnableMarshalMethods", "True");
256256
sb.Projects.Add (app1);
257257
}
258258
sb.BuildingInsideVisualStudio = false;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ public abstract class MyRunner {
655655
"base.OnCreate (bundle);",
656656
"base.OnCreate (bundle);\n" +
657657
"if (Lib1.Library1.Is64 ()) Console.WriteLine (\"Hello World!\");");
658-
proj.SetProperty ("AndroidEnableMarshalMethods", enableMarshalMethods.ToString ());
658+
proj.EnableMarshalMethods = enableMarshalMethods;
659659

660660

661661
using var lb = CreateDllBuilder (Path.Combine (path, "Lib1"));

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
340340
<_AndroidAotStripLibraries Condition=" '$(_AndroidAotStripLibraries)' == '' And '$(AndroidIncludeDebugSymbols)' != 'true' ">True</_AndroidAotStripLibraries>
341341
<AndroidAotEnableLazyLoad Condition=" '$(AndroidAotEnableLazyLoad)' == '' And '$(AotAssemblies)' == 'true' And '$(AndroidIncludeDebugSymbols)' != 'true' ">True</AndroidAotEnableLazyLoad>
342342
<AndroidEnableMarshalMethods Condition=" '$(AndroidEnableMarshalMethods)' == '' and ('$(UsingMicrosoftNETSdkRazor)' == 'true') ">False</AndroidEnableMarshalMethods>
343-
<AndroidEnableMarshalMethods Condition=" '$(AndroidEnableMarshalMethods)' == '' and '$(_AndroidRuntime)' != 'NativeAOT' and '$(PublishReadyToRun)' != 'true' ">True</AndroidEnableMarshalMethods>
344-
<!-- NOTE: temporarily disable for NativeAOT for now, to get build passing -->
345-
<AndroidEnableMarshalMethods Condition=" '$(AndroidEnableMarshalMethods)' == '' and ('$(_AndroidRuntime)' == 'NativeAOT' or '$(PublishReadyToRun)' == 'true') ">False</AndroidEnableMarshalMethods>
343+
<AndroidEnableMarshalMethods Condition=" '$(AndroidEnableMarshalMethods)' == '' and '$(_AndroidRuntime)' == 'MonoVM' and '$(PublishReadyToRun)' != 'true' ">True</AndroidEnableMarshalMethods>
344+
<!-- NOTE: temporarily disable for NativeAOT and CoreCLR for now -->
345+
<AndroidEnableMarshalMethods Condition=" '$(AndroidEnableMarshalMethods)' == '' and ('$(_AndroidRuntime)' != 'MonoVM' or '$(PublishReadyToRun)' == 'true') ">False</AndroidEnableMarshalMethods>
346346

347347
<_AndroidUseMarshalMethods Condition=" '$(AndroidIncludeDebugSymbols)' == 'True' ">False</_AndroidUseMarshalMethods>
348348
<_AndroidUseMarshalMethods Condition=" '$(AndroidIncludeDebugSymbols)' != 'True' ">$(AndroidEnableMarshalMethods)</_AndroidUseMarshalMethods>

0 commit comments

Comments
 (0)