Skip to content

Commit 71ade6f

Browse files
Address review: fix acw-map.txt and JCW filter comments
- acw-map.txt: restore AlwaysCreate=true (downstream targets use it as Input). Add comment explaining it's an empty placeholder for the trimmable path. - Fix misleading JCW filter comment: framework types don't have pre-generated compatible JCWs yet. The filter is about framework binding types being in java_runtime.dex. Reference #10792 for future pre-generation work. Co-authored-by: Copilot <[email protected]>
1 parent d7cdfae commit 71ade6f

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable.targets‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@
130130
SkipUnchangedFiles="true"
131131
Condition="Exists('$(_TypeMapBaseOutputDir)AndroidManifest.xml')" />
132132

133-
<Touch Files="$(IntermediateOutputPath)acw-map.txt"
134-
AlwaysCreate="true"
135-
Condition=" !Exists('$(IntermediateOutputPath)acw-map.txt') " />
133+
<!-- acw-map.txt is consumed as an Input by _ConvertCustomView and _UpdateAndroidResgen.
134+
Create an empty file if it doesn't exist yet. The trimmable path doesn't populate it
135+
(no Cecil-based ACW mapping), but it must exist for downstream targets to evaluate. -->
136+
<Touch Files="$(IntermediateOutputPath)acw-map.txt" AlwaysCreate="true" />
136137

137138
<MakeDir Directories="$(IntermediateOutputPath)android\src\net\dot\android" />
138139
<WriteLinesToFile

‎src/Xamarin.Android.Build.Tasks/Tasks/GenerateTrimmableTypeMap.cs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ public override bool RunTask ()
118118
// don't carry this metadata. The scanner handles non-Java assemblies gracefully.
119119
var assemblyPaths = ResolvedAssemblies.Select (i => i.ItemSpec).Distinct ().ToList ();
120120

121-
// Framework/runtime-pack assemblies (Mono.Android, Java.Interop, etc.) already have JCW .java
122-
// files in the SDK. Only generate JCWs for user assemblies. Detect framework assemblies via
123-
// FrameworkReferenceName (not NuGetPackageId — user libraries from NuGet need JCWs too).
121+
// Framework binding types (Activity, View, etc.) already exist in java_runtime.dex and don't
122+
// need JCW .java files. Framework Implementor types (mono/ prefix, e.g. OnClickListenerImplementor)
123+
// DO need JCWs — they're included via the mono/ filter below.
124+
// User NuGet libraries also need JCWs, so we only filter by FrameworkReferenceName.
125+
// Note: Pre-generating SDK-compatible JCWs (mono.android-trimmable.jar) is tracked by #10792.
124126
var frameworkAssemblyNames = new HashSet<string> (StringComparer.OrdinalIgnoreCase);
125127
foreach (var item in ResolvedAssemblies) {
126128
if (!item.GetMetadata ("FrameworkReferenceName").IsNullOrEmpty ()) {

0 commit comments

Comments
 (0)