Skip to content

Commit c942ab6

Browse files
authored
[java-source-utils] Build one $(TargetFramework) (#1007)
Context: dotnet/android#7157 Ever since commit 69e1b80, `java-source-utils.csproj` used the `$(TargetFrameworks)` plural form, even though it only specified a single framework. I don't remember underlying reason for this, other than "that's what I needed for it to build," which might have been because the `_BuildJava` target was "wrong". This arrangement was "fine", until dotnet/android@2197a459, after which the xamarin-android/main CI builds started behaving "weird": frequently `make all-tests` would fail, because `make jenkins` would produce an invalid or corrupt `java-source-utils.jar`, *apparently* because it was attempting to *concurrently build* `java-source-utils.csproj` (?!). One of these concurrent builds *appeared* to be an "outer build" from `Xamarin.Android.sln`, while another one appeared to be an "inner build" via `apksigner.csproj` and `%(ProjectReference.AdditionalProperties)`: 17:53:44.526 59:11>Target "_BuildJava: (TargetId:490)" in file "/Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/java-source-utils/java-source-utils.targets" from project "/Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/java-source-utils/java-source-utils.csproj" (entry point): 17:53:44.526 59:11>Building target "_BuildJava" completely. Output file "/Users/runner/work/1/s/xamarin-android/bin/Release/lib/packs/Microsoft.Android.Sdk.Darwin/33.0.0/tools/java-source-utils.jar" does not exist. … 17:54:19.564 59:12>Target "DispatchToInnerBuilds: (TargetId:1637)" in file "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/sdk/7.0.100-preview.7.22354.2/Microsoft.Common.CrossTargeting.targets" from project "/Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/java-source-utils/java-source-utils.csproj" (target "Build" depends on it): Task "MSBuild" (TaskId:1099) Task Parameter:BuildInParallel=True (TaskId:1099) Task Parameter:Targets=Build (TaskId:1099) Task Parameter: Projects= java-source-utils.csproj AdditionalProperties=TargetFramework=net7.0 (TaskId:1099) Additional Properties for project "java-source-utils.csproj": (TaskId:1099) TargetFramework=net7.0 (TaskId:1099) … 17:54:19.592 59:12>Target "_BuildJava: (TargetId:1640)" in file "/Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/java-source-utils/java-source-utils.targets" from project "/Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/java-source-utils/java-source-utils.csproj" (entry point): Building target "_BuildJava" completely. Output file "/Users/runner/work/1/s/xamarin-android/external/Java.Interop/../../bin/Release/lib/xamarin.android/xbuild/Xamarin/Android/java-source-utils.jar" does not exist. … 17:54:41.034 59:11>Done building target "_BuildJava" in project "java-source-utils.csproj".: (TargetId:490) We attempted to fix this by removing `%(ProjectReference.AdditionalProperties)`, which only slightly changed things: the "outer build via `Xamarin.Android.sln`" build was removed, but we instead saw a scenario in which `java-source-utils.csproj` was built "once", and as part of that build the "outer" and "inner" builds were run concurrently. A commonality here is `$(TargetFrameworks)` requires "outer" and "inner" builds, and that is a complication that we should remove. Update `java-source-utils.csproj` so that singular `$(TargetFramework)` is used, not plural `$(TargetFrameworks)`. Update the `_BuildJava` target so that it runs before the `GetCopyToOutputDirectoryItems` target. This is consistent with how the [`_BuildGradle` target in `apksigner.csproj`][0] works. Without this change -- and the removal of the empty `Build` target -- the `java-source-utils.csproj` build didn't behave correctly (`gradlew` wasn't run). Unfortunately, this seemingly simple change hits a little "snag": `Directory.Build.props` is imported [very early][1]: > *Directory.Build.props* is imported very early in > *Microsoft.Common.props*, and properties defined later are > unavailable to it. "Properties defined later are unavailable to it." Properties such as `$(TargetFramework)`. Which means that every property we have in `Directory.Build.props` which "depends" on `$(TargetFramework)` *are not **actually** usable*. They've only *appeared* to work because they would default to "classic" paths, but as soon as you try to build with `$(TargetFramework)`=net7.0 -- as was attempted with `java-source-utils.csproj`, and previously with `Java.Base.csproj` (bc5bcf4) -- you'll find that the "wrong" directories are used for `$(OutputPath)`. This has been a long-standing deficiency in my MSBuild understanding. Fix this by adding a new `TargetFrameworkDependentValues.props` file, and `<Import/>`ing this file in *every* `.csproj` which uses MSBuild properties with values dependent upon `$(TargetFramework)` *before* those properties are set. Old and busted: <PropertyGroup> <TargetFramework>net7.0</TargetFramework> <OutputPath>$(UtilityOutputFullPath)</OutputPath> </PropertyGroup> New hawtness: <PropertyGroup> <TargetFramework>net7.0</TargetFramework> </PropertyGroup> <Import Project="..\..\TargetFrameworkDependentValues.props" /> <PropertyGroup> <OutputPath>$(UtilityOutputFullPath)</OutputPath> </PropertyGroup> [0]: https://github.com/xamarin/xamarin-android/blob/c537dd28c30f482f365ef756214be35aa1553da2/src/apksigner/apksigner.targets#L3-L13 [1]: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2022#import-order
1 parent b7caa78 commit c942ab6

File tree

50 files changed

+168
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+168
-62
lines changed

Directory.Build.props

+1-43
Original file line numberDiff line numberDiff line change
@@ -61,29 +61,7 @@
6161
<AppendTargetFrameworkToOutputPath Condition=" '$(AppendTargetFrameworkToOutputPath)' == '' ">False</AppendTargetFrameworkToOutputPath>
6262
<BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">obj\</BaseIntermediateOutputPath>
6363
</PropertyGroup>
64-
<PropertyGroup Condition=" '$(TargetFramework)' != '' And (!$(TargetFramework.StartsWith('nets')) And !$(TargetFramework.StartsWith('net4')) And !$(TargetFramework.StartsWith('monoandroid'))) ">
65-
<JIBuildingForNetCoreApp>True</JIBuildingForNetCoreApp>
66-
</PropertyGroup>
67-
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">
68-
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)-$(TargetFramework.ToLowerInvariant())</IntermediateOutputPath>
69-
<BuildToolOutputFullPath>$(MSBuildThisFileDirectory)bin\Build$(Configuration)-$(TargetFramework.ToLowerInvariant())\</BuildToolOutputFullPath>
70-
<ToolOutputFullPath>$(MSBuildThisFileDirectory)bin\$(Configuration)-$(TargetFramework.ToLowerInvariant())\</ToolOutputFullPath>
71-
<TestOutputFullPath>$(MSBuildThisFileDirectory)bin\Test$(Configuration)-$(TargetFramework.ToLowerInvariant())\</TestOutputFullPath>
72-
<UtilityOutputFullPath Condition=" '$(UtilityOutputFullPathCoreApps)' != '' ">$(UtilityOutputFullPathCoreApps)</UtilityOutputFullPath>
73-
<UtilityOutputFullPath Condition=" '$(UtilityOutputFullPathCoreApps)' == '' ">$(ToolOutputFullPath)</UtilityOutputFullPath>
74-
<RollForward>Major</RollForward>
75-
<JIUtilityVersion>$(JINetToolVersion)</JIUtilityVersion>
76-
<JICoreLibVersion>$(JINetCoreLibVersion)</JICoreLibVersion>
77-
</PropertyGroup>
78-
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">
79-
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)</IntermediateOutputPath>
80-
<BuildToolOutputFullPath>$(MSBuildThisFileDirectory)bin\Build$(Configuration)\</BuildToolOutputFullPath>
81-
<ToolOutputFullPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\</ToolOutputFullPath>
82-
<TestOutputFullPath>$(MSBuildThisFileDirectory)bin\Test$(Configuration)\</TestOutputFullPath>
83-
<UtilityOutputFullPath Condition=" '$(UtilityOutputFullPath)' == '' ">$(ToolOutputFullPath)</UtilityOutputFullPath>
84-
<JIUtilityVersion>$(JIOldToolVersion)</JIUtilityVersion>
85-
<JICoreLibVersion>$(JIOldCoreLibVersion)</JICoreLibVersion>
86-
</PropertyGroup>
64+
8765
<PropertyGroup>
8866
<XamarinAndroidToolsDirectory Condition=" '$(XamarinAndroidToolsDirectory)' == '' ">$(MSBuildThisFileDirectory)external\xamarin-android-tools</XamarinAndroidToolsDirectory>
8967
</PropertyGroup>
@@ -102,13 +80,6 @@
10280
<_XamarinAndroidCecilPath Condition=" '$(CecilSourceDirectory)' != '' And Exists('$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll') ">$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll</_XamarinAndroidCecilPath>
10381
<XamarinAndroidToolsFullPath>$([System.IO.Path]::GetFullPath ('$(XamarinAndroidToolsDirectory)'))</XamarinAndroidToolsFullPath>
10482
</PropertyGroup>
105-
<PropertyGroup>
106-
<Runtime Condition="'$(OS)' != 'Windows_NT'">mono</Runtime>
107-
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(BuildToolOutputFullPath)jnienv-gen.dll</_JNIEnvGenPath>
108-
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(BuildToolOutputFullPath)jnienv-gen.exe</_JNIEnvGenPath>
109-
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(DotnetToolPath) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
110-
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(Runtime) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
111-
</PropertyGroup>
11283

11384
<!--
11485
When building on a bot w/ VS2019:
@@ -126,17 +97,4 @@
12697
<NoWarn>$(NoWarn);CS8032;CS8981</NoWarn>
12798
</PropertyGroup>
12899

129-
<!-- The net6.0 versions of these are stricter and require overloads not available in .NET Framework, so start with just .NET Framework -->
130-
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">
131-
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
132-
<WarningsAsErrors>$(WarningsAsErrors);CA1307;CA1309;CA1310</WarningsAsErrors>
133-
</PropertyGroup>
134-
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">
135-
<NoWarn>$(NoWarn);CA1307;CA1309;CA1310</NoWarn>
136-
</PropertyGroup>
137-
138-
<PropertyGroup>
139-
<Version>$(JIUtilityVersion)</Version>
140-
</PropertyGroup>
141-
142100
</Project>

TargetFrameworkDependentValues.props

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
4+
<PropertyGroup Condition=" '$(TargetFramework)' != '' And (!$(TargetFramework.StartsWith('nets')) And !$(TargetFramework.StartsWith('net4')) And !$(TargetFramework.StartsWith('monoandroid'))) ">
5+
<JIBuildingForNetCoreApp>True</JIBuildingForNetCoreApp>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">
9+
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)-$(TargetFramework.ToLowerInvariant())\</IntermediateOutputPath>
10+
<BuildToolOutputFullPath>$(MSBuildThisFileDirectory)bin\Build$(Configuration)-$(TargetFramework.ToLowerInvariant())\</BuildToolOutputFullPath>
11+
<ToolOutputFullPath>$(MSBuildThisFileDirectory)bin\$(Configuration)-$(TargetFramework.ToLowerInvariant())\</ToolOutputFullPath>
12+
<TestOutputFullPath>$(MSBuildThisFileDirectory)bin\Test$(Configuration)-$(TargetFramework.ToLowerInvariant())\</TestOutputFullPath>
13+
<UtilityOutputFullPath Condition=" '$(UtilityOutputFullPathCoreApps)' != '' ">$(UtilityOutputFullPathCoreApps)</UtilityOutputFullPath>
14+
<UtilityOutputFullPath Condition=" '$(UtilityOutputFullPathCoreApps)' == '' ">$(ToolOutputFullPath)</UtilityOutputFullPath>
15+
<RollForward>Major</RollForward>
16+
<JIUtilityVersion>$(JINetToolVersion)</JIUtilityVersion>
17+
<JICoreLibVersion>$(JINetCoreLibVersion)</JICoreLibVersion>
18+
</PropertyGroup>
19+
20+
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">
21+
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)</IntermediateOutputPath>
22+
<BuildToolOutputFullPath>$(MSBuildThisFileDirectory)bin\Build$(Configuration)\</BuildToolOutputFullPath>
23+
<ToolOutputFullPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\</ToolOutputFullPath>
24+
<TestOutputFullPath>$(MSBuildThisFileDirectory)bin\Test$(Configuration)\</TestOutputFullPath>
25+
<UtilityOutputFullPath Condition=" '$(UtilityOutputFullPath)' == '' ">$(ToolOutputFullPath)</UtilityOutputFullPath>
26+
<JIUtilityVersion>$(JIOldToolVersion)</JIUtilityVersion>
27+
<JICoreLibVersion>$(JIOldCoreLibVersion)</JICoreLibVersion>
28+
</PropertyGroup>
29+
30+
<PropertyGroup>
31+
<Runtime Condition="'$(OS)' != 'Windows_NT'">mono</Runtime>
32+
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(BuildToolOutputFullPath)jnienv-gen.dll</_JNIEnvGenPath>
33+
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(BuildToolOutputFullPath)jnienv-gen.exe</_JNIEnvGenPath>
34+
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(DotnetToolPath) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
35+
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(Runtime) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
36+
</PropertyGroup>
37+
38+
<!-- The net6.0 versions of these are stricter and require overloads not available in .NET Framework, so start with just .NET Framework -->
39+
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">
40+
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
41+
<WarningsAsErrors>$(WarningsAsErrors);CA1307;CA1309;CA1310</WarningsAsErrors>
42+
</PropertyGroup>
43+
44+
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">
45+
<NoWarn>$(NoWarn);CA1307;CA1309;CA1310</NoWarn>
46+
</PropertyGroup>
47+
48+
<PropertyGroup>
49+
<Version>$(JIUtilityVersion)</Version>
50+
</PropertyGroup>
51+
52+
</Project>

build-tools/Java.Interop.BootstrapTasks/Java.Interop.BootstrapTasks.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
6+
</PropertyGroup>
7+
8+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
9+
10+
<PropertyGroup>
611
<OutputPath>$(BuildToolOutputFullPath)</OutputPath>
712
</PropertyGroup>
813

914
<PropertyGroup>
15+
<OutputPath>$(BuildToolOutputFullPath)</OutputPath>
1016
<GitDefaultBranch>main</GitDefaultBranch>
1117
<GitThisAssembly>false</GitThisAssembly>
1218
</PropertyGroup>

build-tools/jnienv-gen/jnienv-gen.csproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
<OutputType>Exe</OutputType>
55
<TargetFrameworks>net472;$(DotNetTargetFramework)</TargetFrameworks>
66
<IsPackable>false</IsPackable>
7-
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\</IntermediateOutputPath>
87
</PropertyGroup>
98

9+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
10+
1011
<PropertyGroup>
12+
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\</IntermediateOutputPath>
1113
<OutputPath>$(BuildToolOutputFullPath)</OutputPath>
1214
</PropertyGroup>
1315

src/Java.Base/Java.Base.csproj

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>$(DotNetTargetFramework)</TargetFrameworks>
4+
<TargetFramework>$(DotNetTargetFramework)</TargetFramework>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
66
<Nullable>enable</Nullable>
77
<!-- TODO: CS0108 is due to e.g. interfaces re-abstracting default interface methods -->
88
<NoWarn>$(NoWarn);8764;CS0108</NoWarn>
9+
</PropertyGroup>
10+
11+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
12+
13+
<PropertyGroup>
914
<Version>$(JICoreLibVersion)</Version>
1015
</PropertyGroup>
1116

src/Java.Interop.Dynamic/Java.Interop.Dynamic.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<AssemblyTitle>Java.Interop.Dynamic</AssemblyTitle>
1212
<Version>$(JICoreLibVersion)</Version>
1313
</PropertyGroup>
14+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
1415
<PropertyGroup>
1516
<OutputPath>$(ToolOutputFullPath)</OutputPath>
1617
</PropertyGroup>

src/Java.Interop.Export/Java.Interop.Export.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
<SignAssembly>true</SignAssembly>
99
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
1010
<AssemblyTitle>Java.Interop.Export</AssemblyTitle>
11-
<Version>$(JICoreLibVersion)</Version>
1211
</PropertyGroup>
12+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
1313
<PropertyGroup>
1414
<OutputPath>$(ToolOutputFullPath)</OutputPath>
15+
<Version>$(JICoreLibVersion)</Version>
1516
</PropertyGroup>
1617
<ItemGroup>
1718
<ProjectReference Include="..\Java.Interop\Java.Interop.csproj">

src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
99
<AssemblyTitle>Java.Interop.GenericMarshaler</AssemblyTitle>
1010
</PropertyGroup>
11+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
1112
<PropertyGroup>
1213
<OutputPath>$(ToolOutputFullPath)</OutputPath>
1314
<Version>$(JICoreLibVersion)</Version>

src/Java.Interop.Localization/Java.Interop.Localization.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
1111
</PropertyGroup>
1212

13+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
14+
1315
<ItemGroup>
1416
<PackageReference Include="XliffTasks" />
1517
</ItemGroup>

src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil.csproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
1010
</PropertyGroup>
1111

12-
<Import Project="..\..\build-tools\scripts\cecil.projitems" />
12+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
1313

1414
<PropertyGroup>
1515
<OutputPath>$(ToolOutputFullPath)</OutputPath>
1616
</PropertyGroup>
1717

18+
<Import Project="..\..\build-tools\scripts\cecil.projitems" />
19+
1820
<ItemGroup>
1921
<Compile Include="..\utils\NullableAttributes.cs" />
2022
</ItemGroup>

src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics.csproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
1010
</PropertyGroup>
1111

12-
<Import Project="..\..\build-tools\scripts\cecil.projitems" />
12+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
1313

1414
<PropertyGroup>
1515
<OutputPath>$(ToolOutputFullPath)</OutputPath>
1616
</PropertyGroup>
1717

18+
<Import Project="..\..\build-tools\scripts\cecil.projitems" />
19+
1820
<ItemGroup>
1921
<Compile Include="..\utils\NullableAttributes.cs" />
2022
</ItemGroup>

src/Java.Interop.Tools.Generator/Java.Interop.Tools.Generator.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<DefineConstants>INTERNAL_NULLABLE_ATTRIBUTES</DefineConstants>
88
</PropertyGroup>
99

10+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
11+
1012
<PropertyGroup>
1113
<OutputPath>$(UtilityOutputFullPath)</OutputPath>
1214
</PropertyGroup>

src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
1010
</PropertyGroup>
1111

12+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
13+
1214
<PropertyGroup>
1315
<OutputPath>$(ToolOutputFullPath)</OutputPath>
1416
</PropertyGroup>

src/Java.Interop.Tools.JavaSource/Java.Interop.Tools.JavaSource.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<ProjectGuid>{5C0B3562-8DA0-4726-9762-75B9709ED6B7}</ProjectGuid>
99
<AssemblyTitle>Java.Interop.Tools.JavaSource</AssemblyTitle>
1010
</PropertyGroup>
11+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
1112
<PropertyGroup>
1213
<OutputPath>$(ToolOutputFullPath)</OutputPath>
1314
</PropertyGroup>

src/Java.Interop.Tools.JavaTypeSystem/Java.Interop.Tools.JavaTypeSystem.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<LangVersion>8.0</LangVersion>
88
</PropertyGroup>
99

10+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
11+
1012
<PropertyGroup>
1113
<OutputPath>$(TestOutputFullPath)</OutputPath>
1214
</PropertyGroup>

src/Java.Interop/Java.Interop-MonoAndroid.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
2727
</PropertyGroup>
2828
<Import Project="..\..\Directory.Build.props" />
29+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
2930
<PropertyGroup>
3031
<Version>0.1.0.0</Version>
3132
<XAConfigPath>..\..\bin\Build$(Configuration)\XAConfig.props</XAConfigPath>

src/Java.Interop/Java.Interop.csproj

+9-6
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@
2222
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
2323
<DefineConstants>INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES;$(JavaInteropDefineConstants)</DefineConstants>
2424
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
25+
<Nullable>enable</Nullable>
26+
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
27+
<MSBuildWarningsAsMessages>NU1702</MSBuildWarningsAsMessages>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
30+
<DefineConstants>DEBUG;$(DefineConstants)</DefineConstants>
31+
</PropertyGroup>
32+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
33+
<PropertyGroup>
2534
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\</IntermediateOutputPath>
2635
<OutputPath>$(ToolOutputFullPath)</OutputPath>
2736
<DocumentationFile>$(ToolOutputFullPath)Java.Interop.xml</DocumentationFile>
2837
<JNIEnvGenPath>$(BuildToolOutputFullPath)</JNIEnvGenPath>
2938
<LangVersion Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">9.0</LangVersion>
3039
<LangVersion Condition=" '$(LangVersion)' == '' ">8.0</LangVersion>
31-
<Nullable>enable</Nullable>
32-
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
33-
<MSBuildWarningsAsMessages>NU1702</MSBuildWarningsAsMessages>
3440
<Version>$(JICoreLibVersion)</Version>
3541
</PropertyGroup>
36-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
37-
<DefineConstants>DEBUG;$(DefineConstants)</DefineConstants>
38-
</PropertyGroup>
3942
<ItemGroup>
4043
<Compile Condition=" '$(TargetFramework)' == 'netstandard2.0' " Include="..\utils\NullableAttributes.cs" />
4144
<Compile Remove="Java.Interop\JniLocationException.cs" />

src/Java.Interop/Java.Interop.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project>
33
<ItemGroup>
44
<CompileJavaInteropJar Include="java\com\xamarin\java_interop\internal\JavaProxyObject.java" />
55
<CompileJavaInteropJar Include="java\com\xamarin\java_interop\internal\JavaProxyThrowable.java" />

src/Java.Runtime.Environment/Java.Runtime.Environment.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<MSBuildWarningsAsMessages>NU1702</MSBuildWarningsAsMessages>
1111
</PropertyGroup>
1212

13+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
14+
1315
<PropertyGroup>
1416
<OutputPath>$(TestOutputFullPath)</OutputPath>
1517
<Version>$(JICoreLibVersion)</Version>

src/Xamarin.Android.Tools.AnnotationSupport.Cecil/Xamarin.Android.Tools.AnnotationSupport.Cecil.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
</PropertyGroup>
66

7+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
8+
79
<PropertyGroup>
810
<OutputPath>$(TestOutputFullPath)</OutputPath>
911
</PropertyGroup>

src/Xamarin.Android.Tools.AnnotationSupport/Xamarin.Android.Tools.AnnotationSupport.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
</PropertyGroup>
66

7+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
8+
79
<PropertyGroup>
810
<OutputPath>$(TestOutputFullPath)</OutputPath>
911
</PropertyGroup>

src/Xamarin.Android.Tools.ApiXmlAdjuster/Xamarin.Android.Tools.ApiXmlAdjuster.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<DefineConstants>INTERNAL_NULLABLE_ATTRIBUTES</DefineConstants>
88
</PropertyGroup>
99

10+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
11+
1012
<PropertyGroup>
1113
<OutputPath>$(TestOutputFullPath)</OutputPath>
1214
</PropertyGroup>

src/Xamarin.Android.Tools.Bytecode/Xamarin.Android.Tools.Bytecode.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<Nullable>enable</Nullable>
1010
</PropertyGroup>
1111

12+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
13+
1214
<PropertyGroup>
1315
<OutputPath>$(TestOutputFullPath)</OutputPath>
1416
</PropertyGroup>

src/Xamarin.SourceWriter/Xamarin.SourceWriter.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
</PropertyGroup>
66

7+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
8+
79
</Project>

src/java-interop/java-interop.csproj

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
<Project Sdk="Microsoft.Build.NoTargets">
22
<PropertyGroup>
33
<TargetFrameworks>net472;$(DotNetTargetFramework)</TargetFrameworks>
4-
<OutputPath>$(ToolOutputFullPath)</OutputPath>
5-
<JNIEnvGenPath>$(BuildToolOutputFullPath)</JNIEnvGenPath>
64
<OutputName>java-interop</OutputName>
75
<DefineSymbols>JI_DLL_EXPORT MONODEVELOP JAVA_INTEROP_DLL_EXPORT</DefineSymbols>
86
<SourceDirectory>.</SourceDirectory>
97
</PropertyGroup>
108

9+
<Import Project="..\..\TargetFrameworkDependentValues.props" />
10+
11+
<PropertyGroup>
12+
<OutputPath>$(ToolOutputFullPath)</OutputPath>
13+
<JNIEnvGenPath>$(BuildToolOutputFullPath)</JNIEnvGenPath>
14+
</PropertyGroup>
15+
1116
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1217
<DefineConstants>DEBUG $(DefineConstants)</DefineConstants>
1318
</PropertyGroup>

0 commit comments

Comments
 (0)