Skip to content
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
18 changes: 13 additions & 5 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ function Start-PSBuild {
try {
# Excluded sqlite3 folder is due to this Roslyn issue: https://github.com/dotnet/roslyn/issues/23060
# Excluded src/Modules/nuget.config as this is required for release build.
git clean -fdX --exclude .vs/PowerShell/v16/Server/sqlite3 --exclude src/Modules/nuget.config
# Excluded nuget.config as this is required for release build.
git clean -fdX --exclude .vs/PowerShell/v16/Server/sqlite3 --exclude src/Modules/nuget.config --exclude nuget.config
} finally {
Pop-Location
}
Expand Down Expand Up @@ -628,7 +629,9 @@ function Restore-PSPackage

[switch] $Force,

[switch] $InteractiveAuth
[switch] $InteractiveAuth,

[switch] $PSModule
)

if (-not $ProjectDirs)
Expand All @@ -652,7 +655,10 @@ function Restore-PSPackage
'Microsoft.NET.Sdk'
}

if ($Options.Runtime -notlike 'fxdependent*') {
if ($PSModule.IsPresent) {
$RestoreArguments = @("--verbosity")
}
elseif ($Options.Runtime -notlike 'fxdependent*') {
$RestoreArguments = @("--runtime", $Options.Runtime, "/property:SDKToUse=$sdkToUse", "--verbosity")
} else {
$RestoreArguments = @("/property:SDKToUse=$sdkToUse", "--verbosity")
Expand Down Expand Up @@ -2500,7 +2506,7 @@ function Copy-PSGalleryModules

Find-DotNet

Restore-PSPackage -ProjectDirs (Split-Path $CsProjPath) -Force:$Force.IsPresent
Restore-PSPackage -ProjectDirs (Split-Path $CsProjPath) -Force:$Force.IsPresent -PSModule

$cache = dotnet nuget locals global-packages -l
if ($cache -match "global-packages: (.*)") {
Expand Down Expand Up @@ -3282,8 +3288,10 @@ function New-NugetConfigFile
<packageSources>
<clear />
<add key="[FEEDNAME]" value="[FEED]" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
<packageSourceCredentials>
<[FEEDNAME]>
<add key="Username" value="[USERNAME]" />
Expand Down
6 changes: 3 additions & 3 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<clear />
<add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="powershell_nuget" value="https://powershell.pkgs.visualstudio.com/PowerShell/_packaging/powershell/nuget/v3/index.json" />
<add key="PSGallery" value="https://www.powershellgallery.com/api/v2/" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>
10 changes: 9 additions & 1 deletion src/Modules/PSGalleryModules.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">

<Import Project="..\..\PowerShell.Common.props" />
<PropertyGroup>
<Product>PowerShell</Product>
<Company>Microsoft Corporation</Company>
<Copyright>(c) Microsoft Corporation.</Copyright>

<TargetFramework>net5.0</TargetFramework>

<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PowerShellGet" Version="2.2.5" />
Expand Down
11 changes: 11 additions & 0 deletions src/Modules/nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="PSGallery" value="https://www.powershellgallery.com/api/v2/" />
<add key="powershell_nuget" value="https://powershell.pkgs.visualstudio.com/PowerShell/_packaging/powershell/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>
10 changes: 10 additions & 0 deletions test/tools/Modules/nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="PSGallery" value="https://www.powershellgallery.com/api/v2/" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ steps:

- pwsh: |
Import-Module -Force "$(Build.SourcesDirectory)/tools/releaseBuild/azureDevOps/AzArtifactFeed/SyncGalleryToAzArtifacts.psm1"
SyncGalleryToAzArtifacts -AzDevOpsFeedUserName $(AzDevOpsFeedUserName) -AzDevOpsPAT $(AzDevOpsFeedPAT) -Destination $(Build.ArtifactStagingDirectory)
SyncGalleryToAzArtifacts -AzDevOpsFeedUserName $(AzDevOpsFeedUserName) -AzDevOpsPAT $(AzDevOpsFeedPAT2) -Destination $(Build.ArtifactStagingDirectory)
displayName: Download packages from PSGallery that need to be updated
condition: succeededOrFailed()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
parameters:
- name: "repoRoot"
default: $(REPOROOT)

steps:
- powershell: |
Import-Module $env:REPOROOT/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination $env:REPOROOT/src/Modules
- pwsh: |
Import-Module ${{ parameters.repoRoot }}/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT2) -FeedName AzDevOpsFeed -Destination '${{ parameters.repoRoot }}/src/Modules'

if(-not (Test-Path "$env:REPOROOT/src/Modules/nuget.config"))
if(-not (Test-Path "${{ parameters.repoRoot }}/src/Modules/nuget.config"))
{
throw "nuget.config is not created"
}
displayName: 'Add nuget.config for Azure DevOps feed for PSGallery modules'
condition: and(succeededOrFailed(), ne(variables['AzDevOpsFeed'], ''))
- pwsh: |
Import-Module ${{ parameters.repoRoot }}/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsPackageFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT2) -FeedName AzDevOpsFeed -Destination '${{ parameters.repoRoot }}'

if(-not (Test-Path "${{ parameters.repoRoot }}/nuget.config"))
{
throw "nuget.config is not created"
}
displayName: 'Add nuget.config for Azure DevOps feed for packages'
condition: and(succeededOrFailed(), ne(variables['AzDevOpsPackageFeed'], ''))
5 changes: 4 additions & 1 deletion tools/releaseBuild/azureDevOps/templates/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ jobs:
displayName: 'Skip Alpine or fxdependent for PS v6.0.*'

- template: insert-nuget-config-azfeed.yml

parameters:
repoRoot: $(REPOROOT)

- powershell: |
import-module "$env:REPOROOT/build.psm1"
Expand All @@ -51,7 +52,9 @@ jobs:
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))

- powershell: |
$env:AzDevOpsFeedPAT2 = '$(AzDevOpsFeedPAT2)'
& "$env:REPOROOT/tools/releaseBuild/vstsbuild.ps1" -ReleaseTag $(ReleaseTagVar) -Name '$(build)'
$env:AzDevOpsFeedPAT2 = $null

displayName: 'Build and package'
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))
Expand Down
16 changes: 5 additions & 11 deletions tools/releaseBuild/azureDevOps/templates/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,14 @@ jobs:
tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -location $(PowerShellRoot) -BootStrap
displayName: 'Bootstrap VM'

- pwsh: |
Import-Module $(Build.SourcesDirectory)/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination "$(PowerShellRoot)/src/Modules"

if(-not (Test-Path "$(PowerShellRoot)/src/Modules/nuget.config"))
{
throw "nuget.config is not created"
}
displayName: 'Add nuget.config for AzDevOps feed for PSGallery modules '
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
parameters:
repoRoot: $(PowerShellRoot)

- pwsh: |
$env:AZDEVOPSFEEDPAT = '$(AzDevOpsFeedPAT)'
$env:AzDevOpsFeedPAT2 = '$(AzDevOpsFeedPAT2)'
$(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -Symbols -location $(PowerShellRoot) -Build -ArtifactName macosBinResults
$env:AZDEVOPSFEEDPAT = $null
$env:AzDevOpsFeedPAT2 = $null
displayName: 'Build'

- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ jobs:
parameters:
ReleaseTagVar: $(ReleaseTagVar)

- template: insert-nuget-config-azfeed.yml

- template: cloneToOfficialPath.yml

- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
parameters:
repoRoot: $(PowerShellRoot)

- powershell: |

$runtime = switch ($env:Architecture)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ jobs:

- template: cloneToOfficialPath.yml

- powershell: |
- pwsh: |
# cleanup previous install
if((Test-Path "${env:ProgramFiles(x86)}\WiX Toolset xcopy")) {
Remove-Item "${env:ProgramFiles(x86)}\WiX Toolset xcopy" -Recurse -Force
}

$toolsDir = New-Item -ItemType Directory -Path '$(Build.ArtifactStagingDirectory)\tools'
$wixUri = 'https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip'
Invoke-RestMethod -Uri $wixUri -OutFile '$(Build.ArtifactStagingDirectory)\tools\wix.zip'
Invoke-RestMethod -Uri $wixUri -OutFile '$(Build.ArtifactStagingDirectory)\tools\wix.zip' -MaximumRetryCount 5 -RetryIntervalSec 10

Import-Module '$(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/wix.psm1'
Install-WixZip -zipPath '$(Build.ArtifactStagingDirectory)\tools\wix.zip'
Expand Down