Skip to content
Closed
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
29 changes: 12 additions & 17 deletions packages/golang-windows/packaging
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
. ./exiter.ps1
try {
$BOSH_INSTALL_TARGET = Resolve-Path $env:BOSH_INSTALL_TARGET
} catch {
$Host.UI.WriteErrorLine($_.Exception.Message)
Exit 1
}

$path="golang/go1.7.1.windows-amd64.zip"

Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
$GOLANG_ZIP="golang/go1.7.1.windows-amd64.zip"
try
{
param([string]$zipfile, [string]$outpath)
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)

[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}

try
{
Unzip $path ${BOSH_INSTALL_TARGET}
$BOSH_INSTALL_TARGET = Resolve-Path "${env:BOSH_INSTALL_TARGET}"
Unzip "$GOLANG_ZIP" "$BOSH_INSTALL_TARGET"
}
catch
{
$Host.UI.WriteErrorLine($_.Exception.Message)
Write-Error "Error installing go:"
Write-Error $_.Exception.Message
Exit 1
}
Exit 0
15 changes: 6 additions & 9 deletions packages/rep_windows/packaging
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
. ./exiter.ps1

try {
$BOSH_INSTALL_TARGET = Resolve-Path $env:BOSH_INSTALL_TARGET
} catch {
$Host.UI.WriteErrorLine($_.Exception.Message)
Write-Error $_.Exception.Message
Exit 1
}

Expand All @@ -12,11 +13,6 @@ $env:PATH="${env:GOROOT}\bin;${env:PATH}"
$pkg_name="rep"
$pkg_path="code.cloudfoundry.org\rep\cmd\rep"

function CompileGo {
go.exe build -o "${BOSH_INSTALL_TARGET}\${pkg_name}.exe" "${pkg_path}"
$?
}

try
{
# Create GOPATH
Expand All @@ -26,8 +22,9 @@ try
Exit 1
}

if (-Not (CompileGo)) {
$Host.UI.WriteErrorLine("Error compiling: ${pkg_path}")
go.exe build -o "${BOSH_INSTALL_TARGET}\${pkg_name}.exe" "${pkg_path}"
if ($LASTEXITCODE -ne 0) {
Write-Error "Error compiling: ${pkg_path}"
Exit 1
}

Expand All @@ -36,7 +33,7 @@ try
}
catch
{
$Host.UI.WriteErrorLine($_.Exception.Message)
Write-Error $_.Exception.Message
Exit 1
}

Expand Down