Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<AppendTargetFrameworkToOutputPath Condition=" '$(AppendTargetFrameworkToOutputPath)' == '' ">False</AppendTargetFrameworkToOutputPath>
<BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' != '' And $(TargetFramework.StartsWith ('netcoreapp')) ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<JIBuildingForNetCoreApp>True</JIBuildingForNetCoreApp>
</PropertyGroup>
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">
Expand All @@ -50,6 +50,7 @@
<XamarinAndroidToolsDirectory Condition=" '$(XamarinAndroidToolsDirectory)' == '' ">$(MSBuildThisFileDirectory)external\xamarin-android-tools</XamarinAndroidToolsDirectory>
</PropertyGroup>
<PropertyGroup>
<DotnetToolPath Condition=" '$(DotnetToolPath)' == '' ">dotnet</DotnetToolPath>
<CmakePath Condition=" '$(CmakePath)' == '' ">cmake</CmakePath>
<GradleHome Condition=" '$(GradleHome)' == '' ">$(MSBuildThisFileDirectory)build-tools\gradle</GradleHome>
<GradleWPath Condition=" '$(GradleWPath)' == '' ">$(GradleHome)\gradlew</GradleWPath>
Expand All @@ -67,7 +68,7 @@
<Runtime Condition="'$(OS)' != 'Windows_NT'">mono</Runtime>
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(BuildToolOutputFullPath)jnienv-gen.dll</_JNIEnvGenPath>
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(BuildToolOutputFullPath)jnienv-gen.exe</_JNIEnvGenPath>
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">dotnet "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(DotnetToolPath) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(Runtime) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class JdkInfo : Task

public string MaximumJdkVersion { get; set; }

public string DotnetToolPath { get; set; }

static Regex VersionExtractor = new Regex (@"(?<version>[\d]+(\.\d+)+)", RegexOptions.Compiled);

[Required]
Expand Down Expand Up @@ -95,6 +97,7 @@ Action<TraceLevel, string> CreateLogger ()

void WritePropertyFile (string javaPath, string jarPath, string javacPath, string jdkJvmPath, string rtJarPath, IEnumerable<string> includes)
{
var dotnet = string.IsNullOrEmpty (DotnetToolPath) ? "dotnet" : DotnetToolPath;
var msbuild = XNamespace.Get ("http://schemas.microsoft.com/developer/msbuild/2003");
var project = new XElement (msbuild + "Project",
new XElement (msbuild + "Choose",
Expand All @@ -112,6 +115,8 @@ void WritePropertyFile (string javaPath, string jarPath, string javacPath, strin
javacPath),
new XElement (msbuild + "JarPath", new XAttribute ("Condition", " '$(JarPath)' == '' "),
jarPath),
new XElement (msbuild + "DotnetToolPath", new XAttribute ("Condition", " '$(DotnetToolPath)' == '' "),
dotnet),
CreateJreRtJarPath (msbuild, rtJarPath)));
project.Save (PropertyFile.ItemSpec);
}
Expand Down
23 changes: 13 additions & 10 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ variables:
RunningOnCI: true
Build.Configuration: Release
MaxJdkVersion: 8
DotNetCoreVersion: 5.0.103
DotNetCoreVersion: 6.0.x
HostedMacImage: macOS-10.15
HostedWinVS2019: Hosted Windows 2019 with VS2019
NetCoreTargetFrameworkPathSuffix: -netcoreapp3.1
NetCoreTargetFrameworkPathSuffix: -net6.0
VSInstallRoot: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise

jobs:
Expand All @@ -38,15 +38,13 @@ jobs:

- template: templates\install-dependencies.yaml

- task: NuGetToolInstaller@0
- task: MSBuild@1
displayName: MSBuild Java.Interop.sln /t:Restore
inputs:
versionSpec: 5.x
solution: Java.Interop.sln
configuration: $(Build.Configuration)
msbuildArguments: /t:Restore /p:RestoreConfigFile=$(System.DefaultWorkingDirectory)\external\xamarin-android-tools\NuGet.config

- task: NuGetCommand@2
inputs:
command: custom
arguments: restore external\xamarin-android-tools\Xamarin.Android.Tools.sln -ConfigFile external\xamarin-android-tools\NuGet.config

- task: MSBuild@1
displayName: MSBuild Java.Interop.sln /t:Prepare
inputs:
Expand Down Expand Up @@ -108,7 +106,12 @@ jobs:
submodules: recursive

- template: templates\install-dependencies.yaml


- script: >
dotnet tool install --global boots &&
boots --preview Mono
displayName: Install Mono

- script: make prepare CONFIGURATION=$(Build.Configuration) JI_MAX_JDK=$(MaxJdkVersion)
displayName: make prepare

Expand Down
1 change: 1 addition & 0 deletions build-tools/automation/templates/install-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ steps:
displayName: Use .NET Core $(DotNetCoreVersion)
inputs:
version: $(DotNetCoreVersion)
includePreviewVersions: true
2 changes: 1 addition & 1 deletion build-tools/jnienv-gen/jnienv-gen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\</IntermediateOutputPath>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions build-tools/scripts/Prepare.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
JdksRoot="$(ProgramFiles)\Java"
MakeFragmentFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.mk"
MaximumJdkVersion="$(_MaxJdk)"
DotnetToolPath="$(DotnetToolPath)"
PropertyFile="$(_TopDir)\bin\Build$(Configuration)\JdkInfo.props">
<Output TaskParameter="JavaHomePath" PropertyName="_JavaSdkDirectory" />
</JdkInfo>
Expand Down
1 change: 1 addition & 0 deletions build-tools/scripts/jdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ endif # $(OS)=Linux
$(_INCLUDE_MK) $(_INCLUDE_PROPS): bin/Build$(CONFIGURATION)/Java.Interop.BootstrapTasks.dll
$(MSBUILD) $(MSBUILD_FLAGS) build-tools/scripts/jdk.targets /t:GetPreferredJdkRoot \
/p:JdksRoot="$(_JDKS_ROOT)" \
/p:DotnetToolPath="$(DOTNET_TOOL_PATH)" \
$(if $(JI_MAX_JDK),"/p:MaximumJdkVersion=$(JI_MAX_JDK)")
1 change: 1 addition & 0 deletions build-tools/scripts/jdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
JdksRoot="$(JdksRoot)"
MakeFragmentFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.mk"
MaximumJdkVersion="$(MaximumJdkVersion)"
DotnetToolPath="$(DotnetToolPath)"
PropertyFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props">
<Output TaskParameter="JavaHomePath" PropertyName="_JavaHome"/>
</JdkInfo>
Expand Down
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"sdk": {
"allowPrerelease": true
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "2.0.1"
}
Expand Down
2 changes: 1 addition & 1 deletion src/Java.Interop.Export/Java.Interop.Export.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<ProjectGuid>{B501D075-6183-4E1D-92C9-F7B5002475B1}</ProjectGuid>
<SignAssembly>true</SignAssembly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<ProjectReference Include="..\Java.Interop\Java.Interop.csproj">
<Project>{94BD81F7-B06F-4295-9636-F8A3B6BDC762}</Project>
<Name>Java.Interop</Name>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<AdditionalProperties>TargetFramework=netstandard2.0</AdditionalProperties>
</ProjectReference>
</ItemGroup>
</Project>
15 changes: 14 additions & 1 deletion src/Java.Interop/Java.Interop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@
<XAConfigPath>..\..\bin\Build$(Configuration)\XAConfig.props</XAConfigPath>
</PropertyGroup>
<Import Condition="Exists ('$(XAConfigPath)')" Project="$(XAConfigPath)" />
<!--
NOTE: in xamarin-android, this project gets built by xabuild in Xamarin.Android-Tests.sln
Exclude net6.0, because xabuild cannot build net5.0 or higher
-->
<PropertyGroup Condition=" '$(XABuild)' == 'true' ">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What sets $(XABuild)? I don't see any "obvious" references within xamarin-android:

% git grep '\<XABuild\>'
tools/xabuild/XABuild.cs:       class XABuild

Is this via some MSBuild magic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is magic, this XML file we generate presets MSBuild properties:

https://github.com/xamarin/xamarin-android/pull/5895/files#diff-3b8f9e4db31a6f4b54073ea66ded003fa77ec1573d42406911e0e3b7a691acbcR122

So I made any xabuild invocation set this property by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<TargetFramework>netstandard2.0</TargetFramework>
<_JniEnvSkipGetTargetFrameworkProperties>true</_JniEnvSkipGetTargetFrameworkProperties>
<_JniEnvAdditionalProperties>TargetFramework=net472</_JniEnvAdditionalProperties>
</PropertyGroup>
<PropertyGroup Condition=" '$(XABuild)' != 'true' ">
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<NoWarn>1591</NoWarn>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
Expand Down Expand Up @@ -57,6 +68,8 @@
<None Include="Documentation\Java.Interop\JniEnvironment.References.xml" />
<ProjectReference Include="..\..\build-tools\jnienv-gen\jnienv-gen.csproj"
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="$(_JniEnvSkipGetTargetFrameworkProperties)"
AdditionalProperties="$(_JniEnvAdditionalProperties)"
/>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/java-interop/java-interop.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<OutputPath>$(ToolOutputFullPath)</OutputPath>
<JNIEnvGenPath>$(BuildToolOutputFullPath)</JNIEnvGenPath>
<OutputName>java-interop</OutputName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions tests/Java.Interop-Tests/Java.Interop-Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand All @@ -10,7 +10,7 @@
<OutputPath>$(TestOutputFullPath)</OutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<DefineConstants>$(DefineConstants);NO_MARSHAL_MEMBER_BUILDER_SUPPORT;NO_GC_BRIDGE_SUPPORT</DefineConstants>
</PropertyGroup>

Expand All @@ -37,7 +37,7 @@
<ProjectReference Include="..\TestJVM\TestJVM.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netcoreapp3.1' ">
<ItemGroup Condition=" '$(TargetFramework)' != 'net6.0' ">
<ProjectReference Include="..\..\src\Java.Interop.Export\Java.Interop.Export.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion tests/TestJVM/TestJVM.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion tests/invocation-overhead/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
Targets="_Run_net472"
/>
<MSBuild Projects="$(MSBuildThisFileDirectory)invocation-overhead.csproj"
Properties="TargetFramework=netcoreapp3.1"
Properties="TargetFramework=net6.0"
Targets="_Run_netcoreapp"
/>
</Target>
Expand Down
2 changes: 1 addition & 1 deletion tests/invocation-overhead/invocation-overhead.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AppendTargetFrameworkToOutputPath>True</AppendTargetFrameworkToOutputPath>
<DefineConstants>FEATURE_JNIENVIRONMENT_JI_INTPTRS;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIENVIRONMENT_SAFEHANDLES;FEATURE_JNIENVIRONMENT_XA_INTPTRS </DefineConstants>
Expand Down
2 changes: 1 addition & 1 deletion tools/class-parse/class-parse.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion tools/generator/generator.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<DefineConstants>$(DefineConstants);GENERATOR;HAVE_CECIL;JCW_ONLY_TYPE_NAMES</DefineConstants>
<LangVersion>8.0</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion tools/jcw-gen/jcw-gen.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion tools/logcat-parse/logcat-parse.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion tools/param-name-importer/param-name-importer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
Expand Down