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

Move to GitLink 3.0 #17736

Merged
merged 1 commit into from
Mar 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/Targets/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Generated file, do not directly edit. Run "RepoUtil change" to regenerate-->
<PropertyGroup>
<GitLinkVersion>2.3.0</GitLinkVersion>
<GitLinkVersion>3.0.0-unstable0085</GitLinkVersion>
<ManagedEsentVersion>1.9.4</ManagedEsentVersion>
<MicroBuildCoreVersion>0.2.0</MicroBuildCoreVersion>
<MicroBuildCoreSentinelVersion>1.0.0</MicroBuildCoreSentinelVersion>
Expand Down
2 changes: 1 addition & 1 deletion build/ToolsetPackages/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"RoslynTools.Microsoft.LocateVS": "0.2.4-beta",
"RoslynTools.Microsoft.SignTool": "0.3.0-beta",
"RoslynTools.Microsoft.VSIXExpInstaller": "0.2.4-beta",
"GitLink": "2.3.0"
"GitLink": "3.0.0-unstable0085"
},
"frameworks": {
"net461": {}
Expand Down
1 change: 0 additions & 1 deletion build/config/SignToolData.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"Exes\\vbccore\\vbc.exe",
"Exes\\vbi\\vbi.exe",
"Exes\\vbicore\\vbi.exe",
"Exes\\Pdb2Xml\\Microsoft.DiaSymReader.PortablePdb.dll",
"Exes\\Pdb2Xml\\Pdb2Xml.exe",
"Vsix\\CompilerExtension\\Roslyn.Compilers.Extension.dll",
"Vsix\\Templates\\Roslyn.Templates.dll",
Expand Down
41 changes: 41 additions & 0 deletions build/scripts/build-utils.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Collection of powershell build utility functions that we use across our scripts.

Set-StrictMode -version 2.0
$ErrorActionPreference="Stop"

# Declare a number of useful variables for other scripts to use
[string]$repoDir = Resolve-Path (Join-Path $PSScriptRoot "..\..")
[string]$binariesDir = Join-Path $repoDir "Binaries"
[string]$scriptDir = $PSScriptRoot

function Create-Directory([string]$dir) {
New-Item $dir -ItemType Directory -ErrorAction SilentlyContinue | out-null
Copy link
Member

Choose a reason for hiding this comment

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

What happens if it legitimately fails to create the directory?

Copy link
Member Author

Choose a reason for hiding this comment

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

Then presumably the next command which uses the directory will fail 😄

I don't meant to be trolly there but there isn't a good answer to this question. Asking if the directory actually failed to create or already exists is just a variation of the File.Exists problem. I could test for existence of the directory after the call but it's a racy check.

}

# Return the version of the NuGet package as used in this repo
function Get-PackageVersion([string]$name) {
$deps = Join-Path $repoDir "build\Targets\Dependencies.props"
$nodeName = "$($name)Version"
$x = [xml](Get-Content -raw $deps)
$node = $x.Project.PropertyGroup[$nodeName]
if ($node -eq $null) {
throw "Cannot find package $name in Dependencies.props"
}

return $node.InnerText
}

# Locate the directory where our NuGet packages will be deployed. Needs to be kept in sync
# with the logic in Version.props
function Get-PackagesDir {
$d = $null
if ($env:NUGET_PACKAGES -ne $null) {
$d = $env:NUGET_PACKAGES
}
else {
$d = Join-Path $env:UserProfile ".nuget\packages\"
}

Create-Directory $d
return $d
}
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ Public Class BuildDevDivInsertionFiles
add("Exes\VBCSCompiler\VBCSCompiler.exe.config")
add("Exes\InteractiveHost\InteractiveHost.exe.config")
add("Exes\csi\csi.rsp")
add("Exes\Pdb2Xml\Microsoft.DiaSymReader.PortablePdb.dll")
add("Vsix\Roslyn.Deployment.Full.Next\remoteSymbolSearchUpdateEngine.servicehub.service.json")
add("Vsix\Roslyn.Deployment.Full.Next\snapshotService.servicehub.service.json")
add("Vsix\VisualStudioInteractiveComponents\CSharpInteractive.rsp")
Expand Down
4 changes: 2 additions & 2 deletions src/Tools/MicroBuild/Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

<MSBuild Projects="$(RepoRoot)Roslyn.sln" BuildInParallel="true" Properties="DeployExtension=false" />

<Exec Command="$(NuGetPackageRoot)\GitLink\$(GitLinkVersion)\lib\net45\GitLink.exe $(RepoRoot) -u https://github.com/dotnet/roslyn -f Roslyn.sln -c $(Configuration)" />

<Exec Command="powershell -noprofile -executionPolicy ByPass -file $(MSBuildThisFileDirectory)..\..\..\build\scripts\create-perftests.ps1 &quot;$(BinariesPath)&quot;" />

<MSBuild Projects="$(RepoRoot)src\Setup\SetupStep1.proj" Properties="DeployExtension=false" />

<Exec Command="powershell -noprofile -executionPolicy ByPass -file $(MSBuildThisFileDirectory)run-gitlink.ps1 &quot;$(Configuration)&quot;" />
<Exec Command="$(NuGetPackageRoot)\RoslynTools.Microsoft.SignTool\$(RoslynToolsMicrosoftSignToolVersion)\tools\SignTool.exe $(SignRoslynArgs) &quot;$(BinariesPath)&quot;" WorkingDirectory="$(RepoRoot)" />

<MSBuild Projects="$(RepoRoot)src\NuGet\NuGet.proj" />
Expand All @@ -52,4 +52,4 @@
<Exec Command="powershell -noprofile -executionPolicy ByPass -file $(MSBuildThisFileDirectory)copy-insertion-items.ps1 -binariesPath &quot;$(BinariesPath)&quot; $(CopyInsertionFileArgs)" />
</Target>

</Project>
</Project>
41 changes: 41 additions & 0 deletions src/Tools/MicroBuild/run-gitlink.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Run GitLink on the binaries that we are producing.
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 include a comment as to why the old mechanism wasn't sufficient?

Copy link
Member

Choose a reason for hiding this comment

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

(if the answer was "it's no longer supported", then that should have been written in the commit message)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I should have added more detail to this commit about that. I had put a write up of the problem in our previous convo and didn't think to add it here.

The PR has a discussion of why this approach was taken now.


param([string]$config = "Release")
Set-StrictMode -version 2.0
$ErrorActionPreference="Stop"

try {
. (Join-Path $PSScriptRoot "..\..\..\build\scripts\build-utils.ps1")

$configDir = Join-Path $binariesDir $config
$gitlinkVersion = Get-PackageVersion "GitLink"
$gitlink = Join-Path (Get-PackagesDir) "GitLink\$gitlinkVersion\build\GitLink.exe"

Write-Host "Running GitLink"

$config = Join-Path $repoDir "build\config\SignToolData.json"
$j = ConvertFrom-Json (Get-Content -raw $config)
foreach ($entry in $j.sign) {
foreach ($v in $entry.values) {
$ext = [IO.Path]::GetExtension($v)
if (($ext -eq ".dll") -or ($ext -eq ".exe")) {
$name = [IO.Path]::ChangeExtension($v, ".pdb")
$pdbPath = Join-Path $configDir $name
Write-Host "`t$pdbPath"

$output = & $gitlink -u "https://github.com/dotnet/roslyn" $pdbPath
if (-not $?) {
Write-Host "Error!!!"
Write-Host $output
exit 1
}
}
}
}

exit 0
}
catch [exception] {
write-host $_.Exception
exit 1
}