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

Update SDK and remove RID calculation in favor of RuntimeInformation #35538

Merged
merged 9 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 0 additions & 1 deletion Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<!-- Upfront restore hooks -->
<Import Project="$(RepositoryEngineeringDir)restore\docs.targets" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<Import Project="$(RepositoryEngineeringDir)restore\optimizationData.targets" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(EnableNgenOptimization)' == 'true'" />
<Import Project="$(RepositoryEngineeringDir)restore\runtimeprops.targets" />

<!--
Use synthetic inputs/outputs to avoid building it all the time. This should let devs build with
Expand Down
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<InstallerTasksOutputPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'installer.tasks'))</InstallerTasksOutputPath>
<InstallerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([MSBuild]::NormalizePath('$(InstallerTasksOutputPath)', 'Debug', 'netstandard2.0', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
<InstallerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$([MSBuild]::NormalizePath('$(InstallerTasksOutputPath)', 'Debug', 'net46', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
<HostMachineInfoProps>$(ArtifactsObjDir)HostMachineInfo.props</HostMachineInfoProps>

<DocsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'docs'))</DocsDir>
<ManPagesDir>$([MSBuild]::NormalizeDirectory('$(DocsDir)', 'manpages'))</ManPagesDir>
Expand Down
5 changes: 4 additions & 1 deletion eng/Configurations.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<RepoTasksDir>$([MSBuild]::NormalizeDirectory('$(RepoToolsLocalDir)', 'tasks'))</RepoTasksDir>
<IbcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'ibc'))</IbcOptimizationDataDir>
<XmlDocDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'docs'))</XmlDocDir>
<RuntimePropsFile>$([MSBuild]::NormalizePath('$(ArtifactsDir)', 'tmp', '$(Configuration)', 'RuntimeOS.props'))</RuntimePropsFile>
</PropertyGroup>

<!-- The TFMs to build and test against. -->
Expand All @@ -38,6 +37,10 @@
</PropertyGroup>

<PropertyGroup>
<HostRuntimeIdentifier Condition="'$(HostRuntimeIdentifier)' == '' and '$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</HostRuntimeIdentifier>
<HostRuntimeIdentifier Condition="'$(HostRuntimeIdentifier)' == '' and '$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</HostRuntimeIdentifier>
<RuntimeOS Condition="'$(RuntimeOS)' == '' and '$(HostRuntimeIdentifier)' != ''">$(HostRuntimeIdentifier.Remove($(HostRuntimeIdentifier.LastIndexOf('-'))))</RuntimeOS>
Copy link
Member

Choose a reason for hiding this comment

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

This should not be called RuntimeOS. The other places that use RuntimeOS in this repo use it as "The machine that we are targeting.". The meaning here is "The machine that are running on.".

Copy link
Member

Choose a reason for hiding this comment

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

Also, I am not sure whether it makes sense to move these Host* properties to the shared file. They should not be ever used. Their use in the installer partition is less than ideal.

Copy link
Member Author

Choose a reason for hiding this comment

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

This should not be called RuntimeOS.

This is already called RuntimeOS in libraries. That property is currently generated in https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk/src/AddRuntimeOSPropertyTask.cs#L12 and then imported in https://github.com/dotnet/runtime/blob/master/src/libraries/Directory.Build.props#L29.

For the sake of this PR I will move the RuntimeOS property into libraries.

Also, I am not sure whether it makes sense to move these Host* properties to the shared file.

The HostRuntimeIdentifier property is used in both libraries and installer at the moment that's why I'm extracting the property into this shared file.

Copy link
Member

Choose a reason for hiding this comment

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

The other places that use RuntimeOS in this repo use it as "The machine that we are targeting.". The meaning here is "The machine that are running on.".

There is a property directly below this named $(TargetOS), why don't we use that property to mean "The machine that we are targeting"? That would be a much better name for that property IMO.

Copy link
Member

@eerhardt eerhardt Apr 29, 2020

Choose a reason for hiding this comment

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

Note: src\libraries uses RuntimeOS to mean "The machine that we building on." That is the MSBuild Target that is being removed in this PR - see the GenerateRuntimeOSPropsFileBeforeRestore.

Maybe it would make sense to rectify "RuntimeOS" in a follow up PR? That way we can make forward progress in getting the new SDK in.

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved the property into libraries where it was imported beefore to maintain the existing behavior and semantic. Let's follow-up on the nomenclature in an issue.


<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('OSX'))">OSX</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('FREEBSD'))">FreeBSD</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('NETBSD'))">NetBSD</TargetOS>
Expand Down
1 change: 0 additions & 1 deletion eng/pipelines/installer/jobs/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ jobs:
# independent installers on this leg, but we need to do it somewhere.)
- template: steps/build-linux-package.yml
parameters:
buildTraversalBuildDependencies: true
distroRid: ${{ packageBuild.imageRid }}
image: ${{ packageBuild.image }}
packageStepDescription: Runtime Deps, Runtime, Framework Packs installers
Expand Down
13 changes: 0 additions & 13 deletions eng/pipelines/installer/jobs/steps/build-linux-package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
parameters:
buildTraversalBuildDependencies: false
distroRid: null
image: null
outputRidArg: ''
Expand All @@ -8,18 +7,6 @@ parameters:
subsetArg: ''

steps:
- ${{ if eq(parameters.buildTraversalBuildDependencies, true) }}:
- script: |
set -x
df -h
$(DockerRunMSBuild) ${{ parameters.image }} $(MSBuildScript) \
--ci \
/root/runtime/tools-local/tasks/installer.tasks/installer.tasks.csproj \
/t:Restore /t:Build /t:CreateHostMachineInfoFile \
ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved
$(CommonMSBuildArgs) \
/bl:msbuild.${{ parameters.distroRid }}.traversaldependencies.binlog
displayName: ====== Build traversal build dependencies - ${{ parameters.distroRid }}

- script: |
set -x
df -h
Expand Down
6 changes: 0 additions & 6 deletions eng/pipelines/libraries/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ jobs:
targetFolder: $(Build.ArtifactStagingDirectory)/artifacts/packages
condition: and(succeeded(), eq(variables['_librariesBuildProducedPackages'], true))

- task: CopyFiles@2
displayName: Prepare tmp assets to publish
inputs:
sourceFolder: $(Build.SourcesDirectory)/artifacts/tmp
targetFolder: $(Build.ArtifactStagingDirectory)/artifacts/tmp

- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.ArtifactStagingDirectory)/artifacts
Expand Down
7 changes: 0 additions & 7 deletions eng/restore/runtimeprops.targets

This file was deleted.

4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"sdk": {
"version": "5.0.100-preview.4.20202.8",
"version": "5.0.100-preview.5.20228.8",
"allowPrerelease": true,
"rollForward": "major"
},
"tools": {
"dotnet": "5.0.100-preview.4.20202.8"
"dotnet": "5.0.100-preview.5.20228.8"
},
"native-tools": {
"cmake": "3.14.2",
Expand Down
17 changes: 5 additions & 12 deletions src/installer/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
<SigningToolsDir>$(InstallerProjectRoot)signing\</SigningToolsDir>
</PropertyGroup>

<PropertyGroup>
<HostMachineInfoProps>$(ArtifactsObjDir)HostMachineInfo.props</HostMachineInfoProps>
</PropertyGroup>

<PropertyGroup>
<NETCoreAppFrameworkIdentifier>.NETCoreApp</NETCoreAppFrameworkIdentifier>
<NETCoreAppFrameworkMoniker>$(NETCoreAppFrameworkIdentifier),Version=v$(NETCoreAppFrameworkVersion)</NETCoreAppFrameworkMoniker>
Expand Down Expand Up @@ -80,11 +76,8 @@
<ExeSuffix Condition="'$(TargetOS)' == 'Windows_NT'">.exe</ExeSuffix>
</PropertyGroup>

<Import Project="$(HostMachineInfoProps)"
Condition="Exists('$(HostMachineInfoProps)')" />

<PropertyGroup Condition="'$(OutputRid)' == '' and '$(HostMachineRid)' != ''">
<OutputRid>$(HostMachineRid.Remove($(HostMachineRid.LastIndexOf('-'))))-$(TargetArchitecture)</OutputRid>
<PropertyGroup Condition="'$(OutputRid)' == '' and '$(RuntimeOS)' != ''">
<OutputRid>$(RuntimeOS)-$(TargetArchitecture)</OutputRid>
</PropertyGroup>

<!-- Portable -->
Expand Down Expand Up @@ -298,9 +291,9 @@
</PropertyGroup>
<PropertyGroup Condition="'$(PortableBuild)' == 'true'">
<HostMachineRidTargetsDebianPackages Condition="
$(HostMachineRid.StartsWith('debian')) or
$(HostMachineRid.StartsWith('ubuntu')) or
$(HostMachineRid.StartsWith('linuxmint'))">true</HostMachineRidTargetsDebianPackages>
$(RuntimeOS.StartsWith('debian')) or
$(RuntimeOS.StartsWith('ubuntu')) or
$(RuntimeOS.StartsWith('linuxmint'))">true</HostMachineRidTargetsDebianPackages>
<!-- If the build machine isn't known to be Debian-based, try to build RPM packages. -->
<HostMachineRidTargetsRpmPackages Condition="'$(HostMachineRidTargetsDebianPackages)' != 'true'">true</HostMachineRidTargetsRpmPackages>
</PropertyGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/installer/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
<!-- Provide default targets which can be hooked onto or overridden as necessary -->
<Target Name="Pack" />

<!-- Remove after https://github.com/dotnet/arcade/pull/5365 is merged. -->
<UsingTask TaskName="GenerateGuidFromName" AssemblyFile="$(InstallerTasksAssemblyPath)" />
<UsingTask TaskName="GenerateMsiVersion" AssemblyFile="$(InstallerTasksAssemblyPath)" />
<UsingTask TaskName="GetTargetMachineInfo" AssemblyFile="$(InstallerTasksAssemblyPath)" />
<UsingTask TaskName="RegenerateReadmeTable" AssemblyFile="$(InstallerTasksAssemblyPath)" />

<!-- Common target to find all sfxproj. In a target to avoid evaluating for every project. -->
<Target Name="GetSharedFrameworkProjects">
Expand Down
1 change: 1 addition & 0 deletions src/installer/pkg/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
</Target>

<UsingTask TaskName="GenerateCurrentVersion" AssemblyFile="$(InstallerTasksAssemblyPath)" />
<UsingTask TaskName="GenerateMsiVersion" AssemblyFile="$(InstallerTasksAssemblyPath)" />

<Target Name="GenerateMsiVersionString">
<PropertyGroup>
Expand Down
6 changes: 1 addition & 5 deletions src/installer/test/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,8 @@
</Target>

<Target Name="DetermineTestOutputDirectory">
<GetTargetMachineInfo>
<Output TaskParameter="RuntimeIdentifier" PropertyName="_HostRid" />
</GetTargetMachineInfo>

<PropertyGroup>
<TestTargetRid Condition="'$(TestTargetRid)' == ''">$(_HostRid)</TestTargetRid>
<TestTargetRid Condition="'$(TestTargetRid)' == ''">$(HostRuntimeIdentifier)</TestTargetRid>
<TestsOutputName Condition="'$(TestsOutputName)' == ''">$(MSBuildProjectName)</TestsOutputName>

<TestsOutputRootDir Condition="'$(TestsOutputRootDir)' == ''">$(ArtifactsDir)tests/$(Configuration)/</TestsOutputRootDir>
Expand Down
2 changes: 0 additions & 2 deletions src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
<GeneratePlatformNotSupportedAssemblyHeaderFile>$(RepositoryEngineeringDir)LicenseHeader.txt</GeneratePlatformNotSupportedAssemblyHeaderFile>
</PropertyGroup>

<Import Project="$(RuntimePropsFile)" Condition="Exists('$(RuntimePropsFile)')"/>

<Import Sdk="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Project="Sdk.props" />

<PropertyGroup>
Expand Down
10 changes: 1 addition & 9 deletions tools-local/scripts/dev/master-build-deb-rpm-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,10 @@ package() {
shift

containerized "$image" bash -c "
eng/common/msbuild.sh \
tools-local/tasks/installer.tasks/installer.tasks.csproj \
/t:Restore /t:Build /t:CreateHostMachineInfoFile \
/p:Configuration=Release \
/p:TargetOS=Linux \
/p:PortableBuild=false \
/p:TargetArchitecture=x64 \
/bl:artifacts/msbuild.$name.traversaldependencies.binlog;
./build.sh \
--ci \
--subset installer
/p:OfficialBuildId=20190101.1 \
/p:Subset=Installer \
/p:UsePrebuiltPortableBinariesForInstallers=true \
/p:SharedFrameworkPublishDir=/work/artifacts/obj/linux-x64.Release/sharedFrameworkPublish/ \
/p:InstallerSourceOSPlatformConfig=linux-x64.Release \
Expand Down
67 changes: 0 additions & 67 deletions tools-local/tasks/installer.tasks/GetTargetMachineInfo.cs

This file was deleted.

26 changes: 0 additions & 26 deletions tools-local/tasks/installer.tasks/installer.tasks.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net46</TargetFrameworks>
Expand All @@ -14,7 +13,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelVersion)" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="2.1.0" />
<PackageReference Include="NuGet.ProjectModel" Version="$(RefOnlyNugetProjectModelVersion)" />
<PackageReference Include="NuGet.Packaging" Version="$(RefOnlyNugetPackagingVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="1.7.0" />
Expand Down Expand Up @@ -44,28 +42,4 @@
</ItemGroup>
</Otherwise>
</Choose>

<UsingTask TaskName="GetTargetMachineInfo"
AssemblyFile="$(InstallerTasksAssemblyPath)" />
<Target Name="CreateHostMachineInfoFile"
AfterTargets="DispatchToInnerBuilds">
<GetTargetMachineInfo>
<Output PropertyName="HostMachineRid" TaskParameter="RuntimeIdentifier" />
</GetTargetMachineInfo>

<PropertyGroup>
<HostMachineInfoPropsContent>
&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
&lt;PropertyGroup&gt;
&lt;HostMachineRid&gt;$(HostMachineRid)&lt;/HostMachineRid&gt;
&lt;/PropertyGroup&gt;
&lt;/Project&gt;
</HostMachineInfoPropsContent>
</PropertyGroup>

<WriteLinesToFile File="$(HostMachineInfoProps)"
Lines="$(HostMachineInfoPropsContent)"
Overwrite="True" />
</Target>

</Project>