Skip to content

Commit d205cab

Browse files
jonpryoratsushieno
authored andcommitted
[build] Add $(JavaInteropSourceDirectory) MSBuild property (#80)
Allow the Java.Interop checkout directory to be specified by overriding the `$(JavaInteropSourceDirectory)` MSBuild property. Project files should use the `$(JavaInteropFullPath)` MSBuild property, which is computed as `Path.GetFullPath()` for the `$(JavaInteropSourceDirectory)` value. Normally `$(JavaInteropSourceDirectory)` wouldn't need to be overridden; the current use case is to allow a CI-like environment which grabs the latest commit of every referenced module to make sure they all work together. (Note: such a "CI-like environment" DOES NOT (yet) EXIST. This commit is to help *permit* such a thing.)
1 parent 255a569 commit d205cab

7 files changed

Lines changed: 23 additions & 18 deletions

File tree

Configuration.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<AndroidSdkDirectory>$(AndroidToolchainDirectory)\sdk</AndroidSdkDirectory>
2525
<AndroidNdkDirectory>$(AndroidToolchainDirectory)\ndk</AndroidNdkDirectory>
2626
<AndroidSupportedAbis Condition=" '$(AndroidSupportedAbis)' == '' ">host-$(HostOS):armeabi-v7a</AndroidSupportedAbis>
27+
<JavaInteropSourceDirectory Condition=" '$(JavaInteropSourceDirectory)' == '' ">$(MSBuildThisFileDirectory)external\Java.Interop</JavaInteropSourceDirectory>
2728
<MonoSourceDirectory>$(MSBuildThisFileDirectory)external\mono</MonoSourceDirectory>
2829
<SqliteSourceDirectory Condition=" '$(SqliteSourceDirectory)' == '' ">$(MSBuildThisFileDirectory)external\sqlite</SqliteSourceDirectory>
2930
<XamarinAndroidSourcePath>$(MSBuildThisFileDirectory)</XamarinAndroidSourcePath>
@@ -33,6 +34,7 @@
3334
</PropertyGroup>
3435
<PropertyGroup>
3536
<AndroidMxeFullPath>$([System.IO.Path]::GetFullPath ('$(AndroidMxeInstallPrefix)'))</AndroidMxeFullPath>
37+
<JavaInteropFullPath>$([System.IO.Path]::GetFullPath ('$(JavaInteropSourceDirectory)'))</JavaInteropFullPath>
3638
<MonoSourceFullPath>$([System.IO.Path]::GetFullPath ('$(MonoSourceDirectory)'))</MonoSourceFullPath>
3739
<SqliteSourceFullPath>$([System.IO.Path]::GetFullPath ('$(SqliteSourceDirectory)'))</SqliteSourceFullPath>
3840
</PropertyGroup>

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ Overridable MSBuild properties include:
6464
`$(HOME)\android-toolchain`.
6565
* `$(HostCc)`, `$(HostCxx)`: The C and C++ compilers to use to generate
6666
host-native binaries.
67+
* `$(JavaInteropSourceDirectory)`: The Java.Interop source directory to
68+
build and reference projects from. By default, this is
69+
`external/Java.Interop` directory, maintained by `git submodule update`.
6770

6871
# Build Requirements
6972

external/Java.Interop

src/Mono.Android/Mono.Android.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@
293293
<Compile Include="Xamarin.Android.Net\AuthModuleDigest.cs" />
294294
<Compile Include="Xamarin.Android.Net\IAndroidAuthenticationModule.cs" />
295295
</ItemGroup>
296-
<Import Project="..\..\external\Java.Interop\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings.projitems" Label="Shared" Condition="Exists('..\..\external\Java.Interop\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings.projitems')" />
297-
<Import Project="..\..\external\Java.Interop\src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems" Label="Shared" Condition="Exists('..\..\external\Java.Interop\src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems')" />
296+
<Import Project="$(JavaInteropFullPath)\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings.projitems" Label="Shared" Condition="Exists('$(JavaInteropFullPath)\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings.projitems')" />
297+
<Import Project="$(JavaInteropFullPath)\src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems" Label="Shared" Condition="Exists('$(JavaInteropFullPath)\src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems')" />
298298
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
299299
<Import Project="Mono.Android.targets" />
300300
<Import Project="$(IntermediateOutputPath)android-$(AndroidApiLevel)\Mono.Android.projitems" Condition="Exists('$(IntermediateOutputPath)android-$(AndroidApiLevel)\Mono.Android.projitems')" />
@@ -309,12 +309,12 @@
309309
<Name>jnienv-gen</Name>
310310
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
311311
</ProjectReference>
312-
<ProjectReference Include="..\..\external\Java.Interop\tools\generator\generator.csproj">
312+
<ProjectReference Include="$(JavaInteropFullPath)\tools\generator\generator.csproj">
313313
<Project>{D14A1B5C-2060-4930-92BE-F7190256C735}</Project>
314314
<Name>generator</Name>
315315
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
316316
</ProjectReference>
317-
<ProjectReference Include="..\..\external\Java.Interop\tools\jcw-gen\jcw-gen.csproj">
317+
<ProjectReference Include="$(JavaInteropFullPath)\tools\jcw-gen\jcw-gen.csproj">
318318
<Project>{52C7D9B6-E8C8-47D0-9471-652D278D7D77}</Project>
319319
<Name>jcw-gen</Name>
320320
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>

src/Mono.Android/Mono.Android.targets

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Target Name="_BuildJavaInterop"
44
BeforeTargets="BeforeResolveReferences"
5-
Inputs="..\..\external\Java.Interop\src\Java.Interop\Java.Interop.csproj"
5+
Inputs="$(JavaInteropFullPath)\src\Java.Interop\Java.Interop.csproj"
66
Outputs="$(OutputPath)\..\v1.0\Java.Interop.dll">
77
<MSBuild
8-
Projects="..\..\external\Java.Interop\src\Java.Interop\Java.Interop.csproj"
8+
Projects="$(JavaInteropFullPath)\src\Java.Interop\Java.Interop.csproj"
99
Properties="Configuration=XAIntegration$(Configuration)"
1010
/>
1111
<ItemGroup>
12-
<Assembly Include="..\..\external\Java.Interop\bin\XAIntegration$(Configuration)\*.dll*" />
12+
<Assembly Include="$(JavaInteropFullPath)\bin\XAIntegration$(Configuration)\*.dll*" />
1313
</ItemGroup>
1414
<Copy
1515
SourceFiles="@(Assembly)"
@@ -89,7 +89,7 @@
8989
<MakeDir Directories="$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\bin" />
9090
<PropertyGroup>
9191
<OutputPathAbs>$(MSBuildProjectDirectory)\$(OutputPath)</OutputPathAbs>
92-
<JcwGen>..\..\external\Java.Interop\bin\$(Configuration)\jcw-gen.exe</JcwGen>
92+
<JcwGen>$(JavaInteropFullPath)\bin\$(Configuration)\jcw-gen.exe</JcwGen>
9393
<_LibDirs>-L "$(OutputPathAbs)" -L "$(OutputPathAbs)..\v1.0\" -L "$(OutputPathAbs)..\v1.0\Facades"</_LibDirs>
9494
<_Assembly>"$(OutputPathAbs)$(AssemblyName).dll"</_Assembly>
9595
<_Out>-o "$(MSBuildProjectDirectory)\$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\src"</_Out>

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\external\Java.Interop\src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems" Label="Shared" Condition="Exists('..\..\external\Java.Interop\src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems')" />
4-
<Import Project="..\..\external\Java.Interop\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings.projitems" Label="Shared" Condition="Exists('..\..\external\Java.Interop\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings.projitems')" />
53
<PropertyGroup>
64
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
75
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -14,6 +12,8 @@
1412
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1513
</PropertyGroup>
1614
<Import Project="..\..\Configuration.props" />
15+
<Import Project="$(JavaInteropFullPath)\src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems" Label="Shared" Condition="Exists('$(JavaInteropFullPath)\src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems')" />
16+
<Import Project="$(JavaInteropFullPath)\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings.projitems" Label="Shared" Condition="Exists('$(JavaInteropFullPath)\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings.projitems')" />
1717
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1818
<DebugSymbols>True</DebugSymbols>
1919
<DebugType>full</DebugType>
@@ -478,7 +478,7 @@
478478
<Compile Include="..\Mono.Android\Android.Runtime\IntDefinitionAttribute.cs">
479479
<Link>Mono.Android\IntDefinitionAttribute.cs</Link>
480480
</Compile>
481-
<Compile Include="..\..\external\Java.Interop\src\utils\StringRocks.cs">
481+
<Compile Include="$(JavaInteropFullPath)\src\utils\StringRocks.cs">
482482
<Link>Utilities\StringRocks.cs</Link>
483483
</Compile>
484484
<Compile Include="..\..\external\mono\mcs\tools\tuner\Mono.Tuner\FilterAttributes.cs">
@@ -605,23 +605,23 @@
605605
<Project>{D27AD8F7-7710-40BE-B03B-55EFBEC13C44}</Project>
606606
<Name>Xamarin.Android.Tools.Aidl</Name>
607607
</ProjectReference>
608-
<ProjectReference Include="..\..\external\Java.Interop\src\Java.Interop.Tools.Diagnostics\Java.Interop.Tools.Diagnostics.csproj">
608+
<ProjectReference Include="$(JavaInteropFullPath)\src\Java.Interop.Tools.Diagnostics\Java.Interop.Tools.Diagnostics.csproj">
609609
<Project>{64CC4E44-CE3A-4319-BF3F-6CF8BD513870}</Project>
610610
<Name>Java.Interop.Tools.Diagnostics</Name>
611611
</ProjectReference>
612-
<ProjectReference Include="..\..\external\Java.Interop\src\Java.Interop.Tools.Cecil\Java.Interop.Tools.Cecil.csproj">
612+
<ProjectReference Include="$(JavaInteropFullPath)\src\Java.Interop.Tools.Cecil\Java.Interop.Tools.Cecil.csproj">
613613
<Project>{D48EE8D0-0A0A-4493-AEF5-DAF5F8CF86AD}</Project>
614614
<Name>Java.Interop.Tools.Cecil</Name>
615615
</ProjectReference>
616-
<ProjectReference Include="..\..\external\Java.Interop\src\Java.Interop.Tools.JavaCallableWrappers\Java.Interop.Tools.JavaCallableWrappers.csproj">
616+
<ProjectReference Include="$(JavaInteropFullPath)\src\Java.Interop.Tools.JavaCallableWrappers\Java.Interop.Tools.JavaCallableWrappers.csproj">
617617
<Project>{D18FCF91-8876-48A0-A693-2DC1E7D3D80A}</Project>
618618
<Name>Java.Interop.Tools.JavaCallableWrappers</Name>
619619
</ProjectReference>
620620
<ProjectReference Include="..\Xamarin.Android.Build.Utilities\Xamarin.Android.Build.Utilities.csproj">
621621
<Project>{91713046-C358-4647-B162-ED4E1442F3D8}</Project>
622622
<Name>Xamarin.Android.Build.Utilities</Name>
623623
</ProjectReference>
624-
<ProjectReference Include="..\..\external\Java.Interop\src\Xamarin.Android.Tools.Bytecode\Xamarin.Android.Tools.Bytecode.csproj">
624+
<ProjectReference Include="$(JavaInteropFullPath)\src\Xamarin.Android.Tools.Bytecode\Xamarin.Android.Tools.Bytecode.csproj">
625625
<Project>{B17475BC-45A2-47A3-B8FC-62F3A0959EE0}</Project>
626626
<Name>Xamarin.Android.Tools.Bytecode</Name>
627627
</ProjectReference>
@@ -635,7 +635,7 @@
635635
<Name>Xamarin.Android.Tools.BootstrapTasks</Name>
636636
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
637637
</ProjectReference>
638-
<ProjectReference Include="..\..\external\Java.Interop\tools\class-parse\class-parse.csproj">
638+
<ProjectReference Include="$(JavaInteropFullPath)\tools\class-parse\class-parse.csproj">
639639
<Project>{38C762AB-8FD1-44DE-9855-26AAE7129DC3}</Project>
640640
<Name>class-parse</Name>
641641
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>

tools/api-xml-adjuster/api-xml-adjuster.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<Compile Include="Properties\AssemblyInfo.cs" />
3939
</ItemGroup>
4040
<ItemGroup>
41-
<ProjectReference Include="..\..\external\Java.Interop\src\Xamarin.Android.Tools.ApiXmlAdjuster\Xamarin.Android.Tools.ApiXmlAdjuster.csproj">
41+
<ProjectReference Include="$(JavaInteropFullPath)\src\Xamarin.Android.Tools.ApiXmlAdjuster\Xamarin.Android.Tools.ApiXmlAdjuster.csproj">
4242
<Project>{1268EADF-8344-431C-81F6-FCB7CBC99F49}</Project>
4343
<Name>Xamarin.Android.Tools.ApiXmlAdjuster</Name>
4444
</ProjectReference>

0 commit comments

Comments
 (0)