Skip to content

Commit 6f2a69d

Browse files
committed
[CI] Add an "OSX .NET Core" build.
1 parent a99b451 commit 6f2a69d

File tree

27 files changed

+160
-27
lines changed

27 files changed

+160
-27
lines changed

Before.Java.Interop.sln.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildThisFileDirectory)build-tools\scripts\PrepareWindows.targets" Condition=" '$(OS)' == 'Windows_NT' " />
4+
<Import Project="$(MSBuildThisFileDirectory)build-tools\scripts\PrepareMac.targets" Condition=" '$(OS)' != 'Windows_NT' " />
45
<Import Project="$(MSBuildThisFileDirectory)build-tools\scripts\RunNUnitTests.targets" />
56
</Project>

Directory.Build.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,11 @@
5252
<_XamarinAndroidCecilPath Condition=" '$(CecilSourceDirectory)' != '' And Exists('$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll') ">$(UtilityOutputFullPath)Xamarin.Android.Cecil.dll</_XamarinAndroidCecilPath>
5353
<XamarinAndroidToolsFullPath>$([System.IO.Path]::GetFullPath ('$(XamarinAndroidToolsDirectory)'))</XamarinAndroidToolsFullPath>
5454
</PropertyGroup>
55+
<PropertyGroup>
56+
<Runtime Condition="'$(OS)' != 'Windows_NT'">mono</Runtime>
57+
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\jnienv-gen.dll</_JNIEnvGenPath>
58+
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\jnienv-gen.exe</_JNIEnvGenPath>
59+
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">dotnet "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
60+
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(Runtime) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
61+
</PropertyGroup>
5562
</Project>

NuGet.Config

Lines changed: 0 additions & 11 deletions
This file was deleted.

build-tools/automation/azure-pipelines.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,84 @@ jobs:
200200
inputs:
201201
ArtifactName: debug
202202
condition: succeededOrFailed()
203+
204+
- job: mac_dotnet_build
205+
displayName: Mac .NET Core
206+
pool: $(HostedMac)
207+
timeoutInMinutes: 20
208+
workspace:
209+
clean: all
210+
steps:
211+
- checkout: self
212+
submodules: recursive
213+
214+
- task: UseDotNet@2
215+
displayName: Use .NET Core $(DotNetCoreVersion)
216+
inputs:
217+
version: $(DotNetCoreVersion)
218+
219+
- script: |
220+
dotnet tool install --global boots
221+
boots --stable Mono
222+
displayName: Install Mono-Stable
223+
224+
- task: DotNetCoreCLI@2
225+
displayName: Prepare Solution
226+
inputs:
227+
command: restore
228+
projects: Java.Interop.sln
229+
arguments: '-c $(Build.Configuration)'
230+
231+
- task: DotNetCoreCLI@2
232+
displayName: Prepare Solution
233+
inputs:
234+
projects: Java.Interop.sln
235+
arguments: '-c $(Build.Configuration) -target:Prepare'
236+
237+
- task: DotNetCoreCLI@2
238+
displayName: Build Solution
239+
inputs:
240+
projects: Java.Interop.sln
241+
arguments: '-c $(Build.Configuration) -v normal'
242+
243+
- task: DotNetCoreCLI@2
244+
displayName: 'Tests: generator'
245+
inputs:
246+
command: test
247+
arguments: bin\Test$(Build.Configuration)\generator-Tests.dll
248+
continueOnError: true
249+
250+
- task: DotNetCoreCLI@2
251+
displayName: 'Tests: JavaCallableWrappers'
252+
inputs:
253+
command: test
254+
arguments: bin\Test$(Build.Configuration)\Java.Interop.Tools.JavaCallableWrappers-Tests.dll
255+
continueOnError: true
256+
257+
- task: DotNetCoreCLI@2
258+
displayName: 'Tests: logcat-parse'
259+
inputs:
260+
command: test
261+
arguments: bin\Test$(Build.Configuration)\logcat-parse-Tests.dll
262+
continueOnError: true
263+
264+
- task: DotNetCoreCLI@2
265+
displayName: 'Tests: ApiXmlAdjuster'
266+
inputs:
267+
command: test
268+
arguments: bin\Test$(Build.Configuration)\Xamarin.Android.Tools.ApiXmlAdjuster-Tests.dll
269+
continueOnError: true
270+
271+
- task: DotNetCoreCLI@2
272+
displayName: 'Tests: Bytecode'
273+
inputs:
274+
command: test
275+
arguments: bin\Test$(Build.Configuration)\Xamarin.Android.Tools.Bytecode-Tests.dll
276+
continueOnError: true
277+
278+
- powershell: |
279+
Write-Host "Current job status is: $env:AGENT_JOBSTATUS"
280+
if ($env:AGENT_JOBSTATUS -eq "SucceededWithIssues") {
281+
Write-Host "##vso[task.complete result=Failed;]DONE"
282+
}
283+
displayName: Fail job if tests failed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111
<OutputPath>$(BuildToolOutputFullPath)</OutputPath>
1212
</PropertyGroup>
1313

14+
<ItemGroup>
15+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
16+
</ItemGroup>
1417
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Prepare" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
</PropertyGroup>
6+
<UsingTask AssemblyFile="$(_TopDir)\bin\Build$(Configuration)\Java.Interop.BootstrapTasks.dll" TaskName="Java.Interop.BootstrapTasks.JdkInfo" />
7+
<UsingTask AssemblyFile="$(_TopDir)\bin\Build$(Configuration)\Java.Interop.BootstrapTasks.dll" TaskName="Java.Interop.BootstrapTasks.DownloadUri" />
8+
<Target Name="Prepare">
9+
<Exec Command="git submodule update --init --recursive" WorkingDirectory="$(_TopDir)" />
10+
<MSBuild Projects="$(MSBuildThisFileDirectory)..\..\build-tools\Java.Interop.BootstrapTasks\Java.Interop.BootstrapTasks.csproj" />
11+
<JdkInfo
12+
JdksRoot="$(ProgramFiles)\Java"
13+
MakeFragmentFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.mk"
14+
MaximumJdkVersion="$(JI_MAX_MDK)"
15+
PropertyFile="$(_TopDir)\bin\Build$(Configuration)\JdkInfo.props">
16+
<Output TaskParameter="JavaHomePath" PropertyName="_JavaSdkDirectory" />
17+
</JdkInfo>
18+
</Target>
19+
</Project>

samples/Hello/Hello.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
<OutputPath>$(TestOutputFullPath)</OutputPath>
1212
</PropertyGroup>
1313

14+
<ItemGroup>
15+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
16+
</ItemGroup>
17+
1418
<ItemGroup>
1519
<ProjectReference Include="..\..\src\Java.Interop\Java.Interop.csproj" />
1620
<ProjectReference Include="..\..\src\Java.Runtime.Environment\Java.Runtime.Environment.csproj" />

src/Java.Interop/Directory.Build.targets

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<Runtime Condition="'$(OS)' != 'Windows_NT'">mono</Runtime>
5-
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">$(BuildToolOutputFullPath)jnienv-gen.dll</_JNIEnvGenPath>
6-
<_JNIEnvGenPath Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(BuildToolOutputFullPath)jnienv-gen.exe</_JNIEnvGenPath>
7-
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' == 'True' ">dotnet "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
8-
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(Runtime) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
9-
</PropertyGroup>
103
<ItemGroup>
114
<CompileJavaInteropJar Include="java\com\xamarin\java_interop\internal\JavaProxyObject.java" />
125
<CompileJavaInteropJar Include="java\com\xamarin\java_interop\internal\JavaProxyThrowable.java" />
@@ -18,19 +11,23 @@
1811
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1912
</Content>
2013
</ItemGroup>
14+
<PropertyGroup>
15+
<_JniEnvironmentGeneratedFile Condition="'$(OS)' == 'Windows_NT'">Java.Interop\JniEnvironment.g.cs</_JniEnvironmentGeneratedFile>
16+
<_JniEnvironmentGeneratedFile Condition="'$(OS)' != 'Windows_NT'">Java.Interop/JniEnvironment.g.cs</_JniEnvironmentGeneratedFile>
17+
</PropertyGroup>
2118
<Target Name="BuildJniEnvironment_g_cs"
2219
BeforeTargets="BeforeCompile"
2320
Inputs="$(_JNIEnvGenPath)"
24-
Outputs="Java.Interop\JniEnvironment.g.cs;$(IntermediateOutputPath)\jni.c">
21+
Outputs="$(_JniEnvironmentGeneratedFile);$(IntermediateOutputPath)\jni.c">
2522
<MakeDir Directories="$(IntermediateOutputPath)" />
2623
<PropertyGroup>
27-
<_AddCompile Condition=" !Exists('Java.Interop\JniEnvironment.g.cs') ">True</_AddCompile>
24+
<_AddCompile Condition=" !Exists($(_JniEnvironmentGeneratedFile)) ">True</_AddCompile>
2825
</PropertyGroup>
2926
<Exec
30-
Command="$(_RunJNIEnvGen) Java.Interop\JniEnvironment.g.cs $(IntermediateOutputPath)\jni.c"
27+
Command="$(_RunJNIEnvGen) $(_JniEnvironmentGeneratedFile) $(IntermediateOutputPath)jni.c"
3128
/>
3229
<ItemGroup>
33-
<Compile Include="Java.Interop\JniEnvironment.g.cs" Condition=" '$(_AddCompile)' == 'True' " />
30+
<Compile Include="$(_JniEnvironmentGeneratedFile)" Condition=" '$(_AddCompile)' == 'True' " />
3431
</ItemGroup>
3532
</Target>
3633
<Target Name="BuildInteropJar"

src/java-interop/java-interop.targets

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Runtime Condition="'$(OS)' != 'Windows_NT'">mono</Runtime>
5+
<Runtime Condition="'$(OS)' != 'Windows_NT' And '$(MSBuildRuntimeType)' == 'Core' ">dotnet run</Runtime>
56
</PropertyGroup>
67
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)" />
78
<Target Name="BuildJni_c"
8-
Inputs="$(JNIEnvGenPath)\jnienv-gen.exe"
9+
Inputs="$(_JNIEnvGenPath)"
910
Outputs="jni.c">
1011
<MakeDir Directories="$(OutputPath)" />
11-
<Exec Command="$(Runtime) &quot;$(JNIEnvGenPath)\jnienv-gen.exe&quot; jni.g.cs jni.c" />
12+
13+
<!--<PropertyGroup>
14+
<JNIEnvExecutable>jnienv-gen.exe</JNIEnvExecutable>
15+
<JNIEnvGenPath Condition=" '$(OS)' != 'Windows_NT' And '$(MSBuildRuntimeType)' == 'Core' ">$(JNIEnvGenPath)\..\Build$(Configuration)-netcoreapp3.1\</JNIEnvGenPath>
16+
<JNIEnvExecutable Condition=" '$(OS)' != 'Windows_NT' And '$(MSBuildRuntimeType)' == 'Core' ">jnienv-gen.dll</JNIEnvExecutable>
17+
</PropertyGroup>-->
18+
19+
<Exec Command="$(_RunJNIEnvGen) jni.g.cs jni.c" />
1220
</Target>
1321
<PropertyGroup>
14-
<_MacLib>$(OutputPath)\lib$(OutputName).dylib</_MacLib>
22+
<_MacLib>$(OutputPath)/lib$(OutputName).dylib</_MacLib>
1523
</PropertyGroup>
1624
<Target Name="_CompileObjectFiles"
1725
Condition=" '$(OS)' != 'Windows_NT' "

tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<PackageReference Include="NUnit.ConsoleRunner" Version="3.9.0" />
1616
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
1717
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
18+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
1819
</ItemGroup>
1920

2021
<ItemGroup>

0 commit comments

Comments
 (0)