Skip to content

Commit

Permalink
nbgv still pulled from nuget.org (#2025)
Browse files Browse the repository at this point in the history
* Specify nuget.config for installing nbgv in docs pipeline

* Apply same changes to win32metdata for build as the wdkmetadata

* Apply build changes

* Wrong project
  • Loading branch information
philnach authored Nov 20, 2024
1 parent 97db7a1 commit 2e6b619
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 10 deletions.
2 changes: 1 addition & 1 deletion AzurePipelinesTemplates/win32docs-onebranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ stages:
inputs:
packageType: runtime
version: 2.1.x
- powershell: dotnet tool update --global nbgv
- powershell: dotnet tool update --global nbgv --configfile $(Build.SourcesDirectory)\${{parameters.RepoDirectory}}\nuget.config
displayName: ⚙ Install nbgv
- task: PowerShell@2
displayName: 🏭 dotnet build
Expand Down
13 changes: 10 additions & 3 deletions AzurePipelinesTemplates/win32metadata-onebranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ stages:
script: |
Write-Host "Saving Source Commit ID for github release pipeline"
"$(CommitId)" | Out-File $(Build.SourcesDirectory)\$(ob_outputDirectory)\SourceCommit.txt
# Copy build logs from GenerateMetadataSource to artifact location that will automatically get picked up
- task: CopyFiles@2
displayName: 📢 Copy build logs to pipeline artifact directory
inputs:
SourceFolder: '$(Build.SourcesDirectory)/${{parameters.RepoDirectory}}/bin/logs'
TargetFolder: '$(Build.SourcesDirectory)/$(ob_outputDirectory)/logs'

- stage: build_winmd
displayName: "Build WinMD"
Expand Down Expand Up @@ -242,12 +249,12 @@ stages:
files_to_sign: '**/*.nupkg'
search_root: $(OutputPackagesDir)

# Copy build logs to artifact staging directory
# Copy build logs from Build WinMD to artifact location that will automatically get picked up
- task: CopyFiles@2
displayName: 📢 Copy build logs to pipeline artifact staging directory
displayName: 📢 Copy build logs to pipeline artifact location
inputs:
SourceFolder: '$(Build.SourcesDirectory)/${{parameters.RepoDirectory}}/bin/logs'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
TargetFolder: '$(ob_outputDirectory)/logs'

# Copy nuget package to artifact staging directory
- task: CopyFiles@2
Expand Down
9 changes: 8 additions & 1 deletion scripts/BuildMetadataBin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,12 @@ else
$configuration = "Release"
}

dotnet build "$windowsWin32ProjectRoot" -c $configuration -t:EmitWinmd -p:WinmdVersion=$assemblyVersion -p:OutputWinmd=$outputWinmdFileName -p:SkipScraping=$skipScraping "-bl:$PSScriptRoot\..\bin\logs\BuildMetadataBin.binlog"
$rootDir = [System.IO.Path]::GetFullPath("$PSScriptRoot\..")

# Explicitly restore the Win32Metadata project to avoid issues restore happening during build
& dotnet restore "$windowsWin32ProjectRoot" --configfile "$rootDir\nuget.Config"

$timestamp = Get-Date -Format "yyyyMMddHHmmss"
$logFile = "$PSScriptRoot\..\bin\logs\BuildMetadataBin_$timestamp.binlog"
& dotnet build "$windowsWin32ProjectRoot" -c $configuration -t:EmitWinmd -p:WinmdVersion=$assemblyVersion -p:OutputWinmd=$outputWinmdFileName -p:SkipScraping=$skipScraping "-bl:$logFile" --no-restore
ThrowOnNativeProcessError
16 changes: 15 additions & 1 deletion scripts/CommonUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,19 @@ function Install-BuildTools
& dotnet clean "$rootDir\buildtools"
}

& dotnet build "$rootDir\buildtools" -c Release "-bl:$PSScriptRoot\..\bin\logs\buildtools.binlog"
Write-Output "Restoring buildtools project..."

# Explicitly restore the buildtools project using the nuget.config file
& dotnet restore "$rootDir\buildtools" --configfile "$rootDir\nuget.Config"

Write-Output "Building buildtools project..."

# Create a unique log file for the build
$timestamp = Get-Date -Format "yyyyMMddHHmmss"
$logFile = "$PSScriptRoot\..\bin\logs\buildtools_$timestamp.binlog"

# Build the buildtools project and skip restoring the dependencies
& dotnet build "$rootDir\buildtools" -c Release "-bl:$logFile" --no-restore
ThrowOnNativeProcessError

Install-VsDevShell
Expand Down Expand Up @@ -109,6 +121,8 @@ function Get-NugetPropsProperty
{
Param ([string] $name, [string]$projectName)

Write-Host "Getting NuGet Props for property $name from $projectName"

$projNameOnly = Split-Path -Path $projectName -LeafBase

$ns = @{xlmns = "http://schemas.microsoft.com/developer/msbuild/2003"}
Expand Down
14 changes: 12 additions & 2 deletions scripts/GenerateMetadataSource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,15 @@ else
$target = "ScrapeHeaders"
}

dotnet build "$windowsWin32ProjectRoot" -c Release -p:ScanArch=$arch -t:$target "-bl:$PSScriptRoot\..\bin\logs\GenerateMetadataSources.binlog"
ThrowOnNativeProcessError
$rootDir = [System.IO.Path]::GetFullPath("$PSScriptRoot\..")

# Explicitly restore the Win32Metadata project to avoid issues restore happening during build
& dotnet restore "$windowsWin32ProjectRoot" --configfile "$rootDir\nuget.Config"

# Create a unique log file for the build
$timestamp = Get-Date -Format "yyyyMMddHHmmss"
$logFile = "$PSScriptRoot\..\bin\logs\GenerateMetadataSources_$timestamp.binlog"

# Build the Win32Metadata Project
& dotnet build "$windowsWin32ProjectRoot" -c Release -p:ScanArch=$arch -t:$target --no-restore "-bl:$logFile"
ThrowOnNativeProcessError
4 changes: 2 additions & 2 deletions scripts/Install-DotNetTool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ if (-not (Test-Path -Path $NuGetConfigFile -PathType Leaf)) {
if ($Version -ne '')
{
$installed = & dotnet tool list -g | select-string -Pattern "$Name\s+$Version"
if ($installed -eq $null)
if ($null -eq $installed)
{
& dotnet tool update --global $Name --version $Version --configfile $NuGetConfigFile
}
}
else
{
$installed = & dotnet tool list -g | select-string -Pattern "$Name"
if ($installed -eq $null)
if ($null -eq $installed)
{
& dotnet tool update --global $Name --configfile $NuGetConfigFile
}
Expand Down

0 comments on commit 2e6b619

Please sign in to comment.