This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
forked from dotnet/msbuild
-
Notifications
You must be signed in to change notification settings - Fork 32
Backport changes required for XI/XM's msbuild port #63
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rty (dotnet#59) * Add support for fallback paths to be specified via property references Currently, the list of fallback paths in app.config can have a property reference, like: ``` <searchPaths os="osx"> <property name="MSBuildExtensionsPath" value="$(FallbackPath);/x/y/z" /> ``` .. but it is assumed that such a property will expand to a single path. This commit adds support for such properties to expand to multiple ';' separated list of paths. The rules for expansion do not change, they are still expanded at the time of project import. With this, given `$(FallbackPath)="/a/b/c;/q/w/e"` and the list of fallback paths would become `"/a/b/c;/q/w/e;/x/yz"`. * [osx] Add property allowing users to override fallback paths for .. .. MSBuildExtensionsPath. For OSX, this essentially sets the fallback paths to: `<property name="MSBuildExtensionsPath" value="$(MSBuildExtensionsPathFallbackPathsOverride);/Library/Frameworks/Mono.framework/External/xbuild/" />` .. whichs allows the default fallback paths to be overridden by setting a property - `$(MSBuildExtensionsPathFallbackPathsOverride)`. One of the useful use cases for this is to be able to run tests with in-tree builds of assemblies/targets meant for `$(MSBuildExtensionsPath)/`. Simply changing `$(MSBuildExtensionsPath)` would mean that the in-tree builds of the custom frameworks would work but the default ones would not be found! (cherry picked from commit c4e70a6)
.. in preparation for upcoming commits. (cherry picked from commit c27d895)
.. search paths. `ToolLocationHelper.GetPathTo{StandardLibraries,ReferenceAssemblies}` look for the target framework in the path specified by @targetFrameworkRootPath parameter (roughly corresponding to the $(TargetFrameworkRootPath) property) or the default path. It would be useful to be able to look for these frameworks in more than one location. For example, in case of Xamarin products on OSX, mobile specific frameworks are installed in `/Library/Frameworks/Mono.framework/External/xbuild-frameworks` and the .NET ones are installed in `/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks` . With support for fallback search paths, a lookup for a target framework will follow the order: 1. @targetFrameworkRootPath or default location if @targetFrameworkRootPath is '' 2. Fallback search paths APIs changed: GetPathToStandardLibraries(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile, string platformTarget, string targetFrameworkRootPath) changed to => GetPathToStandardLibraries(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile, string platformTarget, string targetFrameworkRootPath, string targetFrameworkFallbackSearchPaths = null) GetPathToReferenceAssemblies(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile, string platformTarget, string targetFrameworkRootPath) changed to => GetPathToReferenceAssemblies(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile, string platformTarget, string targetFrameworkRootPath, string targetFrameworkFallbackSearchPaths = null) New overload: GetPathToReferenceAssemblies(string targetFrameworkRootPath, string targetFrameworkFallbackSearchPaths, FrameworkNameVersioning frameworkName) - The reason for using a `targetFrameworkRootPath` parameter separate from the `targetFrameworkFallbackSearchPaths` is that we need to automatically fallback to a default path, which is being determined in code (`FrameworkLocationHelper.programFilesReferenceAssemblyLocation`). - Also, the parameter `targetFrameworkRootPath` roughly corresponds to the `$(TargetFrameworkRootPath)` property and changing that to have multiple paths would change it's meaning. (cherry picked from commit 3d34ef6)
.. frameworks. This contains ';' separated list of paths. When `GetReferenceAssemblyPaths` task will look for assemblies corresponding to a target framework, then it will try to find it in multiple locations: 1. $(TargetFrameworkRootPath) or the default path if $(TargetFrameworkRootPath) is '' 2. Each path in $(TargetFrameworkFallbackSearchPaths) (cherry picked from commit a90074b)
- This sets up the $(TargetFrameworkFallbackSearchPaths) to point to `/Library/Frameworks/Mono.framework/External/xbuild-frameworks` on mono/osx. This location is used by Xamarin to install frameworks. The .net frameworks are available in usual default location. So, effectively, target frameworks are looked up, in order: 1. $(TargetFrameworkRootPath) or the default location, if $(TargetFrameworkRootPath) is '' 2. If not found in (1), then try to find it in the fallback search paths specified in $(TargetFrameworkFallbackSearchPaths) Note that we always add the `External` as the last fallback path on `$(TargetFrameworkFallbackSearchPaths)`. Rationale: When running on Mono, target frameworks are searched for in `$mono_prefix/lib/mono/xbuild-frameworks`, which becomes `/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks`. This works, but has a problem when upgrading the Mono.framework package: a *new* `/Library/Frameworks/Mono.framework/Versions/@Version@` directory is created, so anything installed into the previous directory will be "lost". The file is still there, but xbuild will no longer find it. To address this upgrade scenario, Mono's xbuild also checks a fallback path: `/Library/Frameworks/Mono.framework/External/xbuild-frameworks` This location is not within a versioned framework directory, and thus files installed into it will survive Mono.framework package upgrades. This also allows overriding the root path to test in-tree builds of custom target frameworks. Simply changing `$(TargetFrameworkRootPath)` would mean that the in-tree builds of the custom frameworks would work but the default ones would not be found! (cherry picked from commit 0fa0323)
Why do we need that in 2018-02? We are working on 2018-04 so it should be fine to land it there only |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Specifically, PRs: #59 and #60