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

release 3.6.0 #106

Merged
merged 21 commits into from
Oct 27, 2024
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
6 changes: 3 additions & 3 deletions Build/build-ci.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Requires -Version "7.0"
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.0" }
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.3" }

[CmdletBinding()]
param (
Expand All @@ -8,8 +8,8 @@ param (
$GithubToken
)

$ErrorActionPreference = "Stop"
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest

$file = Join-Path $PSScriptRoot "build-tasks.ps1"
$file = Join-Path $PSScriptRoot 'build-tasks.ps1'
Invoke-Build -File $file -Task CiBuild -GithubToken $GithubToken
6 changes: 3 additions & 3 deletions Build/build-locally.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#Requires -Version "7.0"
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.0" }
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.3" }

$ErrorActionPreference = "Stop"
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest

$file = Join-Path $PSScriptRoot "build-tasks.ps1"
$file = Join-Path $PSScriptRoot 'build-tasks.ps1'
Invoke-Build -File $file -Task LocalBuild
98 changes: 49 additions & 49 deletions Build/build-tasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ task Pack PackGlobalTool, PackPowerShellModule, PackManualDownload, PackTest

Enter-Build {
$settings = @{
sources = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../Sources"))
output = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../build-out"))
bin = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../Sources/bin"))
repository = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../ThirdPartyLibraries"))
examples = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../Examples"))
frameworks = "net6.0", "net7.0", "net8.0"
sources = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../Sources'))
output = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../build-out'))
bin = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../Sources/bin'))
repository = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../ThirdPartyLibraries'))
examples = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../Examples'))
frameworks = 'net6.0', 'net8.0', 'net9.0'
version = $(
$buildProps = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../Sources/Directory.Build.props"))
$packageVersion = (Select-Xml -Path $buildProps -XPath "Project/PropertyGroup/DefaultPackageVersion").Node.InnerText
assert $packageVersion "Package version not found"
$buildProps = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../Sources/Directory.Build.props'))
$packageVersion = (Select-Xml -Path $buildProps -XPath 'Project/PropertyGroup/DefaultPackageVersion').Node.InnerText
assert $packageVersion 'Package version not found'
$packageVersion
)
}
Expand All @@ -39,42 +39,42 @@ task Clean {
Get-ChildItem -Path $settings.sources -Filter bin -Directory -Recurse | Remove-Item -Recurse -Force
Get-ChildItem -Path $settings.sources -Filter obj -Directory -Recurse | Remove-Item -Recurse -Force

$nodeModules = Join-Path $settings.sources "ThirdPartyLibraries.Npm.Demo\node_modules"
$nodeModules = Join-Path $settings.sources 'ThirdPartyLibraries.Npm.Demo\node_modules'
if (Test-Path $nodeModules) {
Remove-Item -Path $nodeModules -Recurse -Force
}
}

task Build {
Invoke-Build -File "tasks/build.ps1" -SourcesPath $settings.sources
Invoke-Build -File 'tasks/build.ps1' -SourcesPath $settings.sources
}

task ThirdPartyNotices {
Invoke-Build `
-File "tasks/third-party-notices.ps1" `
-AppPath (Join-Path $settings.bin "app/net6.0/ThirdPartyLibraries.dll") `
-File 'tasks/third-party-notices.ps1' `
-AppPath (Join-Path $settings.bin 'app/net6.0/ThirdPartyLibraries.dll') `
-Version $settings.version `
-SourcesPath $settings.sources `
-RepositoryPath $settings.repository `
-OutPath (Join-Path $settings.output "ThirdNotices") `
-OutPath (Join-Path $settings.output 'ThirdNotices') `
-GithubToken $GithubToken
}

task UnitTest {
$builds = @()
foreach ($framework in $settings.frameworks) {
$builds += @{ File = "tasks/unit-test.ps1"; BinPath = $settings.bin; Framework = $framework }
$builds += @{ File = 'tasks/unit-test.ps1'; BinPath = $settings.bin; Framework = $framework }
}

Build-Parallel $builds -ShowParameter Framework -MaximumBuilds 4
}

task PackGlobalTool {
Invoke-Build -File "tasks/pack-global-tool.ps1" -SourcesPath $settings.sources -OutPath $settings.output
Invoke-Build -File 'tasks/pack-global-tool.ps1' -SourcesPath $settings.sources -OutPath $settings.output
}

task PackPowerShellModule {
Invoke-Build -File "tasks/pack-ps-module.ps1" `
Invoke-Build -File 'tasks/pack-ps-module.ps1' `
-BinPath $settings.bin `
-Version $settings.version `
-OutPath $settings.output
Expand All @@ -84,7 +84,7 @@ task PackManualDownload {
$builds = @()
foreach ($framework in $settings.frameworks) {
$builds += @{
File = "tasks/pack-manual-download.ps1"
File = 'tasks/pack-manual-download.ps1'
BinPath = $settings.bin
Version = $settings.version
Framework = $framework
Expand All @@ -96,13 +96,13 @@ task PackManualDownload {
}

task PackTest {
$packageList = Get-ChildItem -Path $settings.output -Recurse -File -Include "*.nupkg", "*.zip" | ForEach-Object { $_.FullName }
assert ($packageList -and $packageList.Length) "no packages found."
$packageList = Get-ChildItem -Path $settings.output -Recurse -File -Include '*.nupkg', '*.zip' | ForEach-Object { $_.FullName }
assert ($packageList -and $packageList.Length) 'no packages found.'

$builds = @()
foreach ($package in $packageList) {
$builds += @{
File = "tasks/pack-test.ps1"
File = 'tasks/pack-test.ps1'
Path = $package
}
}
Expand All @@ -113,31 +113,31 @@ task PackTest {
task PsCoreTest {
# show-powershell-images.ps1
$images = $(
"mcr.microsoft.com/powershell:7.0.0-ubuntu-18.04"
, "mcr.microsoft.com/powershell:7.0.1-ubuntu-18.04"
, "mcr.microsoft.com/powershell:7.0.2-ubuntu-18.04"
, "mcr.microsoft.com/powershell:7.0.3-ubuntu-18.04"
, "mcr.microsoft.com/powershell:7.1.0-ubuntu-18.04"
, "mcr.microsoft.com/powershell:7.1.1-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.1.2-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.1.3-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.1.4-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.1.5-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.2.0-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.2.1-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.2.2-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.3-ubuntu-20.04"
, "mcr.microsoft.com/powershell:7.4-ubuntu-20.04"
, "mcr.microsoft.com/powershell:preview-7.5-ubuntu-20.04")
'mcr.microsoft.com/powershell:7.0.0-ubuntu-18.04'
, 'mcr.microsoft.com/powershell:7.0.1-ubuntu-18.04'
, 'mcr.microsoft.com/powershell:7.0.2-ubuntu-18.04'
, 'mcr.microsoft.com/powershell:7.0.3-ubuntu-18.04'
, 'mcr.microsoft.com/powershell:7.1.0-ubuntu-18.04'
, 'mcr.microsoft.com/powershell:7.1.1-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.1.2-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.1.3-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.1.4-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.1.5-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.2.0-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.2.1-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.2.2-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.3-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:7.4-ubuntu-20.04'
, 'mcr.microsoft.com/powershell:preview-7.5-ubuntu-20.04')

$builds = @()
foreach ($image in $images) {
exec { docker pull --quiet $image }

$builds += @{
File = "tasks/test-ps-module.ps1"
PowerShellPath = (Join-Path $settings.output "pwsh.zip")
TestPath = (Join-Path $settings.sources "ThirdPartyLibraries.PowerShell.IntegrationTest")
File = 'tasks/test-ps-module.ps1'
PowerShellPath = (Join-Path $settings.output 'pwsh.zip')
TestPath = (Join-Path $settings.sources 'ThirdPartyLibraries.PowerShell.IntegrationTest')
ImageName = $image
}
}
Expand All @@ -146,29 +146,29 @@ task PsCoreTest {
}

task UpdateExamples {
$appPath = Join-Path $settings.bin "app/net6.0/ThirdPartyLibraries.dll"
$appPath = Join-Path $settings.bin 'app/net6.0/ThirdPartyLibraries.dll'
$builds = @()

$examples = Get-ChildItem -Path (Join-Path $settings.examples "third-party-notices-template") -Directory
$examples = Get-ChildItem -Path (Join-Path $settings.examples 'third-party-notices-template') -Directory
foreach ($example in $examples) {
$builds += @{
File = "tasks/update-example.ps1"
File = 'tasks/update-example.ps1'
AppPath = $appPath
ExamplePath = $example.FullName
RepositoryPath = $settings.repository
TemplatePath = (Join-Path $example.FullName "third-party-notices-template.txt")
ToFileName = "ThirdPartyNotices.txt"
TemplatePath = (Join-Path $example.FullName 'third-party-notices-template.txt')
ToFileName = 'ThirdPartyNotices.txt'
}
}

$example = Join-Path $settings.examples "export-to-csv"
$example = Join-Path $settings.examples 'export-to-csv'
$builds += @{
File = "tasks/update-example.ps1"
File = 'tasks/update-example.ps1'
AppPath = $appPath
ExamplePath = $example
RepositoryPath = $settings.repository
TemplatePath = (Join-Path $example "export-template.txt")
ToFileName = "packages.csv"
TemplatePath = (Join-Path $example 'export-template.txt')
ToFileName = 'packages.csv'
}

Build-Parallel $builds -ShowParameter ExamplePath -MaximumBuilds 1
Expand Down
24 changes: 12 additions & 12 deletions Build/install-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
[CmdletBinding()]
param (
[Parameter()]
[ValidateSet(".net", "InvokeBuild")]
[ValidateSet('.net', 'InvokeBuild')]
[string[]]
$List
)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$ErrorActionPreference = 'Stop'

. (Join-Path $PSScriptRoot "scripts" "Get-ModuleVersion.ps1")
. (Join-Path $PSScriptRoot 'scripts' 'Get-ModuleVersion.ps1')

if (-not $List -or (".net" -in $List)) {
$install = Join-Path $PSScriptRoot "scripts/Install-DotNet.ps1"
& $install "6.0.418"
& $install "7.0.405"
& $install (Get-Content -Raw (Join-Path $PSScriptRoot "../Sources/global.json") | ConvertFrom-Json).sdk.version
if (-not $List -or ('.net' -in $List)) {
$install = Join-Path $PSScriptRoot 'scripts/Install-DotNet.ps1'
& $install '6.0.418'
& $install '9.0.100-rc.2.24474.11'
& $install (Get-Content -Raw (Join-Path $PSScriptRoot '../Sources/global.json') | ConvertFrom-Json).sdk.version
}

if (-not $List -or ("InvokeBuild" -in $List)) {
$install = Join-Path $PSScriptRoot "scripts/Install-Module.ps1"
$version = Get-ModuleVersion "InvokeBuild"
& $install "InvokeBuild" $version
if (-not $List -or ('InvokeBuild' -in $List)) {
$install = Join-Path $PSScriptRoot 'scripts/Install-Module.ps1'
$version = Get-ModuleVersion 'InvokeBuild'
& $install 'InvokeBuild' $version
}
2 changes: 1 addition & 1 deletion Build/scripts/Get-ModuleVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-ModuleVersion {
$Name
)

$sources = Get-Content (Join-Path $PSScriptRoot "../build-ci.ps1") -Raw
$sources = Get-Content (Join-Path $PSScriptRoot '../build-ci.ps1') -Raw
$tokens = $null
$errors = $null
$modules = [Management.Automation.Language.Parser]::ParseInput($sources, [ref]$tokens, [ref]$errors).ScriptRequirements.RequiredModules
Expand Down
12 changes: 6 additions & 6 deletions Build/scripts/Install-DotNet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (Get-Command -Name dotnet -ErrorAction SilentlyContinue) {
$versions = dotnet --list-sdks
foreach ($installedVersion in $versions) {
# 6.0.401 [C:\Program Files\dotnet\sdk]
$test = ($installedVersion -split " ")[0]
$test = ($installedVersion -split ' ')[0]

if (Test-Version -Target $Version -Test $test) {
Write-Output ".net sdk $test is alredy installed"
Expand All @@ -40,15 +40,15 @@ if (Get-Command -Name dotnet -ErrorAction SilentlyContinue) {
}
}

$installDir = "C:\Program Files\dotnet"
$installScript = "dotnet-install.ps1"
$installDir = 'C:\Program Files\dotnet'
$installScript = 'dotnet-install.ps1'

if ($IsLinux) {
$installDir = "/usr/share/dotnet"
$installScript = "dotnet-install.sh"
$installDir = '/usr/share/dotnet'
$installScript = 'dotnet-install.sh'
}

$downloadDir = Join-Path ([System.IO.Path]::GetTempPath()) "install-dotnet"
$downloadDir = Join-Path ([System.IO.Path]::GetTempPath()) 'install-dotnet'
if (Test-Path $downloadDir) {
Remove-Item -Path $downloadDir -Recurse -Force
}
Expand Down
4 changes: 2 additions & 2 deletions Build/tasks/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ param(
$SourcesPath
)

task Default DotnetRestore, DotnetBuild
task . DotnetRestore, DotnetBuild

task DotnetRestore {
exec { dotnet restore $SourcesPath }
}

task DotnetBuild {
$sln = Join-Path $SourcesPath "ThirdPartyLibraries.sln"
$sln = Join-Path $SourcesPath 'ThirdPartyLibraries.sln'
exec {
dotnet build $sln `
-t:Rebuild `
Expand Down
4 changes: 2 additions & 2 deletions Build/tasks/pack-global-tool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ param(
$OutPath
)

task Default {
$projectFile = Join-Path $SourcesPath "ThirdPartyLibraries/ThirdPartyLibraries.csproj"
task . {
$projectFile = Join-Path $SourcesPath 'ThirdPartyLibraries/ThirdPartyLibraries.csproj'

exec {
dotnet pack `
Expand Down
6 changes: 3 additions & 3 deletions Build/tasks/pack-manual-download.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ param(
$Version,

[Parameter(Mandatory = $true)]
[ValidateSet("net6.0", "net7.0", "net8.0")]
[ValidateSet('net6.0', 'net8.0', 'net9.0')]
[string]
$Framework,

Expand All @@ -20,8 +20,8 @@ param(
$OutPath
)

task Default {
$lic = Join-Path $OutPath "ThirdNotices/*"
task . {
$lic = Join-Path $OutPath 'ThirdNotices/*'
$destination = Join-Path $OutPath "ThirdPartyLibraries.$Version-$Framework.zip"
$source = Join-Path $BinPath "app/$Framework/publish/*"

Expand Down
14 changes: 7 additions & 7 deletions Build/tasks/pack-ps-module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ param(
$OutPath
)

task Default Copy, Clean, SetVersion, Zip
task . Copy, Clean, SetVersion, Zip

Enter-Build {
$temp = Join-Path $OutPath "pwsh"
$temp = Join-Path $OutPath 'pwsh'
}

Exit-Build {
remove $temp
}

task Copy {
Copy-Item -Path (Join-Path $BinPath "pwsh") -Destination $temp -Recurse
Copy-Item -Path (Join-Path $BinPath 'pwsh') -Destination $temp -Recurse
}

task Clean {
Expand All @@ -35,13 +35,13 @@ task Clean {

task SetVersion {
# .psd1 set module version
$psdFile = Join-Path $temp "ThirdPartyLibraries.psd1"
$psdFile = Join-Path $temp 'ThirdPartyLibraries.psd1'
$content = Get-Content -Path $psdFile -Raw
$content = $content -replace "3.2.1", $Version
$content = $content -replace '3.2.1', $Version
Set-Content -Path $psdFile -Value $content
}

task Zip {
$lic = Join-Path $OutPath "ThirdNotices/*"
Compress-Archive -Path "$temp/*", $lic -DestinationPath (Join-Path $OutPath "pwsh.zip")
$lic = Join-Path $OutPath 'ThirdNotices/*'
Compress-Archive -Path "$temp/*", $lic -DestinationPath (Join-Path $OutPath 'pwsh.zip')
}
Loading