diff --git a/.github/workflows/update-prebuilts.yml b/.github/workflows/update-prebuilts.yml index 8b2f089127..05ede34f69 100644 --- a/.github/workflows/update-prebuilts.yml +++ b/.github/workflows/update-prebuilts.yml @@ -4,9 +4,9 @@ on: workflow_dispatch: # Inputs the workflow accepts. inputs: - buildware_rel_tag: + build1k_rel_tag: # actions run ID - description: 'Please input buildware release tag, such as v41' + description: 'Please input build1k release tag, such as v57' # Default value if no value is explicitly provided default: '' # Input has to be provided for the workflow to run @@ -34,7 +34,7 @@ jobs: - name: Update prebuilts # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands - run: pwsh tools/ci/update-prebuilts.ps1 ${{ github.event.inputs.buildware_rel_tag }} + run: pwsh tools/ci/update-prebuilts.ps1 ${{ github.event.inputs.build1k_rel_tag }} - name: Create pull request if: ${{ env.AX_PREBUILTS_NO_UPDATE != 'true' }} @@ -43,13 +43,13 @@ jobs: with: token: ${{ secrets.AX_BOT_TOKEN }} push-to-fork: axmol-bot/axmol - commit-message: Update thirdparty prebuilts to ${{ github.event.inputs.buildware_rel_tag }} + commit-message: Update thirdparty prebuilts to ${{ github.event.inputs.build1k_rel_tag }} committer: 'GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>' author: 'axmol-bot ' signoff: false - branch: buildware_dist_${{ github.event.inputs.buildware_rel_tag }} + branch: buildware_dist_${{ github.event.inputs.build1k_rel_tag }} delete-branch: true - title: 'Update thirdparty prebuilts to ${{ github.event.inputs.buildware_rel_tag }}' + title: 'Update thirdparty prebuilts to ${{ github.event.inputs.build1k_rel_tag }}' body: | RT - Auto-generated by [create-pull-request][1] diff --git a/templates/cpp-template-default/Source/AppDelegate.cpp b/templates/cpp-template-default/Source/AppDelegate.cpp index f3592a180c..4952ee982f 100644 --- a/templates/cpp-template-default/Source/AppDelegate.cpp +++ b/templates/cpp-template-default/Source/AppDelegate.cpp @@ -62,6 +62,8 @@ static int register_all_packages() bool AppDelegate::applicationDidFinishLaunching() { + auto md4Val = utils::computeDigest("hello world", "md4"); + // initialize director auto director = Director::getInstance(); auto glView = director->getOpenGLView(); diff --git a/tools/ci/update-prebuilts.ps1 b/tools/ci/update-prebuilts.ps1 index 83b71556ee..0ae708518c 100644 --- a/tools/ci/update-prebuilts.ps1 +++ b/tools/ci/update-prebuilts.ps1 @@ -4,29 +4,48 @@ echo "VER=$VER" $AX_ROOT=(Resolve-Path "$PSScriptRoot/../..").Path echo "AX_ROOT=$AX_ROOT" -function update_lib -{ - $lib_name=$args[0] - $lib_folder=$args[1] - echo "lib_name=$lib_name" - $lib_dir="./thirdparty/$lib_folder$lib_name" - $prebuilt_dir="$lib_dir/prebuilt" - $inc_dir="$lib_dir/include" - - echo "Updating lib files for ${lib_dir} from ./tmp/buildware_dist_$VER/$lib_name ..." - rm -rf $prebuilt_dir - cp -r ./tmp/buildware_dist_$VER/$lib_name/prebuilt $lib_dir/ - - if ( Test-Path "./tmp/buildware_dist_$VER/$lib_name/include" -PathType Container ) { - echo "Update inc files for ${lib_dir}" - rm -rf $inc_dir - cp -r ./tmp/buildware_dist_$VER/$lib_name/include $lib_dir/ +$pwsh_ver = $PSVersionTable.PSVersion.ToString() + +function mkdirs([string]$path) { + if (!(Test-Path $path -PathType Container)) { + New-Item $path -ItemType Directory 1>$null } } -# start updating +function download_file($url, $out, $force = $false) { + if(Test-Path $out -PathType Leaf) { + if (!$force) { + return + } + Remove-Item $out + } + Write-Host "Downloading $url to $out ..." + if ($pwsh_ver -ge '7.0') { + curl -L $url -o $out + } + else { + Invoke-WebRequest -Uri $url -OutFile $out + } +} + +function download_and_expand($url, $out, $dest) { + download_file $url $out + if($out.EndsWith('.zip')) { + Expand-Archive -Path $out -DestinationPath $dest + } elseif($out.EndsWith('.tar.gz')) { + if (!$dest.EndsWith('/')) { + mkdirs $dest + } + tar xvf "$out" -C $dest + } elseif($out.EndsWith('.sh')) { + chmod 'u+x' "$out" + mkdirs $dest + } +} + +# download version manifest cd $AX_ROOT -mkdir -p ./tmp +mkdirs ./tmp # ensure yaml parser module if ($null -eq (Get-Module -ListAvailable -Name powershell-yaml)) { @@ -34,54 +53,72 @@ if ($null -eq (Get-Module -ListAvailable -Name powershell-yaml)) { } # check upstream prebuilts version -if (!(Test-Path ./tmp/verlist.yml -PathType Leaf)) { - curl -L https://github.com/axmolengine/buildware/releases/download/$VER/verlist.yml -o ./tmp/verlist.yml -} - +download_file "https://github.com/axmolengine/buildware/releases/download/$VER/verlist.yml" "./tmp/verlist.yml" $true $newVerList = ConvertFrom-Yaml -Yaml (Get-Content './tmp/verlist.yml' -raw) -$myVerList = ConvertFrom-Yaml -Yaml (Get-Content './thirdparty/prebuilts.yml' -raw) - -$needUpdate = $false; -foreach ($item in $myVerList.GetEnumerator() ) -{ - if ($item.Value -ne $newVerList[$item.Name]) { - $needUpdate = $true; - break; - } +if ($newVerList.GetType() -eq [string]) { + throw "Download version manifest file verlist.yml fail" } +$myVerList = ConvertFrom-Yaml -Yaml (Get-Content './thirdparty/prebuilts.yml' -raw) +$updateCount = 0 -if ($needUpdate) { - echo "Updating libs ..." +function update_lib +{ + $lib_name=$args[0] + $lib_folder=$args[1] + echo "lib_name=$lib_name" - # download buildware_dist_xxx.zip - if ( ! (Test-Path "./tmp/buildware_dist_$VER" -PathType Container) ) { - wget -O ./tmp/buildware_dist_$VER.zip https://github.com/axmolengine/buildware/releases/download/$VER/buildware_dist_$VER.zip - unzip ./tmp/buildware_dist_$VER.zip -d ./tmp/ + $myVer = $myVerList[$lib_name] + if ($newVerList[$lib_name] -eq $myVer) { + Write-Host "No update for lib: $lib_name, version: $myVer, skip it" + return } - # update libs - update_lib angle - update_lib curl - update_lib "jpeg-turbo" - update_lib openssl - update_lib zlib - update_lib luajit lua/ + $lib_dir="./thirdparty/$lib_folder$lib_name" + $prebuilt_dir="$lib_dir/prebuilt" + $inc_dir="$lib_dir/include" + + echo "Updating lib files for ${lib_dir} from ./tmp/package_$VER/$lib_name ..." - # update README.md - $content = $(Get-Content -Path ./thirdparty/README.md.in -raw) - foreach ($item in $newVerList.GetEnumerator() ) - { - $key = ([Regex]::Replace($item.Name, '-', '_')).ToUpper() - $key = "${key}_VERSION" - $content = $content -replace "\$\{$key\}",$item.Value + download_and_expand "https://github.com/axmolengine/build1k/releases/$VER/$lib_name.zip" "./tmp/package_$VER/$lib_name.zip" "./tmp/package_$VER" + + rm -rf $prebuilt_dir + cp -r ./tmp/package_$VER/$lib_name/prebuilt $lib_dir/ + + if ( Test-Path "./tmp/package_$VER/$lib_name/include" -PathType Container ) { + echo "Update inc files for ${lib_dir}" + rm -rf $inc_dir + cp -r ./tmp/package_$VER/$lib_name/include $lib_dir/ } - Set-Content -Path ./thirdparty/README.md -Value "$content" - Copy-Item -Path './tmp/verlist.yml' './thirdparty/prebuilts.yml' -Force -} else { + + ++$updateCount +} + +echo "Updating libs ..." + +$libs_list = @('angle', 'curl', 'jpeg-turbo', 'openssl', 'zlib') + +# update libs +foreach($lib_name in $libs_list) { + update_lib $lib_name +} + +update_lib luajit lua/ + +# update README.md +$content = $(Get-Content -Path ./thirdparty/README.md.in -raw) +foreach ($item in $newVerList.GetEnumerator() ) +{ + $key = ([Regex]::Replace($item.Name, '-', '_')).ToUpper() + $key = "${key}_VERSION" + $content = $content -replace "\$\{$key\}",$item.Value +} +Set-Content -Path ./thirdparty/README.md -Value "$content" +Copy-Item -Path './tmp/verlist.yml' './thirdparty/prebuilts.yml' -Force + +if ($updateCount -eq 0) { echo "No any lib need update." if ("$env.RUNNER_OS" -ne "") { echo "AX_PREBUILTS_NO_UPDATE=true" >> $GITHUB_ENV } } -