mirror of https://github.com/axmolengine/axmol.git
update-prebuilts.ps1
This commit is contained in:
parent
3b7e08d89c
commit
4c88a5e07f
|
@ -1,8 +1,13 @@
|
||||||
$VER=$args[0]
|
$VER=$args[0]
|
||||||
echo "VER=$VER"
|
|
||||||
|
function println($msg) {
|
||||||
|
Write-Host $msg
|
||||||
|
}
|
||||||
|
|
||||||
|
println "VER=$VER"
|
||||||
|
|
||||||
$AX_ROOT=(Resolve-Path "$PSScriptRoot/../..").Path
|
$AX_ROOT=(Resolve-Path "$PSScriptRoot/../..").Path
|
||||||
echo "AX_ROOT=$AX_ROOT"
|
println "AX_ROOT=$AX_ROOT"
|
||||||
|
|
||||||
$pwsh_ver = $PSVersionTable.PSVersion.ToString()
|
$pwsh_ver = $PSVersionTable.PSVersion.ToString()
|
||||||
|
|
||||||
|
@ -60,25 +65,23 @@ if ($newVerList.GetType() -eq [string]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$myVerList = ConvertFrom-Yaml -Yaml (Get-Content './thirdparty/prebuilts.yml' -raw)
|
$myVerList = ConvertFrom-Yaml -Yaml (Get-Content './thirdparty/prebuilts.yml' -raw)
|
||||||
$updateCount = 0
|
|
||||||
|
|
||||||
function update_lib
|
function update_lib
|
||||||
{
|
{
|
||||||
$lib_name=$args[0]
|
$lib_name=$args[0]
|
||||||
$lib_folder=$args[1]
|
$lib_folder=$args[1]
|
||||||
echo "lib_name=$lib_name"
|
|
||||||
|
|
||||||
$myVer = $myVerList[$lib_name]
|
$myVer = $myVerList[$lib_name]
|
||||||
if ($newVerList[$lib_name] -eq $myVer) {
|
if ($newVerList[$lib_name] -eq $myVer) {
|
||||||
Write-Host "No update for lib: $lib_name, version: $myVer, skip it"
|
println "No update for lib: $lib_name, version: $myVer, skip it"
|
||||||
return
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
$lib_dir="./thirdparty/$lib_folder$lib_name"
|
$lib_dir="./thirdparty/$lib_folder$lib_name"
|
||||||
$prebuilt_dir="$lib_dir/prebuilt"
|
$prebuilt_dir="$lib_dir/prebuilt"
|
||||||
$inc_dir="$lib_dir/include"
|
$inc_dir="$lib_dir/include"
|
||||||
|
|
||||||
echo "Updating lib files for ${lib_dir} from ./tmp/package_$VER/$lib_name ..."
|
println "Updating lib files for ${lib_dir} from ./tmp/package_$VER/$lib_name ..."
|
||||||
|
|
||||||
# https://github.com/axmolengine/build1k/releases/download/v57/angle.zip
|
# https://github.com/axmolengine/build1k/releases/download/v57/angle.zip
|
||||||
download_and_expand "https://github.com/axmolengine/build1k/releases/download/$VER/$lib_name.zip" "./tmp/package_$VER/$lib_name.zip" "./tmp/package_$VER"
|
download_and_expand "https://github.com/axmolengine/build1k/releases/download/$VER/$lib_name.zip" "./tmp/package_$VER/$lib_name.zip" "./tmp/package_$VER"
|
||||||
|
@ -87,24 +90,25 @@ function update_lib
|
||||||
Copy-Item ./tmp/package_$VER/$lib_name/prebuilt $lib_dir/ -Container -Recurse
|
Copy-Item ./tmp/package_$VER/$lib_name/prebuilt $lib_dir/ -Container -Recurse
|
||||||
|
|
||||||
if (Test-Path "./tmp/package_$VER/$lib_name/include" -PathType Container) {
|
if (Test-Path "./tmp/package_$VER/$lib_name/include" -PathType Container) {
|
||||||
echo "Update inc files for ${lib_dir}"
|
println "Update inc files for ${lib_dir}"
|
||||||
Remove-Item $inc_dir -Recurse -Force
|
Remove-Item $inc_dir -Recurse -Force
|
||||||
Copy-Item ./tmp/package_$VER/$lib_name/include $lib_dir/ -Container -Recurse
|
Copy-Item ./tmp/package_$VER/$lib_name/include $lib_dir/ -Container -Recurse
|
||||||
}
|
}
|
||||||
|
|
||||||
++$updateCount
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Updating libs ..."
|
println "Updating libs ..."
|
||||||
|
|
||||||
$libs_list = @('angle', 'curl', 'jpeg-turbo', 'openssl', 'zlib')
|
$libs_list = @('angle', 'curl', 'jpeg-turbo', 'openssl', 'zlib')
|
||||||
|
|
||||||
# update libs
|
# update libs
|
||||||
|
$updateCount = 0
|
||||||
foreach($lib_name in $libs_list) {
|
foreach($lib_name in $libs_list) {
|
||||||
update_lib $lib_name
|
$updateCount += $(update_lib $lib_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
update_lib luajit lua/
|
$updateCount += $(update_lib luajit lua/)
|
||||||
|
|
||||||
# update README.md
|
# update README.md
|
||||||
$content = $(Get-Content -Path ./thirdparty/README.md.in -raw)
|
$content = $(Get-Content -Path ./thirdparty/README.md.in -raw)
|
||||||
|
@ -118,8 +122,8 @@ Set-Content -Path ./thirdparty/README.md -Value "$content"
|
||||||
Copy-Item -Path './tmp/verlist.yml' './thirdparty/prebuilts.yml' -Force
|
Copy-Item -Path './tmp/verlist.yml' './thirdparty/prebuilts.yml' -Force
|
||||||
|
|
||||||
if ($updateCount -eq 0) {
|
if ($updateCount -eq 0) {
|
||||||
echo "No any lib need update."
|
println "No any lib need update."
|
||||||
if ("$env.RUNNER_OS" -ne "") {
|
if ("$env.RUNNER_OS" -ne "") {
|
||||||
echo "AX_PREBUILTS_NO_UPDATE=true" >> $GITHUB_ENV
|
Write-Output "AX_PREBUILTS_NO_UPDATE=true" >> $GITHUB_ENV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue