Skip to content

Commit 14f79e8

Browse files
committed
Update our copy of Java.Runtime.Environment.dll.config
Add dll maps to map `libmono-android` as `java-interop` shared library for `Java.Runtime.Environment.dll`. Similar way as we do for `Java.Interop.dll` in `monodroid.targets`
1 parent 9be8ace commit 14f79e8

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<dllmap dll="java-interop" os="osx" target="lib/host-Darwin/libmono-android.debug.dylib" />
2+
<dllmap dll="java-interop" os="linux" target="lib/host-Linux/libmono-android.debug.so" />
3+
<dllmap dll="java-interop" os="windows" wordsize="64" target="lib/host-mxe-Win64/libmono-android.debug.dll" />
4+
<dllmap dll="java-interop" os="windows" wordsize="32" target="lib/host-mxe-Win32/libmono-android.debug.dll" />

src/monodroid/monodroid.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
<Name>dependencies</Name>
3333
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
3434
</ProjectReference>
35+
<ProjectReference Include="..\..\external\Java.Interop\tools\jnimarshalmethod-gen\Xamarin.Android.Tools.JniMarshalMethodGenerator.csproj">
36+
<Project>{D1295A8F-4F42-461D-A046-564476C10002}</Project>
37+
<Name>jnimarshalmethod-gen</Name>
38+
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
39+
</ProjectReference>
3540
<ProjectReference Include="..\..\src\mono-runtimes\mono-runtimes.csproj">
3641
<Project>{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}</Project>
3742
<Name>mono-runtimes</Name>

src/monodroid/monodroid.targets

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<Import Project="monodroid.projitems" />
66
<Import Project="..\..\build-tools\scripts\RequiredPrograms.targets" />
77
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" TaskName="Xamarin.Android.Tools.BootstrapTasks.GenerateMonoDroidIncludes" />
8+
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.ReplaceFileContents" />
89
<PropertyGroup>
910
<_Conf>$(Configuration.ToLowerInvariant())</_Conf>
1011
</PropertyGroup>
@@ -116,7 +117,7 @@
116117
</ItemGroup>
117118
</Target>
118119
<Target Name="_BuildHostRuntimes"
119-
DependsOnTargets="_GetBuildHostRuntimes;_CreateJavaInteropDllConfig"
120+
DependsOnTargets="_GetBuildHostRuntimes;_CreateJavaInteropDllConfigs"
120121
Inputs="@(_CFile);@(_UnixCFile)"
121122
Outputs="@(_HostRuntime->'$(OutputPath)%(OutputDirectory)\libmono-android.debug.%(NativeLibraryExtension)')">
122123
<Message Text="Building host runtime %(_HostRuntime.Identity) in $(OutputPath)%(_HostRuntime.OutputDirectory)"/>
@@ -143,20 +144,29 @@
143144
Command="%(_HostRuntime.Strip) %(_HostRuntime.StripFlags) &quot;$(OutputPath)%(_HostRuntime.OutputDirectory)\libmono-android.release.%(_HostRuntime.NativeLibraryExtension)&quot;"
144145
/>
145146
</Target>
146-
<Target Name="_CreateJavaInteropDllConfig"
147-
Inputs="$(XAInstallPrefix)xbuild\Xamarin\Android\Java.Interop.dll"
148-
Outputs="$(XAInstallPrefix)xbuild\Xamarin\Android\Java.Interop.dll.config">
147+
<Target Name="_CreateJavaInteropDllConfigs"
148+
Inputs="$(XAInstallPrefix)xbuild\Xamarin\Android\Java.Interop.dll;$(JavaInteropSourceDirectory)\src\Java.Runtime.Environment\Java.Runtime.Environment.dll.config"
149+
Outputs="$(XAInstallPrefix)xbuild\Xamarin\Android\Java.Interop.dll.config;$(XAInstallPrefix)xbuild\Xamarin\Android\Java.Runtime.Environment.dll.config">
150+
<ReadLinesFromFile
151+
File="../../build-tools/scripts/java-interop.dllmap">
152+
<Output
153+
TaskParameter="Lines"
154+
ItemName="_JavaInteropDllMapContent" />
155+
</ReadLinesFromFile>
149156
<WriteLinesToFile
150157
File="$(XAInstallPrefix)xbuild\Xamarin\Android\Java.Interop.dll.config"
151-
Lines="&lt;configuration&gt;
152-
&lt;dllmap dll=&quot;java-interop&quot; os=&quot;osx&quot; target=&quot;lib/host-Darwin/libmono-android.debug.dylib&quot; /&gt;
153-
&lt;dllmap dll=&quot;java-interop&quot; os=&quot;linux&quot; target=&quot;lib/host-Linux/libmono-android.debug.so&quot; /&gt;
154-
&lt;dllmap dll=&quot;java-interop&quot; os=&quot;windows&quot; wordsize=&quot;64&quot; target=&quot;lib/host-mxe-Win64/libmono-android.debug.dll&quot; /&gt;
155-
&lt;dllmap dll=&quot;java-interop&quot; os=&quot;windows&quot; wordsize=&quot;32&quot; target=&quot;lib/host-mxe-Win32/libmono-android.debug.dll&quot; /&gt;
156-
&lt;/configuration&gt;"
158+
Lines="&lt;configuration&gt;;@(_JavaInteropDllMapContent);&lt;/configuration&gt;"
157159
Overwrite="True"
158-
/>
159-
</Target>
160+
/>
161+
<PropertyGroup>
162+
<DllMaps>@(_JavaInteropDllMapContent->'%(Identity)', '%0a ')</DllMaps>
163+
</PropertyGroup>
164+
<ReplaceFileContents
165+
SourceFile="$(JavaInteropSourceDirectory)\src\Java.Runtime.Environment\Java.Runtime.Environment.dll.config"
166+
DestinationFile="$(XAInstallPrefix)xbuild\Xamarin\Android\Java.Runtime.Environment.dll.config"
167+
Replacements="&lt;configuration&gt;=&lt;configuration&gt;%0a $(DllMaps)"
168+
/>
169+
</Target>
160170
<Target Name="CoreCompile"
161171
DependsOnTargets="Build">
162172
</Target>

0 commit comments

Comments
 (0)