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

Consume Roslyn Compiler 2.0.0-beta3 #10928

Merged
merged 10 commits into from
Aug 19, 2016
Merged

Consume Roslyn Compiler 2.0.0-beta3 #10928

merged 10 commits into from
Aug 19, 2016

Conversation

chcosta
Copy link
Member

@chcosta chcosta commented Aug 17, 2016

Windows
BuildTools defines what version of the Roslyn compiler it restores (to tools\Microsoft.NETCore.Compilers) via buildtools:src/Microsoft.DotNet.Build.Tasks/PackageFiles/init-tools.cmd. BuildTools then copies Microsoft.NETCore.Compilers to tools\net45\roslyn for use. CoreFx imports Microsoft.NETCore.Compilers.props from buildtools using the RoslynVersion / RoslynPackageName properties defined in corefx:dir.props, and Microsoft.NETCore.Compilers.props tell msbuild where to get run csc.exe from.

With SharedCompilation enabled, VBCSCompiler is run from tools\net45\Roslyn, otherwise csc.exe is used.

Linux
Version of Roslyn used is determined by the BuildTools:src\Microsoft.DotNet.Build.Tasks\PackageFiles\tools-runtime\project.json file which gets restored on the host OS to the Tools directory (tools\csc.exe). Linux uses the Microsoft.Net.Compilers.netcore package (vs Microsoft.Net.Compilers on Windows).

  • The Microsoft.Net.ToolSetCompilers package has been replaced with the Microsoft.Net.Compilers package.
  • The “UseSharedCompilation” property which toggles some of this functionality, was broken due to a change in the default behavior defined in Microsoft.NetCore.props.

/cc @weshaggard @joperezr

@@ -63,6 +63,7 @@
<BuildToolsTaskDir Condition="'$(BuildToolsTargets45)' == 'true'">$(ToolsDir)net45/</BuildToolsTaskDir>
<BuildToolsTaskDir Condition="'$(BuildToolsTaskDir)'==''">$(ToolsDir)</BuildToolsTaskDir>
<UseRoslynCompilers Condition="'$(UseRoslynCompilers)'=='' and '$(OSEnvironment)'!='Windows_NT'">false</UseRoslynCompilers>
<UseSharedCompilation Condition="'$(UseSharedCompilation)' == '' and '$(OSEnvironment)' == 'Windows_NT' and '$(UseRoslynCompilers)' != 'true'">true</UseSharedCompilation>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the part of '$(UseRoslynCompilers)'!='true' is right. I believe you actually want the opposite and have it to be != 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.

Had an offline discussion with Joe, and I misunderstood the intent of the "UseRoslynCompilers" property, I'll make the suggested change.

@@ -579,5 +579,6 @@
</PropertyGroup>

<!-- Use Roslyn Compilers to build -->
<Import Project="$(RoslynPropsFile)" Condition="Exists('$(RoslynPropsFile)') and '$(UseRoslynCompilers)'!='false'" />
<Import Project="$(RoslynPropsFile)" Condition="'$(OSEnvironment)'!='Unix' and Exists('$(RoslynPropsFile)') and '$(UseRoslynCompilers)'!='false'" />
Copy link
Member

Choose a reason for hiding this comment

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

Why did you have to split this by OS?

<Import Project="$(RoslynPropsFile)" Condition="'$(OsEnvironment)'=='Unix' and Exists('$(RoslynPropsFile)')" />

<!-- Use Roslyn Compilers to build -->
<Import Project="$(RoslynPropsFile)" Condition="'$(OSEnvironment)'!='Unix' and Exists('$(RoslynPropsFile)') and '$(UseRoslynCompilers)'!='false'" />
Copy link
Member

Choose a reason for hiding this comment

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

Can you help me understand why this import needs to be split like this? Also wouldn't it make since to include this import on the build tools side as well?

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 wanted to combine these because I wanted to align these on Windows / Unix (in fact I did with a previous commit). I then backtracked a bit because I didn't feel I had clear context on the reason this was split in the first place, so I reverted that change to this.

I also considered moving this to buildtools, but I didn't want to force other repo's that upgrade to this version of buildtools to consume the Roslyn compiler toolset update to deal with duplicate imports, especially because it's not clear to me if other repo's are following the same pattern here or doing something different.

To both of your points, I agree that it would be cleaner. I'm ok with un-splitting the imports with this change, but i'll need to file an issue to move the imports to buildtools as a separate task.

Copy link
Member Author

Choose a reason for hiding this comment

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

@joperezr , do you know why the "UseRoslynCompilers" property is only applicable to Windows_NT?

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 good not blocking this PR but we should try and clean this up some more.

As for other repo's using BuildTools right now it is a little too difficult for them to start using BuildTools successfully because of all the hidden properties and imports like these that they don't know they need. Part of the work that @markwilkie is having @crummel looking is to remove as much of the boilerplate as possible to allow repo's to consume BuildTools much easier. So this request is more along those lines.

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 CentOS failure I was investigating, below, seems to have "disappeared". I'm still attempting to get a repro though in case it's an intermittent failure I'm introducing. Unless someone says that's a known issue, I plan to spend at least another day trying to get a repro before checking 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'm unable to repro the Jenkins failure on a CentOs VM in about 20 attempts. I plan to commit this PR as soon as I get an LGTM.

@chcosta chcosta changed the title Compiler Consume Roslyn Compiler 2.0.0-beta3 Aug 18, 2016
@chcosta
Copy link
Member Author

chcosta commented Aug 18, 2016

The Windows_NT failure looks like test / network flakiness to me.

I'm trying to get a repro of the CentOS failure setup so that I can understand that failure and if it's related.
Stacktrace
MESSAGE:
Assert.Equal() Failure\nExpected: Changed\nActual: 0
+++++++++++++++++++
STACK TRACE:
at System.IO.Tests.WaitForChangedTests.Changed_Success()

@chcosta chcosta self-assigned this Aug 18, 2016
@MattGal
Copy link
Member

MattGal commented Aug 19, 2016

LGTM, merging.

@MattGal MattGal merged commit 8512621 into dotnet:master Aug 19, 2016
<ToolsDir Condition="'$(UseToolRuntimeForToolsDir)'=='true'">$(ToolRuntimePath)</ToolsDir>
<ToolsDir Condition="'$(ToolsDir)'==''">$(ProjectDir)Tools/</ToolsDir>
<DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ToolRuntimePath)dotnetcli/</DotnetCliPath>
<OverrideToolHost>$(DotnetCliPath)dotnet</OverrideToolHost>
<BuildToolsTaskDir Condition="'$(BuildToolsTargets45)' == 'true'">$(ToolsDir)net45/</BuildToolsTaskDir>
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 remove all the places in BuildTools that we consume this?

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, I see you moved this into buildtools.

@ericstj
Copy link
Member

ericstj commented Aug 19, 2016

LGTM

@chcosta chcosta deleted the compiler branch August 19, 2016 16:24
dagood pushed a commit to dagood/corefx that referenced this pull request Aug 24, 2016
Consume Roslyn Compiler 2.0.0-beta3
(cherry picked from commit 8512621)
@karelz karelz modified the milestone: 1.1.0 Dec 3, 2016
macrogreg pushed a commit to open-telemetry/opentelemetry-dotnet-instrumentation that referenced this pull request Sep 24, 2020
Consume Roslyn Compiler 2.0.0-beta3

Commit migrated from dotnet/corefx@8512621
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Consume Roslyn Compiler 2.0.0-beta3
(cherry picked from commit dotnet/corefx@8512621)


Commit migrated from dotnet/corefx@541d7ed
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.

8 participants