Complete NWJS build script

Former-commit-id: 7ce3f56a7f9fe3ba34cba65d9bbbd95b96d82790 [formerly 13a0ec4f2a794242b66c6b2ac5d805160bb637c1 [formerly 8a47ef042d63ddfebc242a66838dbaf27aa3c80f]]
Former-commit-id: 08202eb4f185dabb4d5a6aadb872cace2f42b5b9
Former-commit-id: b079a69764503cd4f657634d42ef3b2aff923d12
This commit is contained in:
Jaifroid 2021-01-19 22:59:52 +00:00
parent bd43ce83bd
commit 4eef8a5f1e

View File

@ -14,14 +14,31 @@ foreach ($build in $builds) {
$version = $versionXP
$sep = '-XP-'
}
$target = "bld\nwjs\$build-$version\kiwix_js_windows$sep$appBuild"
$folderTarget = "bld\nwjs\$build-$version"
$target = "$folderTarget\kiwix_js_windows$sep$appBuild"
$fullTarget = "$target-$build"
$buildLocation = "node_modules\nwjs-builder-phoenix\caches\nwjs-v$version-$build.zip-extracted\nwjs-v$version-$build\"
$ZipLocation = "node_modules\nwjs-builder-phoenix\caches\nwjs-v$version-$build.zip"
$UnzipLocation = "$ZipLocation-extracted\"
$buildLocation = "$ZipLocation-extracted\nwjs-v$version-$build\"
if (-Not (Test-Path $buildLocation -PathType Container)) {
# We need to download and/or unzip the release, as it is not available
if (-Not (Test-Path $ZipLocation -PathType Leaf)) {
$serverFile = "https://dl.nwjs.io/v$version/nwjs-v$version-$build.zip"
"Downloading $serverFile"
Invoke-WebRequest -Uri $serverFile -OutFile $ZipLocation
}
"Unzipping archive $ZipLocation"
Expand-Archive $ZipLocation $UnzipLocation
if (-Not (Test-Path $buildLocation -PathType Container)) {
"There was an error! The unzipped folder $buildLocation could not be found!"
return
}
}
$archiveFolder = "$fullTarget\archives"
if (Test-Path $fullTarget -PathType container) {
"Removing directory $fullTarget..."
rm $fullTarget\* -Recurse
rm $fullTarget
if (Test-Path $folderTarget -PathType Container) {
"Removing directory $folderTarget..."
rm $folderTarget\* -Recurse
rm $folderTarget
}
md $fullTarget
# Copy latest binary x64
@ -43,7 +60,13 @@ foreach ($build in $builds) {
$Shortcut.Arguments = "$foldername\nw.exe"
$Shortcut.IconLocation = '%windir%\explorer.exe,12'
$Shortcut.Save()
# Zip everything up
$ZipBuild = "bld\nwjs\$foldername.zip"
if (Test-Path $ZipBuild -PathType Leaf) {
"Deleting old Zip build $ZipBuild..."
del $ZipBuild
}
"Compressing folder..."
Compress-Archive "bld\nwjs\$build-$version\*" "bld\nwjs\$foldername.zip"
Compress-Archive "bld\nwjs\$build-$version\*" "bld\nwjs\$foldername.zip" -Force
"Build $OBuild finished.`n"
}