Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -10,6 +10,8 @@ This file contains the CoreCLR-specific MSBuild logic for .NET for Android.
<!-- Default property values for CoreCLR -->
<PropertyGroup>
<_AndroidRuntimePackRuntime>CoreCLR</_AndroidRuntimePackRuntime>
<!-- PublishAot projects use CoreCLR for inner-loop builds, which must not invoke ILC. -->
<NativeCompilationDuringPublish Condition=" '$(NativeCompilationDuringPublish)' == '' ">false</NativeCompilationDuringPublish>
</PropertyGroup>
<!-- Properties for $(OutputType)=Exe (Android Applications) -->
<PropertyGroup Condition=" '$(AndroidApplication)' == 'true' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
<AndroidClassParser>class-parse</AndroidClassParser>
<AndroidCodegenTarget Condition=" '$(AndroidCodegenTarget)' == '' ">XAJavaInterop1</AndroidCodegenTarget>
<_AndroidJcwCodegenTarget Condition=" '$(_AndroidJcwCodegenTarget)' == '' and '$(_AndroidRuntime)' != 'NativeAOT' ">XAJavaInterop1</_AndroidJcwCodegenTarget>
<_AndroidTypeMapImplementation Condition=" '$(_AndroidTypeMapImplementation)' == '' and '$(_AndroidRuntime)' != 'NativeAOT' ">llvm-ir</_AndroidTypeMapImplementation>
<!-- PublishAot projects can use CoreCLR for Debug builds, so select the typemap independently of _AndroidRuntime. -->
<_AndroidTypeMapImplementation Condition=" '$(_AndroidTypeMapImplementation)' == '' and '$(PublishAot)' == 'true' ">trimmable</_AndroidTypeMapImplementation>
<_AndroidTypeMapImplementation Condition=" '$(_AndroidTypeMapImplementation)' == '' ">llvm-ir</_AndroidTypeMapImplementation>
<AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods Condition=" '$(AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods)' == '' ">true</AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods>
<AndroidBoundInterfacesContainTypes Condition=" '$(AndroidBoundInterfacesContainTypes)' == '' ">true</AndroidBoundInterfacesContainTypes>
<AndroidBoundInterfacesContainConstants Condition=" '$(AndroidBoundInterfacesContainConstants)' == '' ">true</AndroidBoundInterfacesContainConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ This file contains the NativeAOT-specific MSBuild logic for .NET for Android.
<_AndroidRuntimePackRuntime>NativeAOT</_AndroidRuntimePackRuntime>
<_AndroidUseWorkloadNativeLinker Condition=" '$(_AndroidUseWorkloadNativeLinker)' == '' ">true</_AndroidUseWorkloadNativeLinker>
<_AndroidJcwCodegenTarget Condition=" '$(_AndroidJcwCodegenTarget)' == '' ">JavaInterop1</_AndroidJcwCodegenTarget>
<_AndroidTypeMapImplementation Condition=" '$(_AndroidTypeMapImplementation)' == '' ">trimmable</_AndroidTypeMapImplementation>
<!-- .NET SDK gives: error NETSDK1191: A runtime identifier for the property 'PublishAot' couldn't be inferred. Specify a rid explicitly. -->
<AllowPublishAotWithoutRuntimeIdentifier Condition=" '$(AllowPublishAotWithoutRuntimeIdentifier)' == '' ">true</AllowPublishAotWithoutRuntimeIdentifier>
<!-- NativeAOT's targets currently gives an error about cross-compilation -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ public void Build_WithTrimmableTypeMap_Succeeds ([Values] bool isRelease, [Value
AssertTrimmableTypeMapOutputs (intermediateDir);
}

[Test]
public void Build_PublishAotProject_UsesTrimmableTypeMapForCoreClrDebug ()
{
if (IgnoreUnsupportedConfiguration (AndroidRuntime.CoreCLR, release: false)) {
return;
}

var proj = new XamarinAndroidApplicationProject {
IsRelease = false,
};
proj.SetRuntime (AndroidRuntime.CoreCLR);
proj.SetProperty (KnownProperties.PublishAot, "true");

using var builder = CreateApkBuilder ();
Assert.IsTrue (builder.Build (proj, parameters: [ "_AndroidRuntime=CoreCLR" ]), "Build should have succeeded.");

var intermediateDir = builder.Output.GetIntermediaryPath ("typemap");
AssertTrimmableTypeMapOutputs (intermediateDir);
}

[Test]
public void Build_WithTrimmableTypeMap_IncrementalBuild ([Values] bool isRelease, [Values (AndroidRuntime.CoreCLR, AndroidRuntime.NativeAOT)] AndroidRuntime runtime)
{
Expand Down
Loading