Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ When diagnosing runtime, build, or test failures, follow these practices. They e
make prepare && make all CONFIGURATION=Release
./dotnet-local.sh build -t:Install -c Release \
tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj \
-p:_AndroidTypeMapImplementation=<llvm-ir|trimmable> \
-p:AndroidTypeMapImplementation=<llvm-ir|trimmable> \
-p:UseMonoRuntime=<true|false>
(
cd tests/Mono.Android-Tests/Mono.Android-Tests
../../../dotnet-local.sh test Mono.Android.NET-Tests.csproj --no-build -c Release \
--report-trx --results-directory ../../../bin/TestRelease/TestResults \
-p:_AndroidTypeMapImplementation=<llvm-ir|trimmable> \
-p:AndroidTypeMapImplementation=<llvm-ir|trimmable> \
-p:UseMonoRuntime=<true|false>
)
```
Expand Down
8 changes: 8 additions & 0 deletions Documentation/docs-mobile/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,14 @@ Supported values include:

This property is obsolete and should not be used.

## AndroidTypeMapImplementation

An enum-style property that selects the type map implementation.
Valid values are `llvm-ir` and `trimmable`.

The default value is `llvm-ir` when using CoreCLR and `trimmable` when using
NativeAOT.
Comment thread
jonathanpeppers marked this conversation as resolved.

## AndroidUseApkSigner

A bool property that allows the developer to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ stages:
testName: Mono.Android.NET_Tests-CoreCLRTrimmable
project: tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj
testResultsFiles: TestResult-Mono.Android.NET_Tests-$(XA.Build.Configuration)CoreCLRTrimmable.xml
extraBuildArgs: -p:_AndroidTypeMapImplementation=trimmable -p:UseMonoRuntime=false
extraBuildArgs: -p:AndroidTypeMapImplementation=trimmable -p:UseMonoRuntime=false
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-CoreCLRTrimmable

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Android.Sdk.TrimmableTypeMap/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Trimmable typemap build pipeline

This document describes how the **trimmable** typemap implementation
(`_AndroidTypeMapImplementation=trimmable`) is produced during an Android app
(`AndroidTypeMapImplementation=trimmable`) is produced during an Android app
build, and how the MSBuild targets are kept incremental. It is aimed at
contributors working on the targets in
`src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable*.targets`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<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>
<AndroidTypeMapImplementation Condition=" '$(AndroidTypeMapImplementation)' == '' and '$(_AndroidRuntime)' != 'NativeAOT' ">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,7 @@ 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>
<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 @@ -98,7 +98,7 @@
ResolvedAssemblies="@(_ResolvedAssemblies)"
SkipJniAddNativeMethodRegistrationAttributeScan="$(_SkipJniAddNativeMethodRegistrationAttributeScan)"
SupportedAbis="@(_BuildTargetAbis)"
TypemapImplementation="$(_AndroidTypeMapImplementation)"
TypemapImplementation="$(AndroidTypeMapImplementation)"
TypemapOutputDirectory="$(_NativeAssemblySourceDir)">
</GenerateTypeMappings>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</Target>

<Target Name="_ComputePostTrimTrimmableTypeMapInputs"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' "
AfterTargets="_ResolveAssemblies">
<ItemGroup>
<_PostTrimTrimmableTypeMapInputAssemblies Remove="@(_PostTrimTrimmableTypeMapInputAssemblies)" />
Expand All @@ -70,7 +70,7 @@
a real output but leaves the stamp, invalidate the stamp so the producer restores the complete
post-trim output set instead of letting _GenerateJavaStubs create an empty acw-map placeholder. -->
<Target Name="_InvalidatePostTrimTrimmableTypeMapStampIfOutputsMissing"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' ">
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' ">
<ItemGroup>
<_ExpectedPostTrimJavaFile Remove="@(_ExpectedPostTrimJavaFile)" />
<_ActualPostTrimJavaFile Remove="@(_ActualPostTrimJavaFile)" />
Expand Down Expand Up @@ -99,7 +99,7 @@
</Target>

<Target Name="_GeneratePostTrimTrimmableTypeMapJavaSources"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' "
DependsOnTargets="_ComputePostTrimTrimmableTypeMapInputs;_InvalidatePostTrimTrimmableTypeMapStampIfOutputsMissing"
AfterTargets="_ResolveAssemblies"
BeforeTargets="_GenerateJavaStubs;_CompileJava;_CompileToDalvik"
Expand Down Expand Up @@ -158,7 +158,7 @@
assembly references in it - untouched. Runs before the linked TypeMap DLLs are handed to the
publish/ReadyToRun pipeline. -->
<Target Name="_GenerateMissingTrimmableTypeMapStubs"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(RuntimeIdentifier)' != '' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(RuntimeIdentifier)' != '' "
AfterTargets="ILLink"
BeforeTargets="_AddTrimmableTypeMapToResolvedFileToPublish;CreateReadyToRunImages">
<GenerateMissingTypeMapStubs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
generator's Inputs stable across builds.
-->
<Target Name="_ResolveRuntimeOnlyAssembliesForTrimmableTypeMap"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(_OuterIntermediateOutputPath)' == '' and '$(DesignTimeBuild)' != 'true' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' and '$(_OuterIntermediateOutputPath)' == '' and '$(DesignTimeBuild)' != 'true' "
Inputs="$(ProjectAssetsFile);$(_AndroidBuildPropertiesCache)"
Outputs="$(_TypeMapOutputDirectory)runtime-only-assemblies.txt">
<PropertyGroup>
Expand Down Expand Up @@ -138,7 +138,7 @@
</Target>

<Target Name="_AddRuntimeOnlyAssembliesToTrimmableTypeMap"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(_OuterIntermediateOutputPath)' == '' and '$(DesignTimeBuild)' != 'true' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' and '$(_OuterIntermediateOutputPath)' == '' and '$(DesignTimeBuild)' != 'true' "
DependsOnTargets="_ResolveRuntimeOnlyAssembliesForTrimmableTypeMap"
BeforeTargets="_GenerateTrimmableTypeMap">
<ReadLinesFromFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</Target>

<Target Name="_ValidateTrimmableTypeMapPackageNamingPolicy"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(_AndroidPackageNamingPolicySetByUser)' == 'true' and '$(AndroidPackageNamingPolicy.ToLowerInvariant())' != 'crc64' and '$(AndroidPackageNamingPolicy.ToLowerInvariant())' != 'lowercasecrc64' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' and '$(_AndroidPackageNamingPolicySetByUser)' == 'true' and '$(AndroidPackageNamingPolicy.ToLowerInvariant())' != 'crc64' and '$(AndroidPackageNamingPolicy.ToLowerInvariant())' != 'lowercasecrc64' "
BeforeTargets="_GenerateTrimmableTypeMap;Build">
<Error Text="AndroidPackageNamingPolicy value '$(AndroidPackageNamingPolicy)' is not supported with the trimmable typemap. Supported values are 'Crc64' (default) and 'LowercaseCrc64'." />
</Target>
Expand All @@ -117,7 +117,7 @@
deferred-registration propagation.
-->
<Target Name="_GenerateTrimmableTypeMap"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(DesignTimeBuild)' != 'true' and '@(ReferencePath->Count())' != '0' and '$(_OuterIntermediateOutputPath)' == '' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' and '$(DesignTimeBuild)' != 'true' and '@(ReferencePath->Count())' != '0' and '$(_OuterIntermediateOutputPath)' == '' "
AfterTargets="CoreCompile"
DependsOnTargets="$(_GenerateTrimmableTypeMapDependsOn)"
Inputs="@(ReferencePath);@(PrivateSdkAssemblies);@(FrameworkAssemblies);@(ExtractedManifestDocuments);@(_AndroidTrimmableTypeMapExtraFrameworkAssembly);$(IntermediateOutputPath)$(TargetFileName);$(_AndroidManifestAbs);$(_AndroidBuildPropertiesCache)"
Expand Down Expand Up @@ -209,7 +209,7 @@
</Target>

<Target Name="_ReadGeneratedTrimmableTypeMapAssemblies"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' "
DependsOnTargets="_GenerateTrimmableTypeMap">
<MakeDir
Directories="$(_TypeMapOutputDirectory)"
Expand Down Expand Up @@ -290,7 +290,7 @@
skipped on incremental builds, which would leave the item group empty.
-->
<Target Name="_PrepareTrimmableNativeConfigAssemblies"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' "
BeforeTargets="_GeneratePackageManagerJava"
DependsOnTargets="_ReadGeneratedTrimmableTypeMapAssemblies">
<ItemGroup>
Expand All @@ -306,7 +306,7 @@
the item groups empty for targets such as Install.
-->
<Target Name="_PrepareTrimmableTypeMapAssemblies"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' "
Condition=" '$(AndroidTypeMapImplementation)' == 'trimmable' "
BeforeTargets="_CollectAssembliesToCompress;_GeneratePackageManagerJava;_RemoveRegisterAttribute"
DependsOnTargets="_ReadGeneratedTrimmableTypeMapAssemblies;_DefineBuildTargetAbis">
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public void MonoAndroidExportIsNotPackagedWithTrimmableTypeMap ()
},
};
proj.SetRuntime (runtime);
proj.SetProperty ("_AndroidTypeMapImplementation", "trimmable");
proj.SetProperty ("AndroidTypeMapImplementation", "trimmable");
proj.Sources.Add (new BuildItem.Source ("ContainsExportedMethods.cs") {
TextContent = () => @"using System;
using Java.Interop;
Expand Down
Loading
Loading