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

Bootstrapper improvements. #1423

Merged
merged 9 commits into from
Dec 10, 2018
Merged

Bootstrapper improvements. #1423

merged 9 commits into from
Dec 10, 2018

Conversation

tmat
Copy link
Member

@tmat tmat commented Dec 1, 2018

Memoize results of Initialize* functions.
Move build customization hooks to build.ps1.
Make binary log off by default since it slows down build. It's on in CI build.
Fixes to quiet restore workaround.

Fixes #1251

@tmat tmat force-pushed the MiscImprovements branch 5 times, most recently from e860608 to fc9e917 Compare December 4, 2018 22:41
@tmat
Copy link
Member Author

tmat commented Dec 4, 2018

@chcosta PTAL

@@ -71,6 +71,11 @@ function InitializeDotNetCli([bool]$install) {
# Disable first run since we do not need all ASP.NET packages restored.
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

# Disable telemetry on CI.
if ($ci) {
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
Copy link
Member Author

Choose a reason for hiding this comment

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

@livarcocc Copied this from Roslyn. Does it make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

This means our own repos won't be sending telemetry to us. Is there a particular reason we would want to have this turned off?

I would prefer if we were setting the telemetry profile per repo so that we could still get telemetry but also identify the usage.

cc @KathleenDollard

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you want telemetry from CI builds? This only applies to CI.

if [[ $ci == true ]]; then
export DOTNET_CLI_TELEMETRY_OPTOUT=1
fi

# LTTNG is the logging infrastructure used by Core CLR. Need this variable set
# so it doesn't output warnings to the console.
export LTTNG_HOME="$HOME"
Copy link
Member Author

Choose a reason for hiding this comment

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

@livarcocc Copied this from Roslyn. Does it make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

See my comment above.

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'm not really sure, what this does. It was something that Roslyn has been doing.
@jaredpar @agocke

Copy link
Member

Choose a reason for hiding this comment

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

Sounds like one of you is talking about telemetry and the other is talking about LTTNG_HOME. As for telemetry I think we turned it off originally because it was causing issues (back in the pre-1.0 days so not relevant anymore) and didn't seem to make sense to get telemetry from CI. Have no objections to turning it back on.

Don't know about LTTNG_HOME.

Copy link
Member Author

Choose a reason for hiding this comment

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

@livarcocc Up to you. Feel free to send PR if you want telemetry from CI.

@@ -48,14 +48,8 @@
<MicrosoftDotNetBuildTasksFeedVersion>2.2.0-beta.18603.7</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetMaestroTasksVersion>1.0.0-beta.18603.7</MicrosoftDotNetMaestroTasksVersion>
<MicrosoftDotNetSignToolVersion>1.0.0-beta.18603.7</MicrosoftDotNetSignToolVersion>
<!-- 3rd Part Packages Public Keys -->
<DynamicProxyGenAsm2Key>0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7</DynamicProxyGenAsm2Key>
Copy link
Member Author

@tmat tmat Dec 4, 2018

Choose a reason for hiding this comment

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

This property isn't used

Copy link
Member

@chcosta chcosta left a comment

Choose a reason for hiding this comment

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

Couple of comments but overall looks good. Thanks for these improvements!

@@ -31,6 +32,7 @@ function Print-Usage() {
Write-Host "Common settings:"
Write-Host " -configuration <value> Build configuration Debug, Release"
Write-Host " -verbosity <value> Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])"
Write-Host " -binaryLog Output binary log"
Copy link
Member

Choose a reason for hiding this comment

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

Can this take an optional value so that you can create multiple binary logs? In particular, if someone decides (for whatever reason), to do a distinct build.cmd -binaryLog -restore followed by a build.cmd -binaryLog -build, then the binlogs would overwrite.

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 think that's fine. You get binlog for the latest build action. You can combine always actions build -restore -build -bl and get a log that covers both. I'd not complicate this until it will become an issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

You can also copy the binlog out before performing the next action.

@@ -64,17 +66,45 @@ if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $
exit 0
}

function ConfigureToolset {
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 often getting questions about how to do "b" instead of "a" or override some behavior, etc... It would be nice if this was either documented or self-documented in a way that was more discoverable. I suppose it's more for the power user than the standard Arcade SDK consumer, but I think it's interesting.

FYI @garath

Copy link
Member Author

Choose a reason for hiding this comment

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

return
}

$script = Join-Path $EngRoot "restore-toolset.ps1"
Copy link
Member

Choose a reason for hiding this comment

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

I know Corefx is using the "configure-toolset" hook, do you have an example of a repo using "restore-toolset"? I'd like to see an example to solidify the difference between these two functions w.r.t. intent.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's for restoring (installing) additional tools. E.g. https://github.com/dotnet/sdk/blob/master/eng/restore-toolset.ps1


$finished = $false
try {
while (-not $process.WaitForExit(100)) {
Copy link
Member

Choose a reason for hiding this comment

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

It might be nice to allow the wait time to be configured (either by command-line arg or env variable or other) for debugging purposes. I could imagine some repo doing some quirky stuff and then wanting to specify a longer wait time in configure-toolset.ps1 or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

Couldn't you just modify the script directly if you're debugging some issue?
I'd rather not add switch that will be used once in our lifetime, if at all.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I had that thought as well. I think we want to discourage this practice as much as possible though because there's already grumbling about the confusion w.r.t. eng/common for people outside of the core Arcade working group and the fact that their "fixes" disappear. I was hoping to get ahead of that.

Copy link
Member Author

Choose a reason for hiding this comment

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

If it's only for debugging then it's good that the fixes disappear :)

In any case, let's wait until someone actually runs into this. We can always add more switches. It's harder to remove them.

}
}

function GetMSBuildBinaryLogCommandLineArgument($arguments) {
Copy link
Member

Choose a reason for hiding this comment

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

Oh, neat, I'm interpreting that this lets me do the thing I mentioned above (change binlog name), but in a slicker way? ie, you could do this...

build.cmd -binaryLog -restore /bl:restore.binlog
build.cmd -binaryLog -build  /bl:build.binlog

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, it just extracts the name of the log form the command line arguments (finds the /bl command line arg), so that it can be printed out when the build fails. Useful when msbuild spews a lot of output and you don't want to scroll all the way back and fish for the path to the log.

Copy link
Member

Choose a reason for hiding this comment

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

less neat :P

@tmat
Copy link
Member Author

tmat commented Dec 5, 2018

@chcosta BTW, the changes might need an update in CoreFX repo (and maybe other repos).

How should we deal with that? Should I merge this and wait for darc to automatically propagate the change and send auto-merging PRs? Then update CoreFX if needed?

@chcosta
Copy link
Member

chcosta commented Dec 5, 2018

@chcosta BTW, the changes might need an update in CoreFX repo (and maybe other repos).
How should we deal with that? Should I merge this and wait for darc to automatically propagate the change and send auto-merging PRs? Then update CoreFX if needed?

@tmat, can you clarify exactly how this would surface in CoreFx (and other repos)?

@markwilkie thoughts? Sounds like this is potentially a slightly breaking change.

@tmat
Copy link
Member Author

tmat commented Dec 5, 2018

Actually, now I'm looking at CoreFX there should be no follow up needed. I thought it's using the MSBuild function directly but it is not.

@tmat
Copy link
Member Author

tmat commented Dec 5, 2018

BTW, almost any change in Arcade build scripts or targets files is potentially breaking due to the nature of powershell, bash and msbuild (lack of "internal" vs "public" accessibility modifiers). Some are just more likely to break something than others.

@tmat tmat force-pushed the MiscImprovements branch from b9dc76f to f47833a Compare December 5, 2018 18:02
@chcosta
Copy link
Member

chcosta commented Dec 5, 2018

Ack, it wasn't clear how this would break them. Thanks for checking on that. Agreed about the potentially breaking nature of these changes. Additionally, I want to be intentional if we know specifically that we are going to break someone about how we go about that.

@tmat
Copy link
Member Author

tmat commented Dec 5, 2018

@chcosta Agreed. If it's breaking API surface change then it should be caught by the CI build of the target repo. So I assume that the PR that darc sends would fail and need the fixes to be applied.

The problem is when a change is breaking in more subtle way - that is the CI passes, but the behavior changes and is not intended. Not sure we can do anything about that. Ultimately if CI passes and no one notices then arguable it does not matter or we have a test hole.

@tmat tmat force-pushed the MiscImprovements branch 2 times, most recently from 098cffe to 51c03ea Compare December 6, 2018 01:01
@tmat
Copy link
Member Author

tmat commented Dec 6, 2018

@chcosta I have added one more commit. Could you take a look?

@tmat tmat force-pushed the MiscImprovements branch from 51c03ea to 2565ef5 Compare December 6, 2018 02:00
@tmat tmat force-pushed the MiscImprovements branch from 2565ef5 to 94baa84 Compare December 6, 2018 21:09
@tmat tmat closed this Dec 7, 2018
@tmat tmat reopened this Dec 7, 2018
tmat added 5 commits December 9, 2018 18:31
    Replace & PS operator with custom process launcher. The & operator does not allow to send colorized output to the host without polluting function return value.
    Automatically terminate script when MSBuild fails.
    Memoize results of Initialize* functions.
    Move build customization hooks to build.ps1.
    Make binary log off by default since it slows down build. It's on in CI build.
    Fixes to quiet restore workaround.
    Add set -u to bash script.
@tmat tmat merged commit ca315f2 into dotnet:master Dec 10, 2018
@tmat tmat deleted the MiscImprovements branch December 10, 2018 03:11
@agocke agocke assigned agocke and unassigned agocke Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants