Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Layout changes for major version locking
- Loading branch information
1 parent
5697456
commit 34a5a15
Showing
4 changed files
with
375 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$IndividualZipStagingPath, | ||
[string]$SourceRoot, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$WrapperZipStagingPath, | ||
[string]$TargetPath, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$ZipPath) | ||
[switch]$Individually) | ||
|
||
$ErrorActionPreference = 'Stop' | ||
Add-Type -Assembly 'System.IO.Compression.FileSystem' | ||
Get-ChildItem -LiteralPath $IndividualZipStagingPath | | ||
ForEach-Object { | ||
$sourceDir = $_.FullName | ||
$targetDir = [System.IO.Path]::Combine($WrapperZipStagingPath, $_.Name) | ||
Write-Host "Compressing $($_.Name)" | ||
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, "$targetDir\task.zip") | ||
if ($Individually) { | ||
# Create the target root directory. | ||
if (!(Test-Path -LiteralPath $TargetPath -PathType Container)) { | ||
$null = New-Item -Path $TargetPath -ItemType Directory | ||
} | ||
|
||
# Create each task zip. | ||
Get-ChildItem -LiteralPath $SourceRoot | | ||
ForEach-Object { | ||
$sourceDir = $_.FullName | ||
$targetDir = [System.IO.Path]::Combine($TargetPath, $_.Name) | ||
Write-Host "Compressing $($_.Name)" | ||
$null = New-Item -Path $targetDir -ItemType Directory | ||
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, "$targetDir\task.zip") | ||
} | ||
} else { | ||
# Create the target directory. | ||
$targetDir = [System.IO.Path]::GetDirectoryName($TargetPath) | ||
if (!(Test-Path -LiteralPath $targetDir -PathType Container)) { | ||
$null = New-Item -Path $targetDir -ItemType Directory | ||
} | ||
|
||
Write-Host "Creating $([System.IO.Path]::GetFileName($ZipPath))" | ||
$null = New-Item -Path ([System.IO.Path]::GetDirectoryName($ZipPath)) -ItemType Directory | ||
[System.IO.Compression.ZipFile]::CreateFromDirectory($WrapperZipStagingPath, $ZipPath) | ||
# Create the zip. | ||
[System.IO.Compression.ZipFile]::CreateFromDirectory($SourceRoot, $TargetPath) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$ZipPath, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$TargetPath) | ||
|
||
$ErrorActionPreference = 'Stop' | ||
Add-Type -Assembly 'System.IO.Compression.FileSystem' | ||
|
||
# Create the target directory. | ||
if (!(Test-Path -LiteralPath $TargetPath -PathType Container)) { | ||
$null = New-Item -Path $TargetPath -ItemType Directory | ||
} | ||
|
||
# Create the zip. | ||
[System.IO.Compression.ZipFile]::ExtractToDirectory($ZipPath, $TargetPath) |
Oops, something went wrong.