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

Buildwork to remove dir.props files #26960

Merged
merged 27 commits into from
Oct 15, 2019
Merged

Conversation

davidwrighton
Copy link
Member

No description provided.

@davidwrighton
Copy link
Member Author

/azp help

@azure-pipelines
Copy link

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or a specific pipeline for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify a pipeline to run.
    • Example: "run" or "run pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@davidwrighton
Copy link
Member Author

/azp run coreclr-ci

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@davidwrighton davidwrighton changed the title [WIP] Buildwork to remove dir.props files Buildwork to remove dir.props files Oct 4, 2019
@davidwrighton davidwrighton marked this pull request as ready for review October 4, 2019 01:57
@@ -0,0 +1,2 @@
<Project>
Copy link

Choose a reason for hiding this comment

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

What is the purpose of this file? Do you mind adding it as a comment in the file?

@@ -324,7 +324,7 @@ for /l %%G in (1, 1, %__NumberOfTestGroups%) do (

if not "%__CopyNativeTestBinaries%" == "1" (
REM Disable warnAsError - coreclr issue 19922
set __MSBuildBuildArgs=!__ProjectDir!\tests\build.proj -warnAsError:0 !__Logging! !TargetsWindowsMsbuildArg! !__msbuildArgs! !__PriorityArg! !__UnprocessedBuildArgs! /p:CopyNativeProjectBinaries=!__CopyNativeProjectsAfterCombinedTestBuild!
set __MSBuildBuildArgs=!__ProjectDir!\tests\build.proj -warnAsError:0 /nodeReuse:false !__Logging! !TargetsWindowsMsbuildArg! !__msbuildArgs! !__PriorityArg! !__UnprocessedBuildArgs! /p:CopyNativeProjectBinaries=!__CopyNativeProjectsAfterCombinedTestBuild!
Copy link

Choose a reason for hiding this comment

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

Thank you for adding nodeReuse=false!

Copy link
Member

Choose a reason for hiding this comment

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

We should make a note to set nodeReuse to false in configure-toolset.ps1/sh (separately from this change).

@@ -302,6 +302,7 @@ if /i %__BuildType% NEQ Release set __RestoreOptData=0

set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__ArtifactsIntermediatesDir=%__ProjectDir%\artifacts\obj\"
Copy link

Choose a reason for hiding this comment

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

Are we no longer using bin/obj?

Copy link
Member

Choose a reason for hiding this comment

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

Are native ones still in bin/obj? Might be worth commenting.

@@ -321,6 +322,9 @@ if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"
if not exist "%__MsbuildDebugLogsDir%" md "%__MsbuildDebugLogsDir%"

if not exist "%__RootBinDir%\Directory.Build.props" copy %__ProjectDir%\EmptyProps.props %__RootBinDir%\Directory.Build.props
Copy link

Choose a reason for hiding this comment

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

Same as emptyprops, this seems to need comments explaining what this is doing and why.

@@ -430,7 +434,7 @@ REM ===
REM =========================================================================================

set __IntermediatesIncDir=%__IntermediatesDir%\src\inc
set __IntermediatesEventingDir=%__IntermediatesDir%\Eventing
set __IntermediatesEventingDir=%__ArtifactsIntermediatesDir%\Eventing\%__BuildArch%\%__BuildType%
Copy link

Choose a reason for hiding this comment

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

+1 for buildarch and build type. Could you also add OS?

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 matches with where the Arcade logic puts stuff. I'm not changing that.

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetPathOfFileAbove(dir.props))" />
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />
Copy link

Choose a reason for hiding this comment

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

Same issue as the ilasm pkgproj

@@ -419,7 +417,7 @@
</ItemGroup>
<Import Project="shared\System.Private.CoreLib.Shared.projitems" />
<PropertyGroup>
<CheckCDefines Condition="'$(CheckCDefines)'==''">true</CheckCDefines>
<CheckCDefines Condition="'$(CheckCDefines)'=='' And '$(PYTHON)' != ''">true</CheckCDefines>
Copy link

Choose a reason for hiding this comment

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

It seems like silently avoiding checks if python is not installed is incorrect. My opinion would be to allow it to fail, and we create a follow up future work item to convert the check to msbuild.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mmm. I don't need to make this change at all. Its really just a convenience as I prefer for it to be possible to compile major projects in the tree without specifying any special parameters to the msbuild command. I'll remove this adjustment.

tests/build.proj Show resolved Hide resolved
tests/src/dirs.proj Show resolved Hide resolved
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="src\dir.props" />
<Import Project="Directory.Build.props" />
Copy link

Choose a reason for hiding this comment

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

This also should probably be an sdk style project.

Copy link
Member Author

Choose a reason for hiding this comment

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

Converting .proj files into sdk style projects does odd things. If we need to do that, it should be a separate change.

dir.common.props Outdated Show resolved Hide resolved
dir.common.props Show resolved Hide resolved
<!-- Add test-specific package restore sources. -->
<PropertyGroup>
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true'">
https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json;
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
Copy link
Member

Choose a reason for hiding this comment

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

Why were these added, and would it be possible to put them in NuGet.Config instead? Arcade is recommending to move away from RestoreSources: https://github.com/dotnet/arcade/blob/f8fc65bce78b79d00c66cb22ff658fb3a3e46dfb/Documentation/RestoreSourcesUpdateStatus.md.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, we weren't using nuget.config in our test builds at all. But the move to unify the properties resulted in an empty RestoreSources at this point in the build. This then added a single entry, and that wasn't sufficient for restore to work. I've moved the test build process to use nuget.config and that appears to work fine. Nice catch.

@@ -11,9 +11,6 @@
</RestoreSources>
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove RestoreSources now that everything is through Arcade? These should be set in the repo's nuget.config already.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes we can. See my response to @sbomer

@@ -11,9 +11,6 @@
</RestoreSources>
</PropertyGroup>

<!-- [ARCADE REMOVE] Versions.props is imported by Arcade SDK targets when building with Arcade -->
<Import Project="eng/Versions.props" Condition="'$(ArcadeBuild)' != 'true'" />

<!-- Source of truth for dependency tooling: the commit hash of the dotnet/versions master branch as of the last auto-upgrade. -->
Copy link
Member

Choose a reason for hiding this comment

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

How exactly do all these dependency tooling / auto-upgrade properties get used?

From the comments in this file (and only finding references to them in Microsoft.DotNet.VersionTools), I'd think we don't need or want them always chained in by the top-level Directory.Build.props?

Copy link
Member Author

Choose a reason for hiding this comment

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

To be honest, I have no idea what any of the dependency stuff does. I don't think these changes I've made don't actually add these to our build, they have always been there.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, just noticed that it is always being included now (by the top-level .props), which doesn't seem to hurt anything, but might be good to clean up. Maybe @sbomer knows from his work to consume Microsoft.DotNet.VersionTools for updating published versions?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not familiar with them either - they were used for buildtools dependency flow, and we can probably get rid of most of them now that we're on arcade. I'd need to go through them one-by-one to see which ones are still required for VersionTools.

dir.common.props Outdated
<!-- Default to portable build if not explicitly set -->
<PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>

<OverrideRestoreOutputPath>true</OverrideRestoreOutputPath>
Copy link
Member

Choose a reason for hiding this comment

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

I think this property was for BuildTools

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 dunno. There don't appear to be any uses of it. So I've removed it.

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

Everything in this file should only be needed for .pkgproj files. It seems unnatural to me that, with this rename, all the SDK-style projects (.builds) - which only need the Directory.Build.targets in the parent directory - will automatically chain this in, while the non-SDK-style projects (.pkgproj) - which actually need the settings directly in the file - still need to explicitly chain this 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.

Everything is now hierarchical. Yes, its not ideal to add pollution to the .builds files, but its consistent, and non-harmful.

Comment on lines +5 to 6
<Import Project="../Directory.Build.props" />
<Import Project="packaging.props" />
Copy link
Member

Choose a reason for hiding this comment

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

These two imports are the only things that packages.builds needs from this file. I guess it isn't actually breaking anything right now, but it seems like adding noise.

Copy link
Member Author

Choose a reason for hiding this comment

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

Everything is now hierarchical. Yes, its not ideal to add pollution to the .builds files, but its consistent, and non-harmful.

<!-- This file is intentionally empty. It is copied by build.cmd into the bin directory as both Directory.Build.props
and Directory.Build.targets to prevent CMake built projects from dependending on the Directory.Build infrastructure
in the root of the source tree. In particular this was necessary to compile DacTableGen, which is currently compiled
against the desktop framework.
Copy link
Member

Choose a reason for hiding this comment

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

Can we configure the generated projects in CMake such that they set ImportDirectoryBuildProps and ImportDirectoryBuildTargets to false?

Copy link
Member Author

Choose a reason for hiding this comment

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

No

<Import Project="packaging.props" />

<!-- Allow specialization of the packaging by creating a props file of the same name of the project immediately next to the project -->
<Import Condition="Exists('$(MSBuildProjectDirectory)/$(MSBuildProjectName).props')" Project="$(MSBuildProjectDirectory)/$(MSBuildProjectName).props"/>
Copy link
Member

Choose a reason for hiding this comment

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

Did you have a chance to try renaming the Microsoft.NETCore.Native.props instead? I think it should work and it would be more in line with msbuild's existing system for customization.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that looks to work.

@davidwrighton
Copy link
Member Author

/azp list

@azure-pipelines
Copy link

@davidwrighton
Copy link
Member Author

/azp run coreclr-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidwrighton
Copy link
Member Author

@elinor-fung could you take a look and confirm that your concerns have been addressed?

eng/run-test-job.yml Outdated Show resolved Hide resolved
sync.cmd Show resolved Hide resolved
tests/build.proj Outdated
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="dir.props" />
<Import Project="Directory.Build.props" />

<Import Project="$(ToolsDir)VersionTools.targets" Condition="Exists('$(ToolsDir)VersionTools.targets')" />
Copy link
Member

Choose a reason for hiding this comment

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

Remove? Pretty sure ToolsDir was for BuildTools

@@ -27,7 +27,6 @@
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
<IsTestProject>false</IsTestProject>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\src\dir.targets" />
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to explicitly pull in a Directory.Build.targets?

@elinor-fung
Copy link
Member

@davidwrighton yeah, I think I'm generally okay with the product - honestly, did not look hard at the tests...

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.

5 participants