Skip to content

Commit

Permalink
Changes necessary for releasing 0.3.2 chocolatey package.
Browse files Browse the repository at this point in the history
Note - the chocolatey package to satisfy this has not yet been released, but it _will_ be according to [this trail](userzimmermann/choco-packages#7 (comment))

Closes #1905.

--
Reviewed-on: #1905
MOS_MIGRATED_REVID=135774603
  • Loading branch information
petemounce authored and hermione521 committed Oct 11, 2016
1 parent c925f34 commit 22d3673
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions scripts/packages/chocolatey/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
*.zip
bazel.nuspec
chocolateyinstall.ps1
chocolateyuninstall.ps1
tools/*.exe
tools/LICENSE.txt
2 changes: 1 addition & 1 deletion scripts/packages/chocolatey/bazel.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Supply like `--params="/option:value ..."` ([see docs for --params](https://gith
</dependencies>-->
<dependencies>
<dependency id="jdk8" version="[8.0.102,)"/>
<dependency id="msys2" version="[20150916.0.1,)"/>
<dependency id="msys2" version="[20160205,)"/>
<dependency id="python2" version="[2.7.11,3.0)"/>
</dependencies>
<!-- chocolatey-uninstall.extension - If supporting 0.9.9.x (or below) and including a chocolateyUninstall.ps1 file to uninstall an EXE/MSI, you probably want to include chocolatey-uninstall.extension as a dependency. Please verify whether you are using a helper function from that package. -->
Expand Down
25 changes: 15 additions & 10 deletions scripts/packages/chocolatey/build.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
param(
[string] $version = "0.3.1",
[string] $version = "0.3.2",
[switch] $isRelease
)

$tvVersion = $version
$tvFilename = "bazel_$($version)_windows_x86_64.zip"
$tvFilename = "bazel-$($version)-windows-x86_64.zip"
if ($isRelease) {
$tvUri = "https://github.com/bazelbuild/bazel/releases/download/$($version)/$($tvFilename)"
} else {
Expand All @@ -17,14 +17,19 @@ rm -force -ErrorAction SilentlyContinue ./*.zip
rm -force -ErrorAction SilentlyContinue ./bazel.nuspec
rm -force -ErrorAction SilentlyContinue ./tools/chocolateyinstall.ps1

Add-Type -A System.IO.Compression.FileSystem
$outputDir = "$pwd/../../../output"
$zipFile = "$pwd/$($tvFilename)"
write-host "Creating zip package with $outputDir/bazel.exe: $zipFile"
Compress-Archive -Path "$outputDir/bazel.exe" -DestinationPath $zipFile
$tvChecksum = (get-filehash $zipFile -algorithm sha256).Hash
write-host "zip sha256: $tvChecksum"

if ($isRelease) {
Invoke-WebRequest "$($tvUri).sha256" -UseBasicParsing -passthru -outfile sha256.txt
$tvChecksum = (gc sha256.txt).split(' ')[0]
rm sha256.txt
} else {
Add-Type -A System.IO.Compression.FileSystem
$outputDir = "$pwd/../../../output"
$zipFile = "$pwd/$($tvFilename)"
write-host "Creating zip package with $outputDir/bazel.exe: $zipFile"
Compress-Archive -Path "$outputDir/bazel.exe" -DestinationPath $zipFile
$tvChecksum = (get-filehash $zipFile -algorithm sha256).Hash
write-host "zip sha256: $tvChecksum"
}
$nuspecTemplate = get-content "bazel.nuspec.template" | out-string
$nuspecExpanded = $ExecutionContext.InvokeCommand.ExpandString($nuspecTemplate)
add-content -value $nuspecExpanded -path bazel.nuspec
Expand Down
3 changes: 2 additions & 1 deletion scripts/packages/chocolatey/chocolateyinstall.ps1.template
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ if (ps_var_packageParameters)
}
Install-ChocolateyPath -PathToInstall "ps_var_msys2Path\usr\bin" -PathType "Machine"

ps_var_addToMsysPath = (ps_var_packageDir -replace 'c:\\','/c/') -replace '\\','/'
write-host @"
bazel installed to ps_var_packageDir

To use it in msys2, you should add that to your msys2 PATH:
export PATH=ps_var_(ps_var_packageDir):escape_charps_var_PATH
export PATH=ps_var_(ps_var_addToMsysPath):escape_charps_var_PATH

You also need, in your msys2 environment:
export JAVA_HOME="escape_charps_var_(ls -d C:/Program\ Files/Java/jdk* | sort | tail -n 1)escape_char"
Expand Down
2 changes: 1 addition & 1 deletion scripts/packages/chocolatey/test.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
param(
[string] $version = "0.3.1"
[string] $version = "0.3.2"
)

choco uninstall bazel --force -y
Expand Down

0 comments on commit 22d3673

Please sign in to comment.