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

Use refasm-only items for compilation #19146

Merged

Conversation

rainersigwald
Copy link
Member

Use the new item provided by common targets to avoid recompiling a
project when a reference has changed only in implementation, not
interface.

Include a shim so that these targets can continue to work on older
MSBuild distributions. That keeps the NuGet-package-for-downlevel
scenario working, as well as making an easy transition period to the new
logic.

Requires dotnet/msbuild#2039.

@rainersigwald
Copy link
Member Author

@jcouv: implemented as discussed in dotnet/msbuild#1986 (comment).

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

Done with review pass. Thanks!

<Target Name="CoreCompile"
Inputs="$(MSBuildAllProjects);
@(Compile);
@(_CoreCompileResourceInputs);
$(ApplicationIcon);
$(AssemblyOriginatorKeyFile);
@(ReferencePath);
@(ReferencePathWithInterfaceOnlyAssemblies);
Copy link
Member

Choose a reason for hiding this comment

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

Consider "ReferencePathWithRefAssemblies".

Copy link
Member

Choose a reason for hiding this comment

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

Also, can you clarify the benefit of introducing a new name (why not keep "ReferencePath", but feed annotated content into it)?

Copy link
Member

Choose a reason for hiding this comment

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

Also, can you clarify the benefit of introducing a new name (why not keep "ReferencePath", but feed annotated content into it)?

Never mind, I see you already explained the options in dotnet/msbuild#1986 (comment) Thanks!

<Target Name="ShimReferencePathsWhenCommonTargetsDoesNotUnderstandReferenceAssemblies"
BeforeTargets="CoreCompile"
Condition="'@(ReferencePathWithInterfaceOnlyAssemblies)' == ''">
<!-- Common targets should populate this item from 15.3, but this file
Copy link
Member

Choose a reason for hiding this comment

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

Nit: "dev15.3"

@jcouv
Copy link
Member

jcouv commented May 1, 2017

@jaredpar @agocke @jasonmalinowski for review.

@jcouv jcouv added this to the 15.3 milestone May 1, 2017
@jasonmalinowski
Copy link
Member

I wasn't involved in the conversations of the ultimate decision to move to a new item type. @rainersigwald are the motivations there documented and written up somewhere? The MSBuild item I see has some discussions but didn't quite give the backstory. I am very worried about project system and extensibility impact, and I want to make sure those were thought about.

@jcouv
Copy link
Member

jcouv commented May 1, 2017

@jasonmalinowski I think dotnet/msbuild#1986 (comment) will answer your questions.

@rainersigwald
Copy link
Member Author

That was my reasoning. It's entirely possible I've missed something important, though! What project-system/extensibility impact are you worried about?

@jasonmalinowski
Copy link
Member

There are two impacts I'm concerned about:

  1. Other targets that might exist in the world that might be generating ReferencePath items that are listed as "run before CoreCompile" -- the PR here has no protection against that. The 'shim' target might run before such another target, and then those are broken. I'm not aware of stuff in the wild that does it, but I just wanted to raise it.
  2. What places exist that consume ReferencePath? I know there's this in Roslyn and I see six references in the legacy project system. I don't know what exists in the new project system. Do we know if those need to be updated as well?

To be clear: I don't think this is the wrong approach...I just don't (personally) know if it's the right approach either. 😄

@@ -25,7 +25,7 @@ function Print-Usage() {
}

function Run-Build() {
$buildArgs = "/v:m /m"
Copy link
Member

Choose a reason for hiding this comment

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

Is this intended?

@@ -64,3 +64,5 @@ public override SourceText GetText(CancellationToken cancellationToken = default
internal IList<DiagnosticInfo> Diagnostics => _diagnostics;
}
}

Copy link
Member

Choose a reason for hiding this comment

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

Please revert this file and the one below (empty changes). Thanks

@jcouv
Copy link
Member

jcouv commented May 2, 2017

@dotnet/roslyn-compiler for review. I will try to produce a new signed build with this for end-to-end testing in VS tomorrow.

@jasonmalinowski Is there anyone else that we should pull in to review integration with project system?

@@ -25,7 +25,7 @@ function Print-Usage() {
}

function Run-Build() {
$buildArgs = "/v:m /m"
$buildArgs = "/v:m /m /flp:v=diag"
Copy link
Member

Choose a reason for hiding this comment

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

This slows down our build considerably. Why do we need to make this a part of the dev workflow?

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 don't, local testing change escaped when I git commit -am-ed. Will revert.

@agocke
Copy link
Member

agocke commented May 2, 2017

I'm concerned about lack of tests here. How are we supposed to verify this change?

@rainersigwald rainersigwald force-pushed the refout-msbuild-infrastructure branch from ed0945c to ae43f4d Compare May 2, 2017 22:46
@jasonmalinowski
Copy link
Member

@dotnet/project-system can help review the project system impacts, as well as @dotnet/roslyn-ide who might have some knowledge of the legacy project system impacts.

@jcouv
Copy link
Member

jcouv commented May 3, 2017

@agocke Yes, I ran into this problem in my own recent change for targets file :-( I did local verification then.
Maybe @rainersigwald would have some suggestions on validation strategy for targets files, since that seems a common msbuild problem.

That said, we're planning to produce a VS build with refout bits from msbuild and Roslyn, this week, so that we can do end-to-end validation. That will help cover.

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM

may be used (via NuGet package) on earlier MSBuilds. If the
adjusted-for-reference-assemblies item is not populated, just use
the older item's contents. -->
<ItemGroup>
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're using a newer MSBuild is there any legitimate reason that ReferencePathWithRefAssemblies would be empty? If so are we breaking anything by forcing a value?

Copy link
Member Author

Choose a reason for hiding this comment

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

The new common targets from dotnet/msbuild#2039 unconditionally populate @(ReferencePathWithRefAssemblies) here, so no--it shouldn't be empty unless @(ReferencePath) was too, in which case this should be harmless.

@rainersigwald
Copy link
Member Author

@agocke Unfortunately, testing this kind of change in isolation is very difficult. MSBuild still runs a fairly large suite of (internal) tests that run builds of projects end-to-end and test for certain behaviors, and we should augment that test suite with some specific tests for ref-asm behavior. Does Roslyn have a similar suite, or are y'all dependent on others to catch build flow regressions? RPS scenarios also cover many build end-to-end configurations.

One major problem with the existing tests is that they work in VS-land, which requires having insertions of outside-the-VS-repo code. In order to run those tests, this change needs to be available in a Roslyn VSIX, so that it can be combined with an MSBuild VSIX built from the feature branch on our side and tested end-to-end. In MSBuild, we don't have a strict review policy on creating such a feature branch, getting a build from it, and testing it in VS--anyone on the core team can do that at their discretion. I don't know what the policies are in this repo.

This PR is what I'd like to see tested in that way--I would not be surprised if that testing revealed problems which will require followup, either here or in MSBuild. But I think the best way to gain confidence in this approach is to test it in VS.

@jcouv
Copy link
Member

jcouv commented May 3, 2017

Reviewers, any other feedback/questions/blockers?

@jasonmalinowski
Copy link
Member

@jcouv Do we have the test plan written up somewhere?

@jcouv
Copy link
Member

jcouv commented May 3, 2017

@jasonmalinowski Short answer is no, but I can work on that.
We have a placeholder test plan for compiler changes (#18612). Feel free to list suggestions there.
I have not thought systematically about end-to-end validation. We were just going to dogfood VS on Roslyn and MSBuild and also self-host (update our toolset).

Is there anything specific you'd like to see?

@jasonmalinowski
Copy link
Member

@jcouv I'll add comments over there.

@agocke
Copy link
Member

agocke commented May 3, 2017

@rainersigwald @jcouv Is there any way we could get this into our bootstrap build before merging? Say, if we produced the MSBuild bits first and then updated Roslyn to consume them, then verified in the bootstrap build that we saw the expected behavior?

@agocke
Copy link
Member

agocke commented May 3, 2017

@jaredpar IIRC you added some validation to our bootstrap build to a build task before. Is that a viable option now?

Use the new item provided by common targets to avoid recompiling a
project when a reference has changed only in implementation, not
interface.

Include a shim so that these targets can continue to work on older
MSBuild distributions. That keeps the NuGet-package-for-downlevel
scenario working, as well as making an easy transition period to the new
logic.

Requires dotnet/msbuild#2039 to enable end-to-end use of reference
assemblies, but is compatible with earlier MSBuilds (without using
reference assemblies).
The Microsoft.Net.Compilers package delivers UsingTasks to override the
"standard" ones provided by MSBuild's Microsoft.Common.tasks. That
should include the new CopyRefAssembly.
@rainersigwald rainersigwald force-pushed the refout-msbuild-infrastructure branch from ae43f4d to ae50fe8 Compare May 3, 2017 20:24
Copy link
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

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

Talked with @jcouv. I'm convinced there's nothing we can do right now to improve validation within Roslyn. Once more bits are merged into master we can re-evaluate

@jcouv jcouv merged commit a255d49 into dotnet:features/refout May 3, 2017
@jcouv
Copy link
Member

jcouv commented May 4, 2017

Relates to #18612

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants