Skip to content

Commit

Permalink
[build] Remove <Imports/> now covered by Directory.Build.props (#607)
Browse files Browse the repository at this point in the history
In commit 95f698b, we renamed `Configuration.props` to
`Directory.Build.props`.

`Directory.Build.props` is special in that MSBuild will
[automatically import the file][0] if it's in the "current" directory
or any parent directory:

> When MSBuild runs, *Microsoft.Common.props* searches your directory
> structure for the *Directory.Build.props* file (and
> *Microsoft.Common.targets* looks for *Directory.Build.targets*).

Unfortunately, commit 95f698b introduced some build warnings
because of this change, as some projects were still manually
importing file which were now being imported by
`Directory.Build.props`, resulting in warnings such as:

	tests\Java.Interop-Tests\Java.Interop-Tests.csproj(33,3): Warning MSB4011:
	"d:\a\1\s\bin\BuildRelease\JdkInfo.props" cannot be imported again.
	It was already imported at "d:\a\1\s\Directory.Build.props (13,3)".
	This is most likely a build authoring error.
	This subsequent import will be ignored. 

Remove unnecessary `<Import/>`s from the project files, to reduce the
number of MSB4011 warnings reported.

Note that this does not fix *all* MSB4011 warnings.  In particular
`build-tools/jnienv-gen/jnienv-gen.csproj` still reports warnings, as
it hasn't been migrated to be a Short-Form project yet.

[0]: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets
  • Loading branch information
jpobst authored Mar 19, 2020
1 parent e7c5f54 commit e070ce3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/java-interop/java-interop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
<DefineSymbols>JI_DLL_EXPORT MONODEVELOP MONO_DLL_EXPORT</DefineSymbols>
<SourceDirectory>.</SourceDirectory>
</PropertyGroup>
<Import Project="$(JNIEnvGenPath)\JdkInfo.props" Condition="Exists('$(JNIEnvGenPath)\JdkInfo.props')" />
<Import Project="$(JNIEnvGenPath)\MonoInfo.props" Condition="Exists('$(JNIEnvGenPath)\MonoInfo.props')" />
<ItemGroup>
<ClInclude Include="java-interop.h" />
<ClInclude Include="java-interop-gc-bridge.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
<ProjectReference Include="..\TestJVM\TestJVM.csproj" />
</ItemGroup>

<Import Condition="Exists('$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props')" Project="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props" />

<ItemGroup>
<JavaPerformanceTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\performance\JavaTiming.java" />
</ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions tests/Java.Interop-Tests/Java.Interop-Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
<ProjectReference Include="..\TestJVM\TestJVM.csproj" />
</ItemGroup>

<Import Condition="Exists('$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props')" Project="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props" />

<ItemGroup>
<JavaInteropTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\CrossReferenceBridge.java" />
<JavaInteropTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\CallNonvirtualBase.java" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
<ProjectReference Include="..\..\src\Java.Runtime.Environment\Java.Runtime.Environment.csproj" />
<ProjectReference Include="..\TestJVM\TestJVM.csproj" />
</ItemGroup>

<Import Condition="Exists('$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props')" Project="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props" />

<ItemGroup>
<JavaExportTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\export\ExportType.java" />
Expand Down

0 comments on commit e070ce3

Please sign in to comment.