Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Import $(MSBuildProjectDirectory).override.props #872

Merged

Conversation

jonpryor
Copy link
Member

Commit b6431ac introduced support for Configuration.Override.props,
which eventually allowed overriding the external/xamarin-android-tools
path via the $(XamarinAndroidToolsDirectory) MSBuild property in
commit 32f0c9c.

A problem with this approach is that it requires that the host repo
create the Java.Interop/Configuration.Override.props file before
running make -C …/Java.Interop prepare.

This can be simplified: update Directory.Build.props so that it
will also <Import/> the file
$(MSBuildProjectDirectory).override.props.
$(MSBuildProjectDirectory) is:

The absolute path of the directory where the project file is
located, for example C:\MyCompany\MyProduct.

Do not include the final backslash on this property.

The "Do not" is grammatically odd, as it's set by MSBuild.
It does not include a final backslash.

This means that we can place the .override.props file in the
directory containing the Java.Interop checkout, with a name that
matches the git submodule directory name:

external/my-Java.Interop-checkout                   # git submodule to xamarin/Java.Interop
external/my-Java.Interop-checkout.override.props    # now automatically imported

Commit b6431ac introduced support for `Configuration.Override.props`,
which eventually allowed overriding the `external/xamarin-android-tools`
path via the `$(XamarinAndroidToolsDirectory)` MSBuild property in
commit 32f0c9c.

A problem with this approach is that it requires that the host repo
create the `Java.Interop/Configuration.Override.props` file before
running `make -C …/Java.Interop prepare`.

This can be simplified: update `Directory.Build.props` so that it
will also `<Import/>` the file
`$(MSBuildProjectDirectory).override.props`.
[`$(MSBuildProjectDirectory)`][0] is:

> The absolute path of the directory where the project file is
> located, for example `C:\MyCompany\MyProduct`.
>
> Do not include the final backslash on this property.

The "Do not" is grammatically odd, as it's set by MSBuild.
It *does not* include a final backslash.

This means that we can place the `.override.props` file in the
directory containing the Java.Interop checkout, with a name that
matches the git submodule directory name:

	external/my-Java.Interop-checkout                   # git submodule to xamarin/Java.Interop
	external/my-Java.Interop-checkout.override.props    # now automatically imported

[0]: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2019
@jonpryor jonpryor merged commit 8898bc1 into dotnet:main Aug 24, 2021
jpobst pushed a commit that referenced this pull request Sep 30, 2021
Commit b6431ac introduced support for `Configuration.Override.props`,
which eventually allowed overriding the `external/xamarin-android-tools`
path via the `$(XamarinAndroidToolsDirectory)` MSBuild property in
commit 32f0c9c.

A problem with this approach is that it requires that the host repo
create the `Java.Interop/Configuration.Override.props` file before
running `make -C …/Java.Interop prepare`.

This can be simplified: update `Directory.Build.props` so that it
will also `<Import/>` the file
`$(MSBuildProjectDirectory).override.props`.
[`$(MSBuildProjectDirectory)`][0] is:

> The absolute path of the directory where the project file is
> located, for example `C:\MyCompany\MyProduct`.
>
> Do not include the final backslash on this property.

The "Do not" is grammatically odd, as it's set by MSBuild.
It *does not* include a final backslash.

This means that we can place the `.override.props` file in the
directory containing the Java.Interop checkout, with a name that
matches the git submodule directory name:

	external/my-Java.Interop-checkout                   # git submodule to xamarin/Java.Interop
	external/my-Java.Interop-checkout.override.props    # now automatically imported

[0]: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2019
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants