switch layout

This commit is contained in:
Maxim Lobanov
2020-04-23 05:51:34 +03:00
parent a70d3e2a34
commit 4003986702
6 changed files with 49 additions and 2 deletions
+3 -1
View File
@@ -23,9 +23,11 @@ param(
[Parameter (Mandatory=$true)][Version] $Version, [Parameter (Mandatory=$true)][Version] $Version,
[Parameter (Mandatory=$true)][string] $Platform, [Parameter (Mandatory=$true)][string] $Platform,
[string] $Architecture = "x64" [string] $Architecture = "x64"
) )
Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "nix-helpers.psm1") -DisableNameChecking
Import-Module (Join-Path $PSScriptRoot "../helpers" | Join-Path -ChildPath "win-helpers.psm1") -DisableNameChecking
function Get-NodeBuilder { function Get-NodeBuilder {
<# <#
.SYNOPSIS .SYNOPSIS
+4
View File
@@ -40,6 +40,10 @@ class NixNodeBuilder : NodeBuilder {
return "${base}/v$($this.Version)/node-v$($this.Version)-$($this.Platform)-$($this.Architecture).tar.gz" return "${base}/v$($this.Version)/node-v$($this.Version)-$($this.Platform)-$($this.Architecture).tar.gz"
} }
[void] UnpackBinaries($archivePath) {
Unpack-TarArchive -ArchivePath $archivePath -OutputDirectory $this.ArtifactLocation
}
[void] CreateInstallationScript() { [void] CreateInstallationScript() {
<# <#
.SYNOPSIS .SYNOPSIS
+6 -1
View File
@@ -15,6 +15,9 @@ class NodeBuilder {
.PARAMETER Architecture .PARAMETER Architecture
The architecture with which Node.js should be built. The architecture with which Node.js should be built.
.PARAMETER TempFolderLocation
The location of temporary files that will be used during Node.js package generation. Using system BUILD_STAGINGDIRECTORY variable value.
.PARAMETER ArtifactLocation .PARAMETER ArtifactLocation
The location of generated Node.js artifact. Using system environment BUILD_BINARIESDIRECTORY variable value. The location of generated Node.js artifact. Using system environment BUILD_BINARIESDIRECTORY variable value.
@@ -26,6 +29,7 @@ class NodeBuilder {
[version] $Version [version] $Version
[string] $Platform [string] $Platform
[string] $Architecture [string] $Architecture
[string] $TempFolderLocation
[string] $ArtifactLocation [string] $ArtifactLocation
[string] $InstallationTemplatesLocation [string] $InstallationTemplatesLocation
@@ -35,6 +39,7 @@ class NodeBuilder {
$this.Architecture = $architecture $this.Architecture = $architecture
$this.ArtifactLocation = $env:BUILD_BINARIESDIRECTORY $this.ArtifactLocation = $env:BUILD_BINARIESDIRECTORY
$this.TempFolderLocation = $env:BUILD_STAGINGDIRECTORY
$this.InstallationTemplatesLocation = Join-Path -Path $PSScriptRoot -ChildPath "../installers" $this.InstallationTemplatesLocation = Join-Path -Path $PSScriptRoot -ChildPath "../installers"
} }
@@ -56,7 +61,7 @@ class NodeBuilder {
$binariesUri = $this.GetBinariesUri() $binariesUri = $this.GetBinariesUri()
$targetFilename = [IO.Path]::GetFileName($binariesUri) $targetFilename = [IO.Path]::GetFileName($binariesUri)
$targetFilepath = Join-Path -Path $this.ArtifactLocation -ChildPath $targetFilename $targetFilepath = Join-Path -Path $this.TempFolderLocation -ChildPath $targetFilename
Write-Debug "Download binaries from $binariesUri to $targetFilepath" Write-Debug "Download binaries from $binariesUri to $targetFilepath"
try { try {
+4
View File
@@ -40,6 +40,10 @@ class WinNodeBuilder : NodeBuilder {
return "${base}/v$($this.Version)/node-v$($this.Version)-win-$($this.Architecture).7z" return "${base}/v$($this.Version)/node-v$($this.Version)-win-$($this.Architecture).7z"
} }
[void] UnpackBinaries($archivePath) {
Unpack-7ZipArchive -ArchivePath $archivePath -OutputDirectory $this.ArtifactLocation
}
[void] CreateInstallationScript() { [void] CreateInstallationScript() {
<# <#
.SYNOPSIS .SYNOPSIS
+16
View File
@@ -0,0 +1,16 @@
<#
.SYNOPSIS
Unpack *.tar file
#>
function Unpack-TarArchive {
param(
[Parameter(Mandatory=$true)]
[String]$ArchivePath,
[Parameter(Mandatory=$true)]
[String]$OutputDirectory
)
Write-Debug "Unpack $ArchivePath to $OutputDirectory"
tar -C $OutputDirectory -xzf $ArchivePath
}
+16
View File
@@ -0,0 +1,16 @@
<#
.SYNOPSIS
Unpack *.7z file
#>
function Unpack-7ZipArchive {
param(
[Parameter(Mandatory=$true)]
[String]$ArchivePath,
[Parameter(Mandatory=$true)]
[String]$OutputDirectory
)
Write-Debug "Unpack $ArchivePath to $OutputDirectory"
7z x $ArchivePath -o$OutputDirectory
}