Skip to content

Commit 6a7c90e

Browse files
committed
[java-interop] Update to SDK style project.
1 parent a99b451 commit 6a7c90e

File tree

4 files changed

+80
-117
lines changed

4 files changed

+80
-117
lines changed

NuGet.Config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
-->
77
<configuration>
88
<config>
9-
<add key="globalPackagesFolder" value="$\..\packages" />
9+
<add key="globalPackagesFolder" value="packages" />
1010
</config>
1111
</configuration>

build-tools/automation/azure-pipelines.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ jobs:
161161

162162
- script: |
163163
dotnet tool install --global boots
164-
boots https://download.mono-project.com/archive/6.4.0/macos-10-universal/MonoFramework-MDK-6.4.0.198.macos10.xamarin.universal.pkg
165-
displayName: Install Mono 6.4
164+
boots --stable Mono
165+
displayName: Install Mono-Stable
166166
167167
- script: make prepare CONFIGURATION=$(Build.Configuration)
168168
displayName: make prepare

src/java-interop/java-interop.csproj

Lines changed: 77 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,32 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project Sdk="Microsoft.Build.NoTargets/1.0.110">
32
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ItemType>GenericProject</ItemType>
7-
<ProductVersion>8.0.30703</ProductVersion>
8-
<SchemaVersion>2.0</SchemaVersion>
9-
<ProjectGuid>{BB0AB9F7-0979-41A7-B7A9-877260655F94}</ProjectGuid>
10-
</PropertyGroup>
11-
<Import Project="..\..\Directory.Build.props" />
12-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
13-
<DebugSymbols>true</DebugSymbols>
3+
<TargetFramework>net472</TargetFramework>
144
<OutputPath>$(ToolOutputFullPath)</OutputPath>
155
<JNIEnvGenPath>$(BuildToolOutputFullPath)</JNIEnvGenPath>
166
<OutputName>java-interop</OutputName>
17-
<CompileTarget>SharedLibrary</CompileTarget>
187
<DefineSymbols>DEBUG JI_DLL_EXPORT MONODEVELOP MONO_DLL_EXPORT</DefineSymbols>
198
<SourceDirectory>.</SourceDirectory>
20-
</PropertyGroup>
21-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
22-
<OutputPath>$(ToolOutputFullPath)</OutputPath>
23-
<OutputName>java-interop</OutputName>
24-
<JNIEnvGenPath>$(BuildToolOutputFullPath)</JNIEnvGenPath>
25-
<CompileTarget>SharedLibrary</CompileTarget>
269
<OptimizationLevel>3</OptimizationLevel>
27-
<DefineSymbols>JI_DLL_EXPORT MONODEVELOP MONO_DLL_EXPORT</DefineSymbols>
28-
<SourceDirectory>.</SourceDirectory>
2910
</PropertyGroup>
11+
3012
<ItemGroup>
3113
<ClInclude Include="java-interop.h" />
3214
<ClInclude Include="java-interop-gc-bridge.h" />
3315
<ClInclude Include="java-interop-mono.h" />
3416
</ItemGroup>
17+
3518
<PropertyGroup>
3619
<_MonoIncludePath>@(MonoIncludePath->'%(FullPath)')</_MonoIncludePath>
3720
<_JdkIncludePath>@(JdkIncludePath->'%(FullPath)')</_JdkIncludePath>
3821
</PropertyGroup>
22+
3923
<ItemDefinitionGroup>
4024
<ClCompile>
4125
<PreprocessorDefinitions>$([MSBuild]::Unescape($(DefineSymbols.Replace(' ', ';'))))</PreprocessorDefinitions>
4226
<AdditionalIncludeDirectories>$([MSBuild]::Unescape($(_MonoIncludePath)));$([MSBuild]::Unescape($(_JdkIncludePath)))</AdditionalIncludeDirectories>
4327
</ClCompile>
4428
</ItemDefinitionGroup>
29+
4530
<ItemGroup>
4631
<ClCompile Include="jni.c" />
4732
<ClCompile Include="java-interop.cc" />
@@ -50,20 +35,76 @@
5035
<ClCompile Include="java-interop-mono.cc" />
5136
<ClCompile Include="java-interop-gc-bridge-mono.cc" />
5237
</ItemGroup>
53-
<PropertyGroup>
54-
<BuildDependsOn>
55-
BuildJni_c;
56-
BuildMac;
57-
BuildUnixLibraries;
58-
$(BuildDependsOn)
59-
</BuildDependsOn>
60-
</PropertyGroup>
61-
<Import Project="java-interop.targets" />
38+
6239
<ItemGroup>
63-
<ProjectReference Include="..\..\build-tools\jnienv-gen\jnienv-gen.csproj">
64-
<Project>{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}</Project>
65-
<Name>jnienv-gen</Name>
66-
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
67-
</ProjectReference>
40+
<ProjectReference Include="..\..\build-tools\jnienv-gen\jnienv-gen.csproj" ReferenceOutputAssembly="false" />
6841
</ItemGroup>
69-
</Project>
42+
43+
<Target Name="BuildJni_c"
44+
Inputs="$(JNIEnvGenPath)\jnienv-gen.exe"
45+
Outputs="jni.c">
46+
<MakeDir Directories="$(OutputPath)" />
47+
<Exec Command="$(Runtime) &quot;$(JNIEnvGenPath)\jnienv-gen.exe&quot; jni.g.cs jni.c" />
48+
</Target>
49+
50+
<PropertyGroup>
51+
<_MacLib>$(OutputPath)\lib$(OutputName).dylib</_MacLib>
52+
</PropertyGroup>
53+
54+
<Target Name="_CompileObjectFiles"
55+
Condition=" '$(OS)' != 'Windows_NT' "
56+
DependsOnTargets="BuildJni_c"
57+
Inputs="@(ClCompile)"
58+
Outputs="obj\$(Configuration)\%(Filename).o">
59+
<MakeDir Directories="obj\$(Configuration)" />
60+
<ItemGroup>
61+
<_Defines Include="%(ClCompile.PreprocessorDefinitions)" />
62+
<_Includes Include="%(ClCompile.AdditionalIncludeDirectories)" />
63+
</ItemGroup>
64+
<PropertyGroup>
65+
<_Arch Condition=" Exists ('/Library/Frameworks/') ">-m64</_Arch>
66+
<_Cc Condition=" '%(ClCompile.Extension)' == '.c' ">gcc -std=c99 -fPIC</_Cc>
67+
<_Cc Condition=" '%(ClCompile.Extension)' == '.cc' ">g++ -std=c++11 -fPIC</_Cc>
68+
<_Def>@(_Defines->'-D%(Identity)', ' ')</_Def>
69+
<_Inc>@(_Includes->'-I "%(Identity)"', ' ')</_Inc>
70+
</PropertyGroup>
71+
<Exec
72+
Command="$(_Cc) -c -g $(_Arch) -o &quot;obj\$(Configuration)\%(ClCompile.Filename).o&quot; $(_Def) $(_Inc) &quot;%(Identity)&quot;"
73+
/>
74+
</Target>
75+
76+
<Target Name="BuildMac" AfterTargets="Build"
77+
Condition=" '$(OS)' != 'Windows_NT' And Exists ('/Library/Frameworks/')"
78+
DependsOnTargets="_CompileObjectFiles"
79+
Inputs="@(ClCompile)"
80+
Outputs="$(_MacLib)">
81+
<PropertyGroup>
82+
<_LinkFlags>-fvisibility=hidden -Wl,-undefined -Wl,suppress -Wl,-flat_namespace</_LinkFlags>
83+
<_Libs>$(MonoLibs)</_Libs>
84+
<_Files>@(ClCompile->'obj\$(Configuration)\%(Filename).o', ' ')</_Files>
85+
</PropertyGroup>
86+
<Exec Command="gcc -g -shared -m64 -std=c99 -fPIC -o &quot;$(_MacLib)&quot; $(_LinkFlags) $(_Libs) $(_Files)" />
87+
<!-- Mono 4.4.0 (mono-4.4.0-branch/a3fabf1) has an incorrect shared library name. Fix it -->
88+
<Exec Command="install_name_tool -change /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/package-root/lib/libmonosgen-2.0.1.dylib /Library/Frameworks/Mono.framework/Libraries/libmonosgen-2.0.1.dylib &quot;$(_MacLib)&quot;" />
89+
</Target>
90+
91+
<Target Name="BuildUnixLibraries" AfterTargets="Build"
92+
Condition=" '$(OS)' != 'Windows_NT' And !Exists ('/Library/Frameworks/')"
93+
DependsOnTargets="_CompileObjectFiles"
94+
Inputs="@(ClCompile)"
95+
Outputs="$(OutputPath)\lib$(OutputName).so">
96+
<PropertyGroup>
97+
<_FixedDefines>$(DefineSymbols.Split(' '))</_FixedDefines>
98+
</PropertyGroup>
99+
<ItemGroup>
100+
<_Defines Include="$(_FixedDefines)" />
101+
</ItemGroup>
102+
<PropertyGroup>
103+
<_LinkFlags>-fvisibility=hidden -Wl,-undefined -Wl,suppress -Wl,-flat_namespace -fPIC</_LinkFlags>
104+
<_Libs>$(MonoLibs)</_Libs>
105+
<_Files>@(ClCompile->'obj\$(Configuration)\%(Filename).o', ' ')</_Files>
106+
</PropertyGroup>
107+
<Exec Command="g++ -g -shared -o &quot;$(OutputPath)\lib$(OutputName).so&quot; $(_LinkFlags) $(_Libs) $(_Files)" />
108+
</Target>
109+
110+
</Project>

src/java-interop/java-interop.targets

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

0 commit comments

Comments
 (0)