Skip to content

Commit d70db5b

Browse files
[Xamarin.Android.Build.Tasks] unify $(AndroidCodegenTarget) (#9806)
Context: dbb0b92 Context: 5f4d223 Commit dbb0b92 introduced `$(_AndroidCodeGenerationTarget)`, but I didn't notice that `$(AndroidCodegenTarget)` already exists! Unify on `$(AndroidCodegenTarget)`, making the defaults: * `$(AndroidCodegenTarget)=XAJavaInterop1` if blank, when *not* using NativeAOT (the default) * `$(AndroidCodegenTarget)=JavaInterop1` if blank, when using NativeAOT. See 5f4d223 for rationale.
1 parent ee382e1 commit d70db5b

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

Documentation/docs-mobile/building-apps/build-properties.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ Possible values include:
273273
Xamarin.Android 6.1 or later. Xamarin.Android 6.1 and later bind
274274
`Mono.Android.dll` with this value.
275275

276+
- **JavaInterop1**: experimental value, currently the default for the
277+
NativeAOT runtime.
278+
276279
The default value is `XAJavaInterop1`.
277280

278281
## AndroidCreatePackagePerAbi

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
<!-- Bindings properties -->
4141
<!-- jar2xml is not supported -->
4242
<AndroidClassParser>class-parse</AndroidClassParser>
43-
<!-- Anything other than XAJavaInterop1 is not supported -->
44-
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
43+
<AndroidCodegenTarget Condition=" '$(AndroidCodegenTarget)' == '' and '$(_AndroidRuntime)' != 'NativeAOT' ">XAJavaInterop1</AndroidCodegenTarget>
4544
<AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods Condition=" '$(AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods)' == '' ">true</AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods>
4645
<AndroidBoundInterfacesContainTypes Condition=" '$(AndroidBoundInterfacesContainTypes)' == '' ">true</AndroidBoundInterfacesContainTypes>
4746
<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-
<_AndroidCodeGenerationTarget Condition=" '$(_AndroidCodeGenerationTarget)' == '' ">JavaInterop1</_AndroidCodeGenerationTarget>
15+
<AndroidCodegenTarget Condition=" '$(AndroidCodegenTarget)' == '' ">JavaInterop1</AndroidCodegenTarget>
1616
<!-- NativeAOT's targets currently gives an error about cross-compilation -->
1717
<DisableUnsupportedError Condition=" $([MSBuild]::IsOSPlatform('windows')) and '$(DisableUnsupportedError)' == '' ">true</DisableUnsupportedError>
1818
</PropertyGroup>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ Copyright (C) 2012 Xamarin Inc. All rights reserved.
4747
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(AndroidUseLatestPlatformSdk)' == 'False'">v5.0</TargetFrameworkVersion>
4848
<LangVersion Condition=" '$(LangVersion)' == '' ">8.0</LangVersion>
4949
<AndroidClassParser Condition=" '$(AndroidClassParser)' == '' ">jar2xml</AndroidClassParser>
50-
<AndroidCodegenTarget Condition=" '$(AndroidCodegenTarget)' == '' ">XAJavaInterop1</AndroidCodegenTarget>
5150
<_AndroidIsBindingProject>True</_AndroidIsBindingProject>
5251
</PropertyGroup>
5352

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

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

15091509
<GenerateJavaStubs
15101510
AndroidRuntime="$(_AndroidRuntime)"
1511-
CodeGenerationTarget="$(_AndroidCodeGenerationTarget)"
1511+
CodeGenerationTarget="$(AndroidCodegenTarget)"
15121512
ResolvedAssemblies="@(_ResolvedAssemblies)"
15131513
ResolvedUserAssemblies="@(_ResolvedUserMonoAndroidAssemblies)"
15141514
ErrorOnCustomJavaObject="$(AndroidErrorOnCustomJavaObject)"

0 commit comments

Comments
 (0)