Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Clean up OS-related property uses, update buildtools, update MSBuild #15728

Merged
merged 3 commits into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BuildToolsVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.27-prerelease-01230-01
1.0.27-prerelease-01302-01
17 changes: 10 additions & 7 deletions Tools-Override/Build.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@

<!-- Platform detection -->
<PropertyGroup>
<OsEnvironment Condition="'$(OsEnvironment)'=='' AND '$(OS)'=='Unix' AND Exists('/Applications')">OSX</OsEnvironment>
<OsEnvironment Condition="'$(OsEnvironment)'=='' AND '$(OS)'=='Unix'">Linux</OsEnvironment>
<OsEnvironment Condition="'$(OsEnvironment)'==''">$(OS)</OsEnvironment>
<RunningOnUnix Condition="'$(OS)' != 'Windows_NT'">true</RunningOnUnix>
<DefaultOSGroup Condition="'$(OS)'=='Unix' AND Exists('/Applications')">OSX</DefaultOSGroup>
<DefaultOSGroup Condition="'$(DefaultOSGroup)'=='' AND '$(OS)'=='Unix'">Linux</DefaultOSGroup>
<DefaultOSGroup Condition="'$(DefaultOSGroup)'==''">$(OS)</DefaultOSGroup>
Copy link
Member

@akoeplinger akoeplinger Feb 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mellinoe noticed this while looking at the other problem: there are still a few targets in buildtools that rely on OsEnvironment being set, e.g.: https://github.com/dotnet/buildtools/search?utf8=%E2%9C%93&q=OsEnvironment

I think with this change those would be doing the wrong thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah there are a few things in there that would be broken, although most of the interesting ones are being overridden here. I'll file an issue in buildtools to clean those up when we integrate the corefx changes back into there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<RunningOnUnix Condition="'$(OS)'!='Windows_NT'">true</RunningOnUnix>

<RunningOnCore Condition="'$(MSBuildRuntimeType)' == 'core'">true</RunningOnCore>
</PropertyGroup>

<!-- Common BuildTools properties -->
Expand All @@ -35,9 +37,10 @@
<ToolRuntimePath Condition="'$(ToolRuntimePath)'=='' and '$(ProjectDir)'!=''">$(ProjectDir)Tools/</ToolRuntimePath>
<ToolsDir Condition="'$(ToolsDir)'==''">$(MSBuildThisFileDirectory)</ToolsDir>
<DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ToolRuntimePath)dotnetcli/</DotnetCliPath>
<OverrideToolHost>$(DotnetCliPath)dotnet</OverrideToolHost>
<BuildToolsTaskDir Condition="'$(MSBuildRuntimeType)'!='core'">$(ToolsDir)net45/</BuildToolsTaskDir>
<BuildToolsTaskDir Condition="'$(MSBuildRuntimeType)'=='core'">$(ToolsDir)</BuildToolsTaskDir>
<OverrideToolHost Condition="'$(RunningOnUnix)' == 'true'">$(DotnetCliPath)dotnet</OverrideToolHost>
<OverrideToolHost Condition="'$(RunningOnUnix)' != 'true'">$(DotnetCliPath)dotnet.exe</OverrideToolHost>
<BuildToolsTaskDir Condition="'$(RunningOnCore)'!='true'">$(ToolsDir)net45/</BuildToolsTaskDir>
<BuildToolsTaskDir Condition="'$(RunningOnCore)'=='true'">$(ToolsDir)</BuildToolsTaskDir>
<UseRoslynCompilers Condition="'$(UseRoslynCompilers)'=='' and '$(RunningOnUnix)'=='true'">false</UseRoslynCompilers>
<UseSharedCompilation Condition="'$(UseSharedCompilation)' == '' and '$(RunningOnUnix)' != 'true' and '$(UseRoslynCompilers)' != 'false'">true</UseSharedCompilation>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Tools-Override/CodeCoverage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- Coverage options -->
<PropertyGroup>
<CodeCoverageEnabled>false</CodeCoverageEnabled>
<CodeCoverageEnabled Condition="'$(SkipTests)' != 'true' and '$(OS)' == 'Windows_NT' and '$(Coverage)' == 'true' and '$(Performance)' != 'true'">true</CodeCoverageEnabled>
<CodeCoverageEnabled Condition="'$(SkipTests)' != 'true' and '$(RunningOnUnix)' != 'true' and '$(Coverage)' == 'true' and '$(Performance)' != 'true'">true</CodeCoverageEnabled>
<CoverageReportDir Condition="'$(CoverageReportDir)' == ''">$(TestWorkingDir)coverage\</CoverageReportDir>

<!-- This targets file has two modes one for individual projects and one for all -->
Expand Down
16 changes: 7 additions & 9 deletions Tools-Override/ConstructSharedFx.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,17 @@

<ItemGroup>
<!-- This will only copy over the related file -->
<HostFxrFile Condition="'$(OS)'=='Windows_NT'" Include="$(RuntimePath)hostfxr.dll" />
<HostFxrFile Condition="'$(OS)'=='Unix'" Include="$(RuntimePath)libhostfxr.so" />
<HostFxrFile Condition="'$(OS)'=='Unix'" Include="$(RuntimePath)libhostfxr.dylib" />
<DotnetExe Condition="'$(OS)'=='Windows_NT'" Include="$(RuntimePath)dotnet.exe" />
<DotnetExe Condition="'$(OS)'!='Windows_NT'" Include="$(RuntimePath)dotnet" />
<HostFxrFile Condition="'$(OSGroup)'=='Windows_NT'" Include="$(RuntimePath)hostfxr.dll" />
<HostFxrFile Condition="'$(OSGroup)'=='Linux'" Include="$(RuntimePath)libhostfxr.so" />
<HostFxrFile Condition="'$(OSGroup)'=='OSX'" Include="$(RuntimePath)libhostfxr.dylib" />
<DotnetExe Condition="'$(RunningOnUnix)'!='true'" Include="$(RuntimePath)dotnet.exe" />
<DotnetExe Condition="'$(RunningOnUnix)'=='true'" Include="$(RuntimePath)dotnet" />
</ItemGroup>
<MakeDir Directories="$(TestSharedFxPathHostFxr)" />
<Copy SourceFiles="@(HostFxrFile)"
DestinationFolder="$(TestSharedFxPathHostFxr)"
Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
DestinationFolder="$(TestSharedFxPathHostFxr)" />
<Copy SourceFiles="@(DotnetExe)"
DestinationFolder="$(TestSharedFxDir)"
Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
DestinationFolder="$(TestSharedFxDir)" />
<ItemGroup>
<LiveDotNetCliComponents Include="$(RuntimePath)\*.*" Exclude="$(RuntimePath)\xunit.console.netcore.exe" />
</ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions Tools-Override/Roslyn.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
<PropertyGroup>
<RoslynVersion>2.0.0-beta3</RoslynVersion>
<RoslynPackageName>Microsoft.Net.Compilers</RoslynPackageName>
<RoslynTargetsPath>$(ToolRuntimePath)</RoslynTargetsPath>
</PropertyGroup>

<PropertyGroup>
<RoslynPropsFile Condition="'$(RoslynPropsFile)' == '' and '$(RunningOnUnix)' != 'true'">$(ToolRuntimePath)/net45/roslyn/build/Microsoft.Net.Compilers.props</RoslynPropsFile>
<RoslynPropsFile Condition="'$(RoslynPropsFile)' == '' and '$(RunningOnCore)' != 'true'">$(ToolRuntimePath)/net45/roslyn/build/Microsoft.Net.Compilers.props</RoslynPropsFile>
</PropertyGroup>

<!--
On Unix we always use a version of Roslyn we restore from NuGet and we have to work around some known issues.
-->
<PropertyGroup Condition="'$(RoslynPropsFile)' == '' and '$(RunningOnUnix)' == 'true'">
<PropertyGroup Condition="'$(RoslynPropsFile)' == '' and '$(RunningOnCore)' == 'true'">
<RoslynPackageDir>$(PackagesDir)/$(RoslynPackageName).$(RoslynVersion)/</RoslynPackageDir>
<RoslynPropsFile>$(RoslynPackageDir)build/$(RoslynPackageName).props</RoslynPropsFile>

Expand Down
4 changes: 2 additions & 2 deletions Tools-Override/codeAnalysis.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
always be net45 (because we use Mono to run our tests and Mono needs to load the net45 version)
-->
<PropertyGroup>
<CodeAnalyzerDir Condition="'$(CodeAnalyzerDir)'=='' and '$(OSEnvironment)'=='Windows_NT'">$(ToolsDir)net45/analyzers/</CodeAnalyzerDir>
<CodeAnalyzerDir Condition="'$(CodeAnalyzerDir)'=='' and '$(OSEnvironment)'!='Windows_NT'">$(ToolsDir)analyzers/</CodeAnalyzerDir>
<CodeAnalyzerDir Condition="'$(CodeAnalyzerDir)'=='' and '$(RunningOnCore)'!='true'">$(ToolsDir)net45/analyzers/</CodeAnalyzerDir>
<CodeAnalyzerDir Condition="'$(CodeAnalyzerDir)'=='' and '$(RunningOnCore)'=='true'">$(ToolsDir)analyzers/</CodeAnalyzerDir>
</PropertyGroup>

<!-- PInvokeChecker data files-->
Expand Down
4 changes: 1 addition & 3 deletions Tools-Override/tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,8 @@
</Target>

<Target Name="CheckTestPlatforms">
<GetTargetMachineInfo Condition="'$(TargetOS)' == ''">
<Output TaskParameter="TargetOS" PropertyName="TargetOS" />
</GetTargetMachineInfo>
<PropertyGroup>
<TargetOS Condition="'$(TargetOS)' == ''">$(DefaultOSGroup)</TargetOS>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't enough to correctly filter for the other OS's. DefaultOSGroup will only ever have OSX, Unix, or Windows_NT. I expect this will break some tests. See TargetOSTrait above for example it has some other targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultOSGroup is set to Linux in cases where $(OS) == Unix and the /Applications/ folder doesn't exist (it should only exist on OSX).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about FreeBSD/NetBSD? will those ever be set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will not, but we don't use those anywhere right now. We'd probably need to add some extra logic to auto-detect it, or go back to using the build task for that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK can you clean those out then if they are dead. I would like to keep these things consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to keep them. There are a couple of tests that have [PlatformSpecific(TestPlatforms.FreeBSD)], it's just that we do not have any runs that would ever use that right now. If you were trying to run those tests, you would just need to specify TargetOS=FreeBSD manually.

<TestDisabled Condition="'%(UnsupportedPlatformsItems.Identity)' == '$(TargetOS)' Or '$(ConfigurationErrorMsg)' != ''">true</TestDisabled>
</PropertyGroup>
<Message Text="CheckTestPlatforms found TargetOS of [$(TargetOS)]." Importance="Low" />
Expand Down
6 changes: 3 additions & 3 deletions Tools-Override/versioning.targets
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@
</ItemGroup>
<!-- Windows Exec command requires DOS escaping for the percent sign since it secretly runs the process in a shell instead of calling createprocess. -->
<PropertyGroup>
<LatestDateCommand Condition="'$(OsEnvironment)'=='Windows_NT'">git show -s --format=^%25%25cd --date=short HEAD</LatestDateCommand>
<LatestDateCommand Condition="'$(OsEnvironment)'!='Windows_NT'">git show -s --format=%25cd --date=short HEAD</LatestDateCommand>
<LatestDateCommand Condition="'$(RunningOnUnix)'!='true'">git show -s --format=^%25%25cd --date=short HEAD</LatestDateCommand>
<LatestDateCommand Condition="'$(RunningOnUnix)'=='true'">git show -s --format=%25cd --date=short HEAD</LatestDateCommand>
</PropertyGroup>

<Exec Command="$(LatestDateCommand)" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="VersionSeedDate" />
<Output TaskParameter="ExitCode" PropertyName="LatestDateCommandExitCode" />
Expand Down
2 changes: 1 addition & 1 deletion dir.props
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
See Documentation/coding-guidelines/project-guidelines.md for more details on our configurations.
-->
<TargetGroup Condition="'$(TargetGroup)' == ''">netcoreapp</TargetGroup>
<OSGroup Condition="'$(OSGroup)' == ''">$(OSEnvironment)</OSGroup>
<OSGroup Condition="'$(OSGroup)' == ''">$(DefaultOSGroup)</OSGroup>
<ConfigurationGroup Condition="'$(ConfigurationGroup)' == ''">Debug</ConfigurationGroup>
<ArchGroup Condition="'$(ArchGroup)' == ''">x64</ArchGroup>

Expand Down