Skip to content

Commit 307d8e5

Browse files
[Xamarin.Android.Build.Tasks] introduce $(_AndroidJcwCodegenTarget)
d70db5b was *wrong* in that it merged two different things: * Java stub generation's "codegen target" (now settable by an MSBuild property `$(_AndroidCodeGenerationTarget)`) * C# generator's "codegen target" or `$(AndroidCodegenTarget)` The problem was `$(_AndroidCodeGenerationTarget)` was just poorly named making me think it was the same as `$(AndroidCodegenTarget)`. Partially revert d70db5b and use the name `$(_AndroidJcwCodegenTarget)` instead. NativeAOT now defaults to `$(_AndroidJcwCodegenTarget)=JavaInterop1` and `$(AndroidCodegenTarget)=XAJavaInterop1`.
1 parent c1e0d10 commit 307d8e5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
<!-- Bindings properties -->
4242
<!-- jar2xml is not supported -->
4343
<AndroidClassParser>class-parse</AndroidClassParser>
44-
<AndroidCodegenTarget Condition=" '$(AndroidCodegenTarget)' == '' and '$(_AndroidRuntime)' != 'NativeAOT' ">XAJavaInterop1</AndroidCodegenTarget>
44+
<AndroidCodegenTarget Condition=" '$(AndroidCodegenTarget)' == '' ">XAJavaInterop1</AndroidCodegenTarget>
45+
<_AndroidJcwCodegenTarget Condition=" '$(_AndroidJcwCodegenTarget)' == '' and '$(_AndroidRuntime)' != 'NativeAOT' ">XAJavaInterop1</_AndroidJcwCodegenTarget>
4546
<AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods Condition=" '$(AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods)' == '' ">true</AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods>
4647
<AndroidBoundInterfacesContainTypes Condition=" '$(AndroidBoundInterfacesContainTypes)' == '' ">true</AndroidBoundInterfacesContainTypes>
4748
<AndroidBoundInterfacesContainConstants Condition=" '$(AndroidBoundInterfacesContainConstants)' == '' ">true</AndroidBoundInterfacesContainConstants>

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This file contains the NativeAOT-specific MSBuild logic for .NET for Android.
1212
<!-- Default property values for NativeAOT -->
1313
<PropertyGroup>
1414
<_AndroidRuntimePackRuntime>NativeAOT</_AndroidRuntimePackRuntime>
15-
<AndroidCodegenTarget Condition=" '$(AndroidCodegenTarget)' == '' ">JavaInterop1</AndroidCodegenTarget>
15+
<_AndroidJcwCodegenTarget Condition=" '$(_AndroidJcwCodegenTarget)' == '' ">JavaInterop1</_AndroidJcwCodegenTarget>
1616
<!-- .NET SDK gives: error NETSDK1191: A runtime identifier for the property 'PublishAot' couldn't be inferred. Specify a rid explicitly. -->
1717
<AllowPublishAotWithoutRuntimeIdentifier Condition=" '$(AllowPublishAotWithoutRuntimeIdentifier)' == '' ">true</AllowPublishAotWithoutRuntimeIdentifier>
1818
<!-- NativeAOT's targets currently gives an error about cross-compilation -->

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ because xbuild doesn't support framework reference assemblies.
15161516

15171517
<GenerateJavaStubs
15181518
AndroidRuntime="$(_AndroidRuntime)"
1519-
CodeGenerationTarget="$(AndroidCodegenTarget)"
1519+
CodeGenerationTarget="$(_AndroidJcwCodegenTarget)"
15201520
ResolvedAssemblies="@(_ResolvedAssemblies)"
15211521
ResolvedUserAssemblies="@(_ResolvedUserMonoAndroidAssemblies)"
15221522
ErrorOnCustomJavaObject="$(AndroidErrorOnCustomJavaObject)"

0 commit comments

Comments
 (0)