Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
356b2da
[TrimmableTypeMap] Fix JniNameToJavaName: convert inner class separat…
simonrozsival Mar 27, 2026
6f64c62
[TrimmableTypeMap] Fix NativeCallbackName and DeclaringType derivatio…
simonrozsival Mar 27, 2026
21facfc
[TrimmableTypeMap] Extract TrimmableTypeMapGenerator from MSBuild task
simonrozsival Mar 27, 2026
b272b68
Keep per-assembly acw-map generation in MSBuild task
simonrozsival Mar 27, 2026
4be0136
Address review: restore assembly filtering, add input validation
simonrozsival Mar 27, 2026
4f5c013
Split tests: generator logic → TrimmableTypeMap.Tests, MSBuild → Buil…
simonrozsival Mar 27, 2026
79c1d05
Restore AcwMapDirectory doc comment, scan all assemblies
simonrozsival Mar 27, 2026
68f2409
Move ParseTargetFrameworkVersion to GenerateTrimmableTypeMap task
simonrozsival Mar 27, 2026
0496fbc
[TrimmableTypeMap] Add assembly-level manifest attribute scanning
simonrozsival Mar 27, 2026
bde5a24
[TrimmableTypeMap] Assembly-level attribute scanning + manifest model…
simonrozsival Mar 27, 2026
6867adf
Merge remote-tracking branches 'origin/dev/simonrozsival/fix-jni-inne…
simonrozsival Mar 27, 2026
685aed5
PR 4: Build pipeline changes for trimmable typemap
simonrozsival Mar 27, 2026
1183f9d
Address review fixes
simonrozsival Mar 27, 2026
5072ced
Address review: fix attribute ordering bug, remove redundant #nullabl…
simonrozsival Mar 27, 2026
1f2243c
Merge branch 'dev/simonrozsival/extract-trimmable-typemap-generator' …
simonrozsival Mar 27, 2026
c6188dd
Merge branch 'dev/simonrozsival/scanner-manifest-attributes' into dev…
simonrozsival Mar 27, 2026
db8fc87
Address review: remove #nullable enable, use IsNullOrEmpty extension
simonrozsival Mar 27, 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
@@ -1,4 +1,3 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable enable

using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable enable

using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable enable

using System;
using System.Globalization;
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
@@ -1,4 +1,3 @@
#nullable enable

using System.Xml.Linq;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable enable

using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -46,7 +45,24 @@ public IList<string> Generate (
AssemblyManifestInfo assemblyInfo,
string outputPath)
{
var doc = LoadOrCreateManifest (manifestTemplatePath);
XDocument? template = null;
if (!string.IsNullOrEmpty (manifestTemplatePath) && 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 IList<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 @@ -134,12 +150,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 Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable enable

using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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);
}
}
Loading