Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f5fa9c1
trigger PR creation
simonrozsival Mar 21, 2026
c68f347
[TrimmableTypeMap] Build pipeline: targets, scanner, task, assembly s…
simonrozsival Mar 21, 2026
4ee4b24
Fix build: add AcwMapDirectory, update ManifestGenerator reference
simonrozsival Mar 22, 2026
d6dbe32
Simplify HelloWorld: avoid JavaCast<T> (workaround for disposed peer …
simonrozsival Mar 22, 2026
0e1c07b
Restore FindViewById<Button> sample (CreatePeer fix works)
simonrozsival Mar 22, 2026
a8f0048
Generate JCWs for framework Implementor types (mono/ prefix)
simonrozsival Mar 22, 2026
682d727
Remove JCW framework filter, fix native callback name tests
simonrozsival Mar 23, 2026
2b58fd2
Fix framework Implementor JCW generation (javac + runtime)
simonrozsival Mar 23, 2026
52482b1
Fix _RemoveRegisterAttribute for PublishTrimmed=true
simonrozsival Mar 23, 2026
24fb38a
Make _RemoveRegisterAttribute an empty target for trimmable path
simonrozsival Mar 23, 2026
cbcd220
Reset HelloWorld sample to base, keep trimmable typemap config
simonrozsival Mar 23, 2026
1c6ca6c
Address Copilot review feedback
simonrozsival Mar 23, 2026
233eeb9
Address review: fix acw-map.txt and JCW filter comments
simonrozsival Mar 23, 2026
0bf4537
Address review: fix Categories parsing, delete ManifestModel, documen…
simonrozsival Mar 23, 2026
2d03c56
Fix: reset Java.Interop submodule to match base
simonrozsival Mar 23, 2026
7e3c653
Fix test: JniNameToJavaName now converts $ to . for inner classes
simonrozsival Mar 23, 2026
d6f0660
Set TrimmableTypeMap=false for MonoVM and NativeAOT builds
simonrozsival Mar 24, 2026
443396d
Fix tests: get_TargetType inherited from JavaPeerProxy<T>
simonrozsival Mar 24, 2026
773eb4f
Fix: use IntermediateOutputPath for typemap output directory
simonrozsival Mar 25, 2026
4d4dc9f
Address review: incremental build, FileWrites, and error codes
simonrozsival Mar 25, 2026
6ceefe8
Wire AcwMapWriter to populate acw-map.txt in trimmable path (#11015)
simonrozsival Mar 25, 2026
384a5a8
Extract TrimmableTypeMapGenerator from MSBuild task
simonrozsival Mar 25, 2026
a4264d1
Address PR review feedback
simonrozsival Mar 25, 2026
56db71b
Address android-reviewer findings
simonrozsival Mar 25, 2026
6c3c7b3
Address android-reviewer findings (round 2)
simonrozsival Mar 25, 2026
9883930
Fix NativeAOT.targets: only set TrimmableTypeMap=true when _AndroidTy…
simonrozsival Mar 26, 2026
1a990b0
Revert NativeAOT TrimmableTypeMap wiring; defer to separate PR
simonrozsival Mar 26, 2026
03fb97e
[CI] Use CoreCLR for HelloWorld smoke test
simonrozsival Mar 26, 2026
3c1d9d7
Fix CI test failures
simonrozsival Mar 26, 2026
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 @@ -85,6 +85,7 @@ stages:
args: >-
build samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj
-p:AndroidSdkDirectory="$(HOME)/android-toolchain/sdk"
-p:UseMonoRuntime=false
-bl:$(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/build-helloworld.binlog

- template: /build-tools/automation/yaml-templates/upload-results.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ stages:
displayName: Test dotnet-local.sh
inputs:
scriptPath: dotnet-local.sh
args: build samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj
args: build samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj -p:UseMonoRuntime=false

- ${{ if ne(parameters.macTestAgentsUseCleanImages, true) }}:
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest110100preview3PackageVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
<MicrosoftTemplateEngineAuthoringTasksPackageVersion>11.0.100-preview.3.26171.106</MicrosoftTemplateEngineAuthoringTasksPackageVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.5-preview.26171.106</MicrosoftDotNetCecilPackageVersion>
<MSBuildPackageReferenceVersion>17.14.28</MSBuildPackageReferenceVersion>
<SystemIOHashingPackageVersion>9.0.4</SystemIOHashingPackageVersion>
<SystemReflectionMetadataPackageVersion>11.0.0-preview.1.26104.118</SystemReflectionMetadataPackageVersion>
<!-- Previous .NET Android version -->
Expand Down
1 change: 1 addition & 0 deletions samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>$(DotNetAndroidTargetFramework)</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>HelloWorld</RootNamespace>
<_AndroidTypeMapImplementation>trimmable</_AndroidTypeMapImplementation>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\HelloLibrary\HelloLibrary.DotNet.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,14 @@ internal static void ValidateJniName (string jniName)

/// <summary>
/// Converts a JNI type name to a Java source type name.
/// e.g., "android/app/Activity" \u2192 "android.app.Activity"
/// JNI uses '/' for packages and '$' for inner classes.
/// Java source uses '.' for both.
/// e.g., "android/app/Activity" → "android.app.Activity"
/// e.g., "android/drm/DrmManagerClient$OnEventListener" → "android.drm.DrmManagerClient.OnEventListener"
/// </summary>
internal static string JniNameToJavaName (string jniName)
{
return jniName.Replace ('/', '.');
return jniName.Replace ('/', '.').Replace ('$', '.');
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,30 @@ class ManifestGenerator
/// Generates the merged manifest and writes it to <paramref name="outputPath"/>.
/// Returns the list of additional content provider names (for ApplicationRegistration.java).
/// </summary>
public IList<string> Generate (
public IReadOnlyList<string> Generate (
string? manifestTemplatePath,
IReadOnlyList<JavaPeerInfo> allPeers,
AssemblyManifestInfo assemblyInfo,
string outputPath)
{
var doc = LoadOrCreateManifest (manifestTemplatePath);
XDocument? template = null;
if (!manifestTemplatePath.IsNullOrEmpty () && File.Exists (manifestTemplatePath)) {
template = XDocument.Load (manifestTemplatePath);
}
return Generate (template, allPeers, assemblyInfo, outputPath);
}

/// <summary>
/// Generates the merged manifest from an optional pre-loaded template and writes it to <paramref name="outputPath"/>.
/// Returns the list of additional content provider names (for ApplicationRegistration.java).
/// </summary>
public IReadOnlyList<string> Generate (
XDocument? manifestTemplate,
IReadOnlyList<JavaPeerInfo> allPeers,
AssemblyManifestInfo assemblyInfo,
string outputPath)
{
var doc = manifestTemplate ?? CreateDefaultManifest ();
var manifest = doc.Root;
if (manifest is null) {
throw new InvalidOperationException ("Manifest document has no root element.");
Expand Down Expand Up @@ -98,7 +115,7 @@ public IList<string> Generate (
var providerNames = AddRuntimeProviders (app);

// Set ApplicationJavaClass
if (!string.IsNullOrEmpty (ApplicationJavaClass) && app.Attribute (AttName) is null) {
if (!ApplicationJavaClass.IsNullOrEmpty () && app.Attribute (AttName) is null) {
app.SetAttributeValue (AttName, ApplicationJavaClass);
}

Expand Down Expand Up @@ -134,12 +151,8 @@ public IList<string> Generate (
return providerNames;
}

XDocument LoadOrCreateManifest (string? templatePath)
XDocument CreateDefaultManifest ()
{
if (!string.IsNullOrEmpty (templatePath) && File.Exists (templatePath)) {
return XDocument.Load (templatePath);
}

return new XDocument (
new XDeclaration ("1.0", "utf-8", null),
new XElement ("manifest",
Expand All @@ -151,18 +164,18 @@ void EnsureManifestAttributes (XElement manifest)
{
manifest.SetAttributeValue (XNamespace.Xmlns + "android", AndroidNs.NamespaceName);

if (string.IsNullOrEmpty ((string?)manifest.Attribute ("package"))) {
if (((string?)manifest.Attribute ("package")).IsNullOrEmpty ()) {
manifest.SetAttributeValue ("package", PackageName);
}

if (manifest.Attribute (AndroidNs + "versionCode") is null) {
manifest.SetAttributeValue (AndroidNs + "versionCode",
string.IsNullOrEmpty (VersionCode) ? "1" : VersionCode);
VersionCode.IsNullOrEmpty () ? "1" : VersionCode);
}

if (manifest.Attribute (AndroidNs + "versionName") is null) {
manifest.SetAttributeValue (AndroidNs + "versionName",
string.IsNullOrEmpty (VersionName) ? "1.0" : VersionName);
VersionName.IsNullOrEmpty () ? "1.0" : VersionName);
}

// Add <uses-sdk>
Expand All @@ -181,14 +194,14 @@ XElement EnsureApplicationElement (XElement manifest)
manifest.Add (app);
}

if (app.Attribute (AndroidNs + "label") is null && !string.IsNullOrEmpty (ApplicationLabel)) {
if (app.Attribute (AndroidNs + "label") is null && !ApplicationLabel.IsNullOrEmpty ()) {
app.SetAttributeValue (AndroidNs + "label", ApplicationLabel);
}

return app;
}

IList<string> AddRuntimeProviders (XElement app)
List<string> AddRuntimeProviders (XElement app)
{
string packageName = "mono";
string className = "MonoRuntimeProvider";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="$(MSBuildPackageReferenceVersion)" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MSBuildPackageReferenceVersion)" />
<PackageReference Include="System.IO.Hashing" Version="$(SystemIOHashingPackageVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataPackageVersion)" />
<InternalsVisibleTo Include="Microsoft.Android.Sdk.TrimmableTypeMap.Tests" Key="0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="..\..\src-ThirdParty\System.Runtime.CompilerServices\CompilerFeaturePolyfills.cs" Link="CompilerFeaturePolyfills.cs" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#nullable enable
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.Android.Sdk.TrimmableTypeMap;

// The static methods in System.String are not NRT annotated in netstandard2.0,
// so we need our own extension methods to make them nullable aware.
static class NullableExtensions
{
public static bool IsNullOrEmpty ([NotNullWhen (false)] this string? str)
{
return string.IsNullOrEmpty (str);
}

public static bool IsNullOrWhiteSpace ([NotNullWhen (false)] this string? str)
{
return string.IsNullOrWhiteSpace (str);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading