Skip to content

Incrementality for CoreGenerateAssemblyInfo - #276

Merged
nguerrera merged 2 commits into
dotnet:masterfrom
rainersigwald:incremental-CoreGenerateAssemblyInfo
Oct 13, 2016
Merged

nguerrera merged 2 commits into
dotnet:masterfrom
rainersigwald:incremental-CoreGenerateAssemblyInfo

Conversation

@rainersigwald

Copy link
Copy Markdown
Member

Fixes (the first part of) #275.

The CoreGenerateAssemblyInfo target was always executing and always
writing code to the assemblyinfo source file, causing unnecessary
rebuilds.

Since this solution adopts the standard "all relevant imported projects"
approach to did-a-property-change, I also made sure the
GenerateAssemblyInfo.targets file used that pattern--but I did not check
for that pattern elsewhere.

Fixes (the first part of) #275.

The CoreGenerateAssemblyInfo target was always executing and always
writing code to the assemblyinfo source file, causing unnecessary
rebuilds.

Since this solution adopts the standard "all relevant imported projects"
approach to did-a-property-change, I also made sure the
GenerateAssemblyInfo.targets file used that pattern--but I did not check
for that pattern elsewhere.
<Target Name="CoreGenerateAssemblyInfo"
Condition="'$(Language)'=='VB' or '$(Language)'=='C#'">
Condition="'$(Language)'=='VB' or '$(Language)'=='C#'"
Inputs="$(MSBuildAllProjects)"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the Inputs/Outputs get removed from GenerateAssemblyInfo?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

They are indeed irrelevant there since it doesn't do anything.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another silly question - since this is the target that depends on PrepareForBuild;GetAssemblyVersion, shouldn't the dependencies go here? And then if you do that, should the whole GenerateAssemblyInfo and CoreGenerateAssemblyInfo be collapsed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or is this how you get GetAssemblyVersion to run all the time, even if it isn't needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@nguerrera do you remember why it's structured this way? it does force GetAssemblyVersion to run which is probably desirable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIRC, I structured it this way so a new language, say F# could override only CoreGenerate. I misunderstood how inputs/outputs work with respect to DependsOnTargets. I wanted it to take care of as much as I could in non-core and let the overrides handle the rest. Maybe that's not worth it now that it doesn't work as I thought it did. (I thought if inputs and outputs were up to date, it wouldn't run its dependencies.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I thought if inputs and outputs were up to date, it wouldn't run its dependencies.

Me too! learn something new everyday

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it is desirable for GetAssemblyVersion to run always though that wasn't actually my primary objective, I was trying to make it so overrides don't have to repeat what happens before/after core. This is still the case so I think we should keep the split.

@eerhardt

Copy link
Copy Markdown
Member

:shipit: when @nguerrera replies to the question.

This shaves off almost a second on my machine!

@nguerrera

Copy link
Copy Markdown
Contributor

What's the second part of #275

@rainersigwald

Copy link
Copy Markdown
Member Author

No specific second part @nguerrera, I'm just leery of saying an incrementality problem is fixed: it's almost always an onion-peeling exercise.

@eerhardt

Copy link
Copy Markdown
Member

On my machine (with @rainersigwald fix), incremental builds are down to half a second:

>dotnet build3
Microsoft (R) Build Engine version 15.1.0.0
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 10/13/2016 4:51:43 PM.
Project "F:\DotNetTest\new3test\new3test.csproj" on node 1 (Build target(s)).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreGenerateAssemblyInfo:
Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
  new3test -> F:\DotNetTest\new3test\bin\Debug\new3test.exe
Done Building Project "F:\DotNetTest\new3test\new3test.csproj" (Build target(s)).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.54

@nguerrera
nguerrera merged commit e0414c5 into dotnet:master Oct 13, 2016
@nguerrera

Copy link
Copy Markdown
Contributor

Thanks, @rainersigwald for the quick diagnosis and contributing the fix!

@rainersigwald
rainersigwald deleted the incremental-CoreGenerateAssemblyInfo branch October 13, 2016 22:08
sbomer pushed a commit to sbomer/sdk that referenced this pull request Sep 19, 2017
Add SHA*CryptoServiceProvider APIs to .NET Standard
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.

3 participants