-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up chocolatey package building
- Use built in chocolatey templating instead of manual templating
- Loading branch information
Showing
9 changed files
with
84 additions
and
90 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
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,2 @@ | ||
neko | ||
pack |
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,43 @@ | ||
param ([string] $version, [string] $longVersion) | ||
$ErrorActionPreference = "Stop" | ||
|
||
If ( $version -eq "" ) { | ||
Write-Error "No version parameter was passed in." | ||
Exit 1 | ||
} | ||
If ( $longVersion -eq "" ) { | ||
Write-Error "No longVersion parameter was passed in." | ||
Exit 1 | ||
} | ||
|
||
$DIR = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" | ||
|
||
# Create chocolatey template | ||
|
||
$TEMPLATE_DIR = "$env:ChocolateyInstall\templates\neko-template" | ||
|
||
If ( Test-Path -Path $TEMPLATE_DIR) { | ||
Get-ChildItem -Path $TEMPLATE_DIR -File | foreach { $_.Delete()} | ||
} Else { | ||
New-Item -Path $TEMPLATE_DIR -ItemType "directory" -Force > $null | ||
} | ||
|
||
Copy-Item -Path $DIR\* -Recurse -Include neko.nuspec,tools -Destination $TEMPLATE_DIR -Force | ||
Copy-Item .\LICENSE $TEMPLATE_DIR\tools\LICENSE | ||
|
||
# Create package contents from template | ||
|
||
$file32 = ".\WinVS2017Binaries\neko-$version-win.zip" | ||
$file64 = ".\WinVS2017x64Binaries\neko-$version-win64.zip" | ||
|
||
$checksum32 = (Get-FileHash $file32).Hash.ToLower() | ||
$checksum64 = (Get-FileHash $file64).Hash.ToLower() | ||
|
||
choco new neko -t neko-template --version $longVersion --out $DIR --force Checksum32=$checksum32 Checksum64=$checksum64 ShortVersion=$version | ||
Copy-Item -Path $file32,$file64 -Destination $DIR\neko | ||
|
||
# Package everything | ||
|
||
$OUTPUT = "$DIR\pack" | ||
New-Item -Path $OUTPUT -ItemType "directory" -Force > $null | ||
choco pack --version $longVersion $DIR\neko\neko.nuspec -Out $OUTPUT |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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,31 @@ | ||
$ErrorActionPreference = "Stop" | ||
# set variables | ||
$shortVersion = '[[ShortVersion]]' | ||
|
||
$packDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition | Split-Path -Parent)" | ||
|
||
$packageArgs = @{ | ||
PackageName = 'neko' | ||
UnzipLocation = "$packDir" | ||
Url = "$packDir\neko-$shortVersion-win.zip" | ||
Checksum = '[[Checksum32]]' | ||
ChecksumType = 'sha256' | ||
Url64bit = "$packDir\neko-$shortVersion-win64.zip" | ||
Checksum64 = '[[Checksum64]]' | ||
ChecksumType64 = 'sha256' | ||
} | ||
|
||
Install-ChocolateyZipPackage @packageArgs | ||
|
||
$nekoDir = "$(Get-Item "$packDir/neko-$shortVersion-win*" -Exclude "*.zip")" | ||
|
||
# Install the dll files to C:\ProgramData\chocolatey\bin | ||
# It is because they are loaded by other neko binaries, e.g. haxelib.exe | ||
$chocoBin = Join-Path $env:ChocolateyInstall 'bin' | ||
$dllFiles = @('gcmt-dll.dll', 'neko.dll') | ||
foreach ($file in $dllFiles) { | ||
Copy-Item "$nekoDir\$file" "$chocoBin" | ||
} | ||
|
||
# Set NEKOPATH such that the ndll files can be loaded. | ||
Install-ChocolateyEnvironmentVariable -VariableName NEKOPATH -VariableValue $nekoDir |
File renamed without changes.