Add Path.GetRelativePath#11689
Conversation
|
|
||
| /// <summary> | ||
| /// Create a relative path from one path to another. Paths will be resolved before calculating the difference. | ||
| /// Default path comparison for the active platform will be used (OrdinalIgnoreCase for Windows, Ordinal for Unix/Mac). |
a08e1d5 to
d7b445c
Compare
|
|
||
| internal const string ParentDirectoryPrefix = @"../"; | ||
|
|
||
| internal static readonly StringComparison DefaultPathComparison = StringComparison.Ordinal; |
There was a problem hiding this comment.
Shouldn't this be OrdinalIgnoreCase on macOS?
There was a problem hiding this comment.
As I noted yesterday, we also already have internal support for this, which we should just reuse:
https://github.com/dotnet/corefx/blob/master/src/Common/src/System/IO/PathInternal.CaseSensitivity.cs
There was a problem hiding this comment.
Shouldn't this be OrdinalIgnoreCase on macOS?
Yes, thanks.
As I noted yesterday, we also already have internal support for this
I'm slightly uncomfortable with case sensitivity coming from the state of the temp directory. I need to think that over a bit.
There was a problem hiding this comment.
Unfortunately I can't use the existing class as it has dependencies on System.IO.FileSystem. Updating with comments.
4fdae51 to
c50d2c3
Compare
|
@joperezr This should tackle #11321 - can you take a look? |
|
|
||
| :: Need updated nuget binaries in our cli drop | ||
| echo Updating CLI Nuget Frameworks map... | ||
| robocopy "%TOOLRUNTIME_DIR%" "%TOOLRUNTIME_DIR%\dotnetcli\sdk\%DOTNET_VERSION%" Nuget.Frameworks.dll /XO >> "%INIT_TOOLS_LOG%" |
There was a problem hiding this comment.
Note that copying all of the Nuget.* dlls causes failures.
There was a problem hiding this comment.
I was expecting Nuget.*.dll to work as well. What errors are you seeing?
In reply to: 78878113 [](ancestors = 78878113)
There was a problem hiding this comment.
It tries to bring in some other class that it can't find- I didn't dig into it further, just pedaled back for expediency
There was a problem hiding this comment.
Why are we doing this as opposed to pulling them in via BuildTools?
There was a problem hiding this comment.
They are already in buildtools, we're just making CLI use the updated one from buildtools. You could ask "why aren't we pulling it in via CLI?" and the answer would be: CLI takes too long to update and its unclear if folks care about updating the current form given the msbuild switch.
|
@dotnet-bot test Innerloop Windows_NT Debug Build and Test |
|
Not sure why the init-tools.cmd is failing on the CI, is there a way to get init-tools.log files? |
|
@dotnet-bot test Innerloop Windows_NT Debug Build and Test |
| echo %PROJECT_JSON_CONTENTS% > "%PROJECT_JSON_FILE%" | ||
| echo Running %0 > "%INIT_TOOLS_LOG%" | ||
|
|
||
| set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt" |
There was a problem hiding this comment.
I need it outside of the block that might be skipped
| :afterbuildtoolsrestore | ||
|
|
||
| echo Initializing BuildTools ... | ||
| echo Initializing BuildTools... |
There was a problem hiding this comment.
I removed the extra space to make it match the rest
| fi | ||
|
|
||
| echo "Updating CLI Nuget Frameworks map..." | ||
| cp -u $__TOOLRUNTIME_DIR/Nuget.Frameworks.dll $__TOOLRUNTIME_DIR/dotnetcli/sdk/$__DOTNET_TOOLS_VERSION >> $__init_tools_log |
There was a problem hiding this comment.
Should we verify that the exit code is 0 after this?
There was a problem hiding this comment.
Probably- I need to look up how to do this, so rusty with bash...
There was a problem hiding this comment.
that is what the previous checks for if [ "$?" != "0" ]; then checks are doing
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> | ||
| <ItemGroup> | ||
| <Project Include="*\ref\**\*.*proj"> | ||
| <Project Include="*\ref\**\*.builds;*\ref\**\*.*proj"> |
There was a problem hiding this comment.
I believe that with this approach some projects will get built twice? wherever there is a builds file, we shouldn't build the csprojs that it calls, but I'm not sure how to do this. @ericstj thoughts?
There was a problem hiding this comment.
It won't actually build twice, MSBuild is smart enough to prevent that. If this becomes common-place we'll switch to builds everywhere, but right now that's unnecessary overhead.
There was a problem hiding this comment.
I also worry about this a little but I'm good with this for now.
| <ItemGroup> | ||
| <Project Include="System.Runtime.Extensions.csproj" /> | ||
| <Project Include="System.Runtime.Extensions.csproj"> | ||
| <TargetGroup>netcoreapp1.1</TargetGroup> |
There was a problem hiding this comment.
@ericstj should we have a different AssemblyVersion for the netcoreapp1.1 contract?
There was a problem hiding this comment.
No: we have similar precedent on desktop where more surface area is visible via facades.
| @@ -0,0 +1 @@ | |||
| MembersMustExist : Member 'System.IO.Path.CreateRelativePath(System.String, System.String)' does not exist in the implementation but it does exist in the contract. No newline at end of file | |||
There was a problem hiding this comment.
How come this wasn't complaining before?
There was a problem hiding this comment.
We can't have exceptions for net462, that's already shipped. I suspect that the net462 targetgroup is resolving the wrong contract assembly.
There was a problem hiding this comment.
I'll try removing this- it might be an artifact of iteration
| <ItemGroup Condition="'$(TargetGroup)'=='netcoreapp1.1'"> | ||
| <TestNugetTargetMoniker Include="$(NugetTargetMoniker)"> | ||
| <Folder>netcoreapp1.1</Folder> | ||
| </TestNugetTargetMoniker> |
There was a problem hiding this comment.
You don't need this as I saw that it is already in dir.props
| <ItemGroup Condition="'$(TargetGroup)'=='netstandard1.7'"> | ||
| <TestNugetTargetMoniker Include="$(NugetTargetMoniker)"> | ||
| <Folder>ns1.7-netcoreapp1.1</Folder> | ||
| </TestNugetTargetMoniker> |
There was a problem hiding this comment.
This should probably go in dir.props as I suppose a lot of test projects will start doing this.
|
@JeremyKuhne , can you rebase on master and remove the init-tools workaround? |
|
@ericstj I removed the init-tools workaround last night. |
c3f4c5b to
bc045b5
Compare
|
@ericstj, @weshaggard, @joperezr This should be clean now- can I get sign off? |
| "System.Runtime": "4.1.0" | ||
| }, | ||
| "frameworks": { | ||
| "netstandard1.7": { |
There was a problem hiding this comment.
This will generate a warning when you build the netcoreapp1.1 configuration. You can also delete the imports, they're no longer needed for the package version you are referencing.
ericstj
left a comment
There was a problem hiding this comment.
Modulo a couple nits it looks good.
| <TargetingPackReference Include="System.Private.Interop" /> | ||
| <TargetingPackReference Include="System.Private.Reflection" /> <!-- can remove once we remove the Environment reflection workaround --> | ||
| <TargetingPackReference Include="System.Private.Reflection" /> | ||
| <!-- can remove once we remove the Environment reflection workaround --> |
There was a problem hiding this comment.
nit: reformatting here may have changed meaning of the comment.
There was a problem hiding this comment.
Moved this above, thanks
bc045b5 to
b8c9a4e
Compare
|
@dotnet-bot test Innerloop Windows_NT Release Build and Test |
This change adds Path.GetRelativePath, which will calculate the relative path from one directory to another file/directory. This change also adds support for targetting netcoreapp
b8c9a4e to
387cf98
Compare
|
@dotnet-bot test this please |
| { | ||
| "dependencies": { | ||
| "System.Runtime": "4.0.20" | ||
| "System.Runtime": "4.1.0" |
There was a problem hiding this comment.
Can we change this to the latest System.Runtime package prerelease? that way you will get netstandard1.7 version of System.Runtime surface area.
There was a problem hiding this comment.
Sure, I'll update it
| "netstandard1.7": {} | ||
| "netstandard1.7": {}, | ||
| "netcoreapp1.1": {}, | ||
| "netcoreapp1.0": {} |
There was a problem hiding this comment.
you shouldn't need netcoreapp1.0 since that should come from the supports corefx.Test.netcoreapp1.0
There was a problem hiding this comment.
Ok, I'll try and remove it
| <DefineConstants Condition="'$(TargetGroup)'=='netstandard1.7'">$(DefineConstants);netstandard17</DefineConstants> | ||
| <NugetTargetMoniker Condition="'$(NugetTargetMoniker)'==''">.NETStandard,Version=v1.5</NugetTargetMoniker> | ||
| </PropertyGroup> | ||
| <ItemGroup Condition="'$(TargetGroup)'=='netstandard1.7'"> |
There was a problem hiding this comment.
We should log an issue in buildtools to move this code there instead.
There was a problem hiding this comment.
This should go with the 1.2 issue, right? Or at least be associated.
joperezr
left a comment
There was a problem hiding this comment.
Couple of comments but this LGTM assuming CI is green.
The workarounds are no longer needed and fail with the dir.targets workaround removed.
Test targets need updated to avoid issues when building multithreaded. See #11468.
|
@dotnet-bot test Innerloop CentOS7.1 Release Build and Test |
|
We want to get this in netfx eventually. |
…ePath Add Path.GetRelativePath Commit migrated from dotnet/corefx@e4ea1fd
This change adds Path.GetRelativePath, which will calculate the relative
path from one directory to another file/directory.
The original proposal: #6191
@terrajobst, @ericstj, @jamesqo
CC: @danmosemsft