Skip to content

Commit

Permalink
[build] Import "parent directory.override.targets" (dotnet#135)
Browse files Browse the repository at this point in the history
Context: ff73f92
Context: xamarin/XamarinVS#12550

The XamarinVS team would like to *not* use `GitInfo` to set the
`$(Version)` MSBuild property (commit ff73f92), and would like to
instead version *all* of their dependencies with the same version.

Support this behavior by by updating `Directory.Build.targets` to
import "parent directory.override.targets", a'la
[xamarin/java.interop@8898bc][0] and [xamarin/java.interop@9a878f][1].
For example, if `xamarin-android-tools` is checked out into:

	external/xamarin-android-tools

then we'll import `external/xamarin-android-tools.override.targets`
from `Directory.Build.targets`.

The `<Import/>` of the parent-directory `.targets` file *must* be
*last* within `Directory.Build.targets`, so that it can override any
targets in our default `Directory.Build.targets`, e.g. the
`SetVersion` target.

[0]: dotnet/java-interop@8898bc1
[1]: dotnet/java-interop@9a878f2
  • Loading branch information
BretJohnson authored Sep 24, 2021
1 parent a5194e9 commit 061bcc2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
<InformationalVersion>$(Version); git-rev-head:$(GitCommit); git-branch:$(GitBranch)</InformationalVersion>
</PropertyGroup>
</Target>

<Import
Project="$([System.IO.Path]::GetDirectoryName($(MSBuildThisFileDirectory))).override.targets"
Condition=" Exists('$([System.IO.Path]::GetDirectoryName($(MSBuildThisFileDirectory))).override.targets') "
/>
</Project>

0 comments on commit 061bcc2

Please sign in to comment.