提交 5211093c 编写于 作者: J Jared Parsons

Sync compiler and vs toolset files

This changes the file set used to build the VS toolset to match that of
the standard compiler toolset. Simply re-use the file list in the
compiler nuspec file here.

This actuall found a bug in our current implementation. We were not
copying the config file for csi.exe in the VS toolset.
上级 8eb4352a
...@@ -422,14 +422,7 @@ Public Class BuildDevDivInsertionFiles ...@@ -422,14 +422,7 @@ Public Class BuildDevDivInsertionFiles
End If End If
Next Next
' VS.Tools.Roslyn CoreXT package needs to contain all dependencies. GenerateVSToolsRoslynCoreXTNuspec()
Dim vsToolsetFiles = CompilerFiles.Concat({
"System.Collections.Immutable.dll",
"System.Reflection.Metadata.dll",
"Microsoft.DiaSymReader.Native.amd64.dll",
"Microsoft.DiaSymReader.Native.x86.dll"})
GenerateVSToolsRoslynCoreXTNuspec(vsToolsetFiles)
' Copy over the files in the NetFX20 subdirectory (identical, except for references and Authenticode signing). ' Copy over the files in the NetFX20 subdirectory (identical, except for references and Authenticode signing).
' These are for msvsmon, whose setup authoring is done by the debugger. ' These are for msvsmon, whose setup authoring is done by the debugger.
...@@ -1060,51 +1053,52 @@ Public Class BuildDevDivInsertionFiles ...@@ -1060,51 +1053,52 @@ Public Class BuildDevDivInsertionFiles
xml.Save(GetAbsolutePathInOutputDirectory(PackageName & ".nuspec"), SaveOptions.OmitDuplicateNamespaces) xml.Save(GetAbsolutePathInOutputDirectory(PackageName & ".nuspec"), SaveOptions.OmitDuplicateNamespaces)
End Sub End Sub
''' <summary>
Private Sub GenerateVSToolsRoslynCoreXTNuspec(filesToInsert As IEnumerable(Of String)) ''' Generates the nuspec + supporting file layout for the Roslyn toolset nupkg file. This is the toolset
Const PackageName As String = "VS.Tools.Roslyn" ''' which will be used during the VS build. This will exactly match the layout of the toolset used
''' by the Microsoft.Net.Compilers package + some devdiv environment files.
' No duplicates are allowed ''' </summary>
filesToInsert.GroupBy(Function(x) x).All(Function(g) g.Count() = 1) Private Sub GenerateVSToolsRoslynCoreXTNuspec()
Const packageName As String = "VS.Tools.Roslyn"
Dim outputFolder = GetAbsolutePathInOutputDirectory(PackageName) Dim outputDir = GetAbsolutePathInOutputDirectory(packageName)
Dim nuspecFiles As New List(Of String)
Directory.CreateDirectory(outputFolder) Directory.CreateDirectory(outputDir)
' First copy over all the files from the compilers toolset.
For Each fileRelativePath In GetCompilerToolsetNuspecFiles()
Dim filePath = Path.Combine(_binDirectory, fileRelativePath)
Dim fileName = Path.GetFileName(fileRelativePath)
Dim destFilepath = Path.Combine(_outputDirectory, fileName)
File.Copy(filePath, destFilepath)
nuspecFiles.Add(fileName)
' A bug in VS forces all of our exes to use the prefer 32 bit mode. Mark the copies added
' to this nuspec as such. They are isolated and hence allow our binaries shipped to customers
' to remain executable as 64 bit apps
' See https://github.com/dotnet/roslyn/issues/17864
If Path.GetExtension(fileName) = ".exe" Then
MarkFile32BitPref(destFilepath)
End If
Next
' Write an Init.cmd that sets DEVPATH to the toolset location. This overrides ' Write an Init.cmd that sets DEVPATH to the toolset location. This overrides
' assembly loading during the VS build to always look in the Roslyn toolset ' assembly loading during the VS build to always look in the Roslyn toolset
' first. This is necessary because there are various incompatible versions ' first. This is necessary because there are various incompatible versions
' of Roslyn littered throughout the DEVPATH already and this one should always ' of Roslyn littered throughout the DEVPATH already and this one should always
' take precedence. ' take precedence.
Dim initFileName = "Init.cmd"
Dim fileContents = "@echo off Dim fileContents = "@echo off
set RoslynToolsRoot=%~dp0 set RoslynToolsRoot=%~dp0
set DEVPATH=%RoslynToolsRoot%;%DEVPATH%" set DEVPATH=%RoslynToolsRoot%;%DEVPATH%"
File.WriteAllText( File.WriteAllText(Path.Combine(outputDir, initFileName), fileContents)
Path.Combine(outputFolder, "Init.cmd"), nuspecFiles.Add(initFileName)
fileContents)
' Copy all dependent compiler files to the output directory
' It is most important to have isolated copies of the compiler
' exes (csc, vbc, vbcscompiler) since we are going to mark them
' 32-bit only to work around problems with the VS build.
' These binaries should never ship anywhere other than the VS toolset
' See https://github.com/dotnet/roslyn/issues/17864
For Each fileName In filesToInsert
Dim srcPath = Path.Combine(_binDirectory, GetMappedPath(fileName))
Dim dstPath = Path.Combine(outputFolder, fileName)
File.Copy(srcPath, dstPath)
If Path.GetExtension(fileName) = ".exe" Then
MarkFile32BitPref(dstPath)
End If
Next
Dim xml = <?xml version="1.0" encoding="utf-8"?> Dim xml = <?xml version="1.0" encoding="utf-8"?>
<package> <package>
<metadata> <metadata>
<id><%= PackageName %></id> <id><%= packageName %></id>
<summary>Roslyn compiler binaries used to build VS</summary> <summary>Roslyn compiler binaries used to build VS</summary>
<description>CoreXT package for Roslyn compiler toolset.</description> <description>CoreXT package for Roslyn compiler toolset.</description>
<authors>Managed Language Compilers</authors> <authors>Managed Language Compilers</authors>
...@@ -1112,13 +1106,13 @@ set DEVPATH=%RoslynToolsRoot%;%DEVPATH%" ...@@ -1112,13 +1106,13 @@ set DEVPATH=%RoslynToolsRoot%;%DEVPATH%"
</metadata> </metadata>
<files> <files>
<file src="Init.cmd"/> <file src="Init.cmd"/>
<%= filesToInsert. <%= nuspecFiles.
OrderBy(Function(f) f). OrderBy(Function(f) f).
Select(Function(f) <file src=<%= f %>/>) %> Select(Function(f) <file src=<%= f %>/>) %>
</files> </files>
</package> </package>
xml.Save(Path.Combine(outputFolder, PackageName & ".nuspec"), SaveOptions.OmitDuplicateNamespaces) xml.Save(Path.Combine(outputDir, packageName & ".nuspec"), SaveOptions.OmitDuplicateNamespaces)
End Sub End Sub
Private Sub MarkFile32BitPref(filePath As String) Private Sub MarkFile32BitPref(filePath As String)
...@@ -1166,4 +1160,21 @@ set DEVPATH=%RoslynToolsRoot%;%DEVPATH%" ...@@ -1166,4 +1160,21 @@ set DEVPATH=%RoslynToolsRoot%;%DEVPATH%"
Return absolutePath Return absolutePath
End Function End Function
''' <summary>
''' Get the list of files that appear in the compiler toolset nuspec file. This is the authorative
''' list of files that make up the compiler toolset layout.
''' </summary>
Private Function GetCompilerToolsetNuspecFiles() As List(Of String)
Dim files As New List(Of String)
Dim nuspecFilePath = Path.Combine(_nuspecDirectory, "Microsoft.Net.Compilers.nuspec")
Dim document = XDocument.Parse(File.ReadAllText(nuspecFilePath))
For Each fileElement In document.<package>.<files>.<file>
If fileElement.Attribute("target").Value = "tools" Then
files.Add(fileElement.Attribute("src").Value)
End If
Next
Return files
End Function
End Class End Class
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册