Skip to content

Commit f7d97c2

Browse files
jonathanpeppersjonpryor
authored andcommitted
[build] Java.Interop should use <ProjectReference/> for jnienv-gen (#477)
Java.Interop had a custom MSBuild target that builds `jnienv-gen.csproj`: <Target Name="BuildJnienvGen" Inputs="..\..\build-tools\jnienv-gen\jnienv-gen.csproj" Outputs="$(JNIEnvGenPath)\jnienv-gen.exe"> <MSBuild Projects="..\..\build-tools\jnienv-gen\jnienv-gen.csproj" /> </Target> The problem with this is that if any `.cs` files change in `jnienv-gen.csproj`, then this target will not run. Instead we should be able to use `<ProjectReference/>` with `%(ReferenceOutputAssembly)=False`, and everything should "just work".
1 parent 7228af0 commit f7d97c2

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<AssemblyName>jnienv-gen</AssemblyName>
1212
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
1313
</PropertyGroup>
14-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' Or '$(Configuration)|$(Platform)' == 'Gendarme|AnyCPU' ">
1515
<DebugSymbols>true</DebugSymbols>
1616
<DebugType>full</DebugType>
1717
<Optimize>false</Optimize>

src/Java.Interop/Java.Interop.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
<Import Project="Java.Interop.targets" />
3636
<PropertyGroup>
3737
<BuildDependsOn>
38-
BuildJnienvGen;
3938
BuildJniEnvironment_g_cs;
4039
BuildInteropJar;
4140
$(BuildDependsOn)
@@ -61,5 +60,10 @@
6160
<None Include="Documentation\Java.Interop\IJavaPeerable.xml" />
6261
<None Include="Documentation\Java.Interop\JniManagedPeerStates.xml" />
6362
<None Include="Documentation\Java.Interop\JniEnvironment.References.xml" />
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>
6468
</ItemGroup>
6569
</Project>

src/Java.Interop/Java.Interop.targets

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,8 @@
1414
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1515
</Content>
1616
</ItemGroup>
17-
<Target Name="BuildJnienvGen"
18-
Inputs="..\..\build-tools\jnienv-gen\jnienv-gen.csproj"
19-
Outputs="$(JNIEnvGenPath)\jnienv-gen.exe">
20-
<MSBuild
21-
Projects="..\..\build-tools\jnienv-gen\jnienv-gen.csproj"
22-
/>
23-
</Target>
2417
<Target Name="BuildJniEnvironment_g_cs"
2518
BeforeTargets="BeforeCompile"
26-
DependsOnTargets="BuildJnienvGen"
2719
Inputs="$(JNIEnvGenPath)\jnienv-gen.exe"
2820
Outputs="Java.Interop\JniEnvironment.g.cs;$(IntermediateOutputPath)\jni.c">
2921
<MakeDir Directories="$(IntermediateOutputPath)" />

0 commit comments

Comments
 (0)