From 9036d58c586a7c0af66f03bb4b919b051b1054ee Mon Sep 17 00:00:00 2001 From: halx99 Date: Sat, 14 Dec 2024 02:07:56 +0800 Subject: [PATCH] Improve build profiles (#2273) - Add 1k/build.profiles for android ndk, sdk tools, emsdk ... - Android targetSdk and minSdk also control by 1k/build.profiles - You can override some build profiles in .axproj file, i.e android ndk, android target_sdk and min_sdk and others - support install ndk from ci.android.com --- 1k/1kiss.ps1 | 332 ++++++++++++------ 1k/build.profiles | 70 ++++ 1k/extensions.ps1 | 23 ++ 1k/fetch.cmake | 2 +- 1k/manifest.ps1 | 33 +- 1k/resolv-uri.ps1 | 17 - 1k/resolv-url.ps1 | 61 ++++ 1k/setup-msvc.ps1 | 23 -- README.md | 2 +- core/platform/android/libaxmol/axutils.gradle | 178 ++++++---- core/platform/android/libaxmol/build.gradle | 10 +- .../manual/platform/android/jni/LuaBridge.h | 6 +- setup.ps1 | 43 ++- .../common/proj.android/app/build.gradle | 28 +- .../common/proj.android/gradle.properties | 9 - tests/cpp-tests/.axproj | 3 + tests/cpp-tests/proj.android/app/build.gradle | 28 +- .../cpp-tests/proj.android/gradle.properties | 9 - tests/fairygui-tests/.axproj | 3 + .../proj.android/app/build.gradle | 28 +- .../proj.android/gradle.properties | 9 - tests/live2d-tests/.axproj | 3 + .../proj.android/app/build.gradle | 28 +- .../proj.android/gradle.properties | 9 - tests/lua-tests/.axproj | 3 + tests/lua-tests/proj.android/app/build.gradle | 28 +- .../lua-tests/proj.android/gradle.properties | 9 - tests/unit-tests/.axproj | 3 + .../unit-tests/proj.android/app/build.gradle | 28 +- .../unit-tests/proj.android/gradle.properties | 9 - tools/cmdline/build.ps1 | 2 +- 31 files changed, 681 insertions(+), 358 deletions(-) create mode 100644 1k/build.profiles delete mode 100644 1k/resolv-uri.ps1 create mode 100644 1k/resolv-url.ps1 delete mode 100644 1k/setup-msvc.ps1 create mode 100644 tests/cpp-tests/.axproj create mode 100644 tests/fairygui-tests/.axproj create mode 100644 tests/live2d-tests/.axproj create mode 100644 tests/lua-tests/.axproj create mode 100644 tests/unit-tests/.axproj diff --git a/1k/1kiss.ps1 b/1k/1kiss.ps1 index 77f3ab83f3b4..73d979d826f3 100644 --- a/1k/1kiss.ps1 +++ b/1k/1kiss.ps1 @@ -91,7 +91,7 @@ if ($Global:IsWin) { } } -# import VersionEx +# import VersionEx and others . (Join-Path $PSScriptRoot 'extensions.ps1') class _1kiss { @@ -191,6 +191,12 @@ class _1kiss { $stringAsStream.Position = 0 return (Get-FileHash -InputStream $stringAsStream -Algorithm MD5).Hash } + + [void] insert([ref]$arr, $item) { + if ($item -and !$arr.Value.Contains($item)) { + $arr.Value += $item + } + } } $1k = [_1kiss]::new() @@ -236,6 +242,8 @@ $channels = @{} # refer to: https://developer.android.com/studio#command-line-tools-only $cmdlinetools_rev = '11076708' # 12.0 +$ndk_r23d_rev = '12186248' + $android_sdk_tools = @{ 'build-tools' = '34.0.0' 'platforms' = 'android-34' @@ -641,6 +649,10 @@ function find_prog($name, $path = $null, $mode = 'ONLY', $cmd = $null, $params = if (!$usefv) { $verStr = $(. $cmd @params 2>$null) | Select-Object -First 1 + if ($LASTEXITCODE) { + Write-Warning '1kiss: Get version of $cmd fail' + $LASTEXITCODE = 0 + } if (!$verStr -or $verStr.Contains('--version')) { $verInfo = $cmd_info.Version $verStr = "$($verInfo.Major).$($verInfo.Minor).$($verInfo.Build)" @@ -708,17 +720,22 @@ function download_and_expand($url, $out, $dest) { download_file $url $out try { $1k.mkdirs($dest) - if ($out.EndsWith('.zip')) { - Expand-Archive -Path $out -DestinationPath $dest + if($out.EndsWith('.zip')) { + if($IsWin) { + Expand-Archive -Path $out -DestinationPath $dest + } + else { + unzip -d $dest $out | Out-Null + } } elseif ($out.EndsWith('.tar.gz')) { - tar xf "$out" -C $dest + tar xf "$out" -C $dest | Out-Host } elseif ($out.EndsWith('.7z') -or $out.EndsWith('.exe')) { - 7z x "$out" "-o$dest" -bsp1 -y | Out-Host + 7z x "$out" "-o$dest" -bsp1 -snld -y | Out-Host } elseif ($out.EndsWith('.sh')) { - chmod 'u+x' "$out" + chmod 'u+x' "$out" | Out-Host } if (!$?) { throw "1kiss: Expand fail" } } @@ -728,48 +745,47 @@ function download_and_expand($url, $out, $dest) { } } -function resolve_path ($path) { if ($1k.isabspath($path)) { $path } else { Join-Path $external_prefix $path } } -function fetch_pkg($url, $exrep = $null) { - $name = Split-Path $url -Leaf - $out = Join-Path $external_prefix $name - $dest = $external_prefix +function resolve_path ($path) { if ($1k.isabspath($path)) { $path } else { Join-Path $external_prefix $path } } + +function fetch_pkg($url, $out = $null, $exrep = $null, $prefix = $null) { + if (!$out) { $out = Join-Path $external_prefix $(Split-Path $url.Split('?')[0] -Leaf) } + else { $out = resolve_path $out } $pfn_rename = $null - - if ($exrep) { + + if($exrep) { $exrep = $exrep.Split('=') - if ($exrep.Count -eq 1) { - $dest = resolve_path $exrep[0] - $inst_loc = $dest + if ($exrep.Count -eq 1) { # single file + if (!$prefix) { + $prefix = resolve_path $exrep[0] + } else { + $prefix = resolve_path $prefix + } } else { - # >=2 - $dest = $external_prefix - $inst_loc = resolve_path $exrep[1] + $prefix = resolve_path $prefix + $inst_dst = Join-Path $prefix $exrep[1] $pfn_rename = { # move to plain folder name - $full_path = (Get-ChildItem -Path $external_prefix -Filter $exrep[0]).FullName + $full_path = (Get-ChildItem -Path $prefix -Filter $exrep[0]).FullName if ($full_path) { - $1k.mv($full_path, $inst_loc) + $1k.mv($full_path, $inst_dst) } else { - throw "1kiss: rename $($exrep[0]) to $inst_loc fail" + throw "1kiss: rename $($exrep[0]) to $inst_dst fail" } } + if ($1k.isdir($inst_dst)) { $1k.rmdirs($inst_dst) } } - } - else { - $dest = $external_prefix - $inst_loc = Join-Path $external_prefix $name + } else { + $prefix = $external_prefix } - if ($1k.isdir($inst_loc)) { $1k.rmdirs($inst_loc) } - download_and_expand $url $out $dest + download_and_expand $url $out $prefix if ($pfn_rename) { &$pfn_rename } } - # # Find latest installed: Visual Studio 12 2013 + # installationVersion @@ -811,11 +827,60 @@ function find_vs() { } } +function install_msvc($ver, $arch) { + +$__install_code = @' +# install specified msvc for vs2022 +param( + $ver = '14.39', + $arch = 'x64', + $vs_major = 17, + $vs_minor_base = 9, + $msvc_minor_base = 39 +) + +$msvc_minor = [int]$ver.Split('.')[1] +$vs_minor = $vs_minor_base + ($msvc_minor - $msvc_minor_base) +$vs_ver = "$vs_major.$vs_minor" + +$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" +$vs_installs = ConvertFrom-Json "$(&$vswhere -version "$vs_major.0" -format 'json')" + +$vs_installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe" +$vs_path = $vs_installs[0].installationPath + +$vs_arch = @{x64 = 'x86.x64'; x86 = 'x86.x64'; arm64 = 'ARM64'; arm = 'ARM' }[$arch] +$msvc_comp_id = "Microsoft.VisualStudio.Component.VC.$ver.$vs_ver.$vs_arch" # refer to: https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 +Write-Host "Installing $msvc_comp_id ..." +&$vs_installer modify --quiet --installPath $vs_path --add $msvc_comp_id | Out-Host + +if ($?) { + Write-Host "Install $msvc_comp_id success." +} +else { + Write-Error "Install $msvc_comp_id fail!" + exit 1 +} +'@ + $1k.println("Installing $ver', please press YES in UAC dialog, and don't close popup install window ...") + $__install_script = [System.IO.Path]::GetTempFileName() + '.ps1' + [System.IO.File]::WriteAllText($__install_script, $__install_code) + $process = Start-Process powershell -ArgumentList "-File `"`"$__install_script`"`" -ver $ver -arch $arch" -Verb runas -PassThru -Wait + $install_ret = $process.ExitCode + [System.IO.File]::Delete($__install_script) + + if ($install_ret -eq 0) { + $1k.println("Install msvc-$ver' succeed") + } else { + throw "Install msvc-$ver' fail!" + } +} + # setup nuget, not add to path function setup_nuget() { if (!$manifest['nuget']) { return $null } $nuget_bin = Join-Path $external_prefix 'nuget' - $nuget_prog, $nuget_ver = find_prog -name 'nuget' -path $nuget_bin -mode 'BOTH' -silent $true + $nuget_prog, $nuget_ver = find_prog -name 'nuget' -path $nuget_bin -mode 'BOTH' -params 'help' -silent $true if (!$nuget_prog) { $1k.rmdirs($nuget_bin) $1k.mkdirs($nuget_bin) @@ -870,7 +935,7 @@ function setup_axslcc() { } $glscc_base_url = $mirror_current.axslcc - fetch_pkg "$mirror_url_base$glscc_base_url/v$axslcc_ver/axslcc-$axslcc_ver-$suffix" $axslcc_bin + fetch_pkg "$mirror_url_base$glscc_base_url/v$axslcc_ver/axslcc-$axslcc_ver-$suffix" -exrep "axslcc" $axslcc_prog = (Join-Path $axslcc_bin "axslcc$EXE_SUFFIX") if ($1k.isfile($axslcc_prog)) { @@ -892,7 +957,7 @@ function setup_ninja() { $ninja_prog, $ninja_ver = find_prog -name 'ninja' -path $ninja_bin -silent $true if (!$ninja_prog) { - fetch_pkg "https://github.com/ninja-build/ninja/releases/download/v$ninja_ver/ninja-$suffix.zip" $ninja_bin + fetch_pkg "https://github.com/ninja-build/ninja/releases/download/v$ninja_ver/ninja-$suffix.zip" -exrep 'ninja' } $1k.addpath($ninja_bin) $ninja_prog = (Join-Path $ninja_bin "ninja$EXE_SUFFIX") @@ -1001,7 +1066,7 @@ function setup_nsis() { $nsis_prog, $nsis_ver = find_prog -name 'nsis' -cmd 'makensis' -params '/VERSION' -path $nsis_bin -silent $true if (!$nsis_prog) { - fetch_pkg "https://nchc.dl.sourceforge.net/project/nsis/NSIS%203/$nsis_ver/nsis-$nsis_ver.zip" "$nsis_bin-$nsis_ver=$nsis_bin" + fetch_pkg "https://nchc.dl.sourceforge.net/project/nsis/NSIS%203/$nsis_ver/nsis-$nsis_ver.zip" -exrep "nsis-$nsis_ver=nsis" } $1k.addpath($nsis_bin) $nsis_prog = (Join-Path $nsis_bin "makensis$EXE_SUFFIX") @@ -1052,7 +1117,7 @@ function setup_jdk() { $javac_prog, $jdk_ver = find_prog -name 'jdk' -cmd 'javac' -path $jdk_bin -silent $true if (!$javac_prog) { - fetch_pkg "https://aka.ms/download-jdk/microsoft-jdk-$jdk_ver-$suffix" "jdk-$jdk_ver+*=jdk" + fetch_pkg "https://aka.ms/download-jdk/microsoft-jdk-$jdk_ver-$suffix" -exrep "jdk-$jdk_ver+*=jdk" } $env:JAVA_HOME = $java_home @@ -1068,6 +1133,23 @@ function setup_jdk() { return $javac_prog } +function setup_unzip() { + if ($IsWin) { return } + $unzip_cmd_info = Get-Command 'unzip' -ErrorAction SilentlyContinue + if (!$unzip_cmd_info) { + elseif ($IsLinux) { + if ($(which dpkg)) { sudo apt install unzip } + } + elseif ($IsMacOS) { + brew install unzip + } + $unzip_cmd_info = Get-Command 'unzip' -ErrorAction SilentlyContinue + if (!$unzip_cmd_info) { + throw "setup unzip fail" + } + } +} + function setup_7z() { # ensure 7z_prog $7z_cmd_info = Get-Command '7z' -ErrorAction SilentlyContinue @@ -1104,7 +1186,7 @@ function setup_llvm() { $clang_prog, $clang_ver = find_prog -name 'llvm' -cmd "clang" -path $llvm_bin -silent $true if (!$clang_prog) { setup_7z - fetch_pkg "https://github.com/llvm/llvm-project/releases/download/llvmorg-${clang_ver}/LLVM-${clang_ver}-win64.exe" 'LLVM' + fetch_pkg "https://github.com/llvm/llvm-project/releases/download/llvmorg-${clang_ver}/LLVM-${clang_ver}-win64.exe" -exrep 'LLVM' $clang_prog, $clang_ver = find_prog -name 'llvm' -cmd "clang" -path $llvm_bin -silent $true if (!$clang_prog) { @@ -1130,7 +1212,10 @@ function setup_android_sdk() { $my_sdk_root = Join-Path $external_prefix 'adt/sdk' - $sdk_dirs = @("$env:ANDROID_HOME", "$env:ANDROID_SDK_ROOT", $my_sdk_root) + $sdk_dirs = @() + $1k.insert([ref]$sdk_dirs, $env:ANDROID_HOME) + $1k.insert([ref]$sdk_dirs, $env:ANDROID_SDK_ROOT) + $1k.insert([ref]$sdk_dirs, $my_sdk_root) $ndk_minor_base = [int][char]'a' @@ -1184,72 +1269,106 @@ function setup_android_sdk() { } } - if (!$1k.isdir("$ndk_root")) { - $sdkmanager_prog, $sdkmanager_ver = $null, $null - if ($1k.isdir($sdk_root)) { - $cmdlinetools_bin = Join-Path $sdk_root 'cmdline-tools/latest/bin' - $sdkmanager_prog, $sdkmanager_ver = (find_prog -name 'cmdlinetools' -cmd 'sdkmanager' -path $cmdlinetools_bin -params "--version", "--sdk_root=$sdk_root") - } - else { - $sdk_root = Join-Path $external_prefix 'adt/sdk' - if (!$1k.isdir($sdk_root)) { - $1k.mkdirs($sdk_root) - } + $sdk_comps = @() + + ### cmdline-tools ### + $sdkmanager_prog, $sdkmanager_ver = $null, $null + if ($1k.isdir($sdk_root)) { + $cmdlinetools_bin = Join-Path $sdk_root 'cmdline-tools/latest/bin' + $sdkmanager_prog, $sdkmanager_ver = (find_prog -name 'cmdlinetools' -cmd 'sdkmanager' -path $cmdlinetools_bin -params "--version", "--sdk_root=$sdk_root") + } + else { + $sdk_root = Join-Path $external_prefix 'adt/sdk' + if (!$1k.isdir($sdk_root)) { + $1k.mkdirs($sdk_root) } + } + if (!$sdkmanager_prog) { + $cmdlinetools_bin = Join-Path $external_prefix 'cmdline-tools/bin' + $sdkmanager_prog, $sdkmanager_ver = (find_prog -name 'cmdlinetools' -cmd 'sdkmanager' -path $cmdlinetools_bin -params "--version", "--sdk_root=$sdk_root") + $suffix = $('win', 'linux', 'mac').Get($HOST_OS) if (!$sdkmanager_prog) { - $cmdlinetools_bin = Join-Path $external_prefix 'cmdline-tools/bin' - $sdkmanager_prog, $sdkmanager_ver = (find_prog -name 'cmdlinetools' -cmd 'sdkmanager' -path $cmdlinetools_bin -params "--version", "--sdk_root=$sdk_root") - $suffix = $('win', 'linux', 'mac').Get($HOST_OS) + $1k.println("Installing cmdlinetools version: $sdkmanager_ver ...") + + $cmdlinetools_pkg_name = "commandlinetools-$suffix-$($cmdlinetools_rev)_latest.zip" + $cmdlinetools_pkg_path = Join-Path $external_prefix $cmdlinetools_pkg_name + $cmdlinetools_url = "https://dl.google.com/android/repository/$cmdlinetools_pkg_name" + download_file $cmdlinetools_url $cmdlinetools_pkg_path + Expand-Archive -Path $cmdlinetools_pkg_path -DestinationPath "$external_prefix/" + $sdkmanager_prog, $_ = (find_prog -name 'cmdlinetools' -cmd 'sdkmanager' -path $cmdlinetools_bin -params "--version", "--sdk_root=$sdk_root" -silent $True) if (!$sdkmanager_prog) { - $1k.println("Installing cmdlinetools version: $sdkmanager_ver ...") - - $cmdlinetools_pkg_name = "commandlinetools-$suffix-$($cmdlinetools_rev)_latest.zip" - $cmdlinetools_pkg_path = Join-Path $external_prefix $cmdlinetools_pkg_name - $cmdlinetools_url = "https://dl.google.com/android/repository/$cmdlinetools_pkg_name" - download_file $cmdlinetools_url $cmdlinetools_pkg_path - Expand-Archive -Path $cmdlinetools_pkg_path -DestinationPath "$external_prefix/" - $sdkmanager_prog, $_ = (find_prog -name 'cmdlinetools' -cmd 'sdkmanager' -path $cmdlinetools_bin -params "--version", "--sdk_root=$sdk_root" -silent $True) - if (!$sdkmanager_prog) { - throw "Install cmdlinetools version: $sdkmanager_ver fail" - } + throw "Install cmdlinetools version: $sdkmanager_ver fail" } } + } - $matchInfos = (exec_prog -prog $sdkmanager_prog -params "--sdk_root=$sdk_root", '--list' | Select-String 'ndk;') - if ($null -ne $matchInfos -and $matchInfos.Count -gt 0) { - $1k.println("Not found suitable android ndk, installing ...") - - $ndks = @{} - foreach ($matchInfo in $matchInfos) { - $fullVer = $matchInfo.Line.Trim().Split(' ')[0] # "ndk;23.2.8568313" - $verNums = $fullVer.Split(';')[1].Split('.') - $ndkVer = 'r' - $ndkVer += $verNums[0] - - $ndk_minor = [int]$verNums[1] - if ($ndk_minor -gt 0) { - $ndkVer += [char]($ndk_minor_base + $ndk_minor) - } - if (!$ndks.Contains($ndkVer)) { - $ndks.Add($ndkVer, $fullVer) + ### NDK ### + if (!$1k.isdir("$ndk_root")) { + $ndk_prefix = Join-Path $sdk_root 'ndk' + + if ($ndk_ver -eq 'r23d') { + # for android 15 16KB page size support, ndk-r23d only available on ci.android.com, refer: + # - https://developer.android.com/about/versions/15/behavior-changes-all#16-kb + # - https://developer.android.google.cn/about/versions/15/behavior-changes-all?hl=zh-cn#16-kb + # IF fail, you can visit download url by browser: + # - https://ci.android.com/builds/submitted/12186248/win64/latest/android-ndk-12186248-windows-x86_64.zip + # - https://ci.android.com/builds/submitted/12186248/linux/latest/android-ndk-12186248-linux-x86_64.zip + # - https://ci.android.com/builds/submitted/12186248/darwin_mac/latest/android-ndk-12186248-darwin-x86_64.zip + + $1k.println("Not found suitable android ndk, installing from ci.android.com ...") + + $_artifact = @("android-ndk-${ndk_r23d_rev}-windows-x86_64.zip", + "android-ndk-${ndk_r23d_rev}-linux-x86_64.zip", + "android-ndk-${ndk_r23d_rev}-darwin-x86_64.zip").Get($HOST_OS) + $_target_os = @('win64', 'linux', 'darwin_mac').Get($HOST_OS) + . (Join-Path $myRoot 'resolv-url.ps1') -artifact $_artifact -target $_target_os -build_id $ndk_r23d_rev -manifest gcloud -out_var 'artifact_info' + $artifact_url = $artifact_info[0].messageData + $full_ver = "23.3.${ndk_r23d_rev}" + $ndk_root = Join-Path $ndk_prefix $full_ver + fetch_pkg $artifact_url -o $_artifact -exrep "android-ndk-r23d-canary=$full_ver" -prefix $ndk_prefix + if (!$1k.isdir($ndk_root)) { throw "Install android-ndk-r23d fail, please try again" } + } + else { + $1k.println("Not found suitable android ndk, installing by sdkmanager ...") + + $matchInfos = (exec_prog -prog $sdkmanager_prog -params "--sdk_root=$sdk_root", '--list' | Select-String 'ndk;') + if ($null -ne $matchInfos -and $matchInfos.Count -gt 0) { + $ndks = @{} + foreach ($matchInfo in $matchInfos) { + $fullVer = $matchInfo.Line.Trim().Split(' ')[0] # "ndk;23.2.8568313" + $verNums = $fullVer.Split(';')[1].Split('.') + $ndkVer = 'r' + $ndkVer += $verNums[0] + + $ndk_minor = [int]$verNums[1] + if ($ndk_minor -gt 0) { + $ndkVer += [char]($ndk_minor_base + $ndk_minor) + } + if (!$ndks.Contains($ndkVer)) { + $ndks.Add($ndkVer, $fullVer) + } } - } - $ndkFullVer = $ndks[$ndk_ver] - - ((1..10 | ForEach-Object { "yes"; Start-Sleep -Milliseconds 100 }) | . $sdkmanager_prog --licenses --sdk_root=$sdk_root) | Out-Host - if (!$ndkOnly) { - exec_prog -prog $sdkmanager_prog -params '--verbose', "--sdk_root=$sdk_root", 'platform-tools', 'cmdline-tools;latest', "platforms;$($android_sdk_tools['platforms'])", "build-tools;$($android_sdk_tools['build-tools'])", $ndkFullVer | Out-Host - } - else { - exec_prog -prog $sdkmanager_prog -params '--verbose', "--sdk_root=$sdk_root", $ndkFullVer | Out-Host + $ndkFullVer = $ndks[$ndk_ver] + $full_ver = $ndkFullVer.Split(';')[1] + $ndk_root = Join-Path $ndk_prefix $full_ver + $sdk_comps += $ndkFullVer } - $fullVer = $ndkFullVer.Split(';')[1] - $ndk_root = (Resolve-Path -Path "$sdk_root/ndk/$fullVer").Path } } + if (!$ndkOnly -and $updateAdt) { + $sdk_comps += 'platform-tools', 'cmdline-tools;latest', "platforms;$($android_sdk_tools['platforms'])", "build-tools;$($android_sdk_tools['build-tools'])" + } + + if ($sdk_comps) { + $sdk_cmdline_args = '--verbose', "--sdk_root=$sdk_root" + $sdk_cmdline_args += $sdk_comps + ((1..10 | ForEach-Object { "yes"; Start-Sleep -Milliseconds 100 }) | . $sdkmanager_prog --licenses --sdk_root=$sdk_root) | Out-Host + exec_prog -prog $sdkmanager_prog -params $sdk_cmdline_args | Out-Host + } + return $sdk_root, $ndk_root } @@ -1577,9 +1696,8 @@ $proprocessTable = @{ validHostAndToolchain ########## setup build tools if not installed ####### - -$null = setup_axslcc - +setup_unzip +setup_axslcc | Out-Host $cmake_prog, $Script:cmake_ver = setup_cmake if ($Global:is_win_family) { @@ -1888,21 +2006,35 @@ if (!$setupOnly) { # apply additional build options $BUILD_ALL_OPTIONS += "--parallel", "$($options.j)" - if ($options.t) { $cmake_target = $options.t } - if ($cmake_target) { $BUILD_ALL_OPTIONS += '--target', $cmake_target } + $1k.println("BUILD_ALL_OPTIONS=$BUILD_ALL_OPTIONS, Count={0}" -f $BUILD_ALL_OPTIONS.Count) # forward non-cmake args to underlaying build toolchain, must at last + $forward_options = @() if (($cmake_generator -eq 'Xcode') -and !$BUILD_ALL_OPTIONS.Contains('--verbose')) { - $BUILD_ALL_OPTIONS += '--', '-quiet' + $forward_options += '--', '-quiet' } $1k.println("cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS") - cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS | Out-Host - if (!$?) { - Set-Location $stored_cwd - exit $LASTEXITCODE - } + if ($options.t) { $cmake_target = $options.t } + if ($cmake_target) { + $cmake_targets = $cmake_target.Split(',') | Sort-Object | Get-Unique + foreach ($target in $cmake_targets) { + cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS --target $target $forward_options | Out-Host + if (!$?) { + Set-Location $stored_cwd + exit $LASTEXITCODE + } + } + } + else { + cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS $forward_options | Out-Host + if (!$?) { + Set-Location $stored_cwd + exit $LASTEXITCODE + } + } + if ($options.i) { $install_args = @($BUILD_DIR, '--config', $optimize_flag) cmake --install $install_args | Out-Host diff --git a/1k/build.profiles b/1k/build.profiles new file mode 100644 index 000000000000..d45b3e4e7889 --- /dev/null +++ b/1k/build.profiles @@ -0,0 +1,70 @@ +# +# The cross platform build profiles, DO NOT MODIFY +# @hint means just for hint, not managed by axmol build system +# + +# --- region platfom:common + +# The axmol shader compiler, legacy name is 'glslcc' before axmol-2.3.0 +axslcc=1.9.6+ + +# The cmake, @gradle @axmol-cmdline +# as latest as possible +cmake=3.30.0~3.31.2+ + +# The ninja +ninja=1.10.0~1.12.1+ + +# --- endregion + +# --- region windows + +# The nuget, since 5.6.0, requires .net 4.0 +# DNT MODIFY +nuget=5.5.1.* + +# The visual studio version, @axmol-cmdline @verify +vs=17.0+ + +# --- endregion + +# region platform:android + +# The microsoft openjdk, @axmol-cmdline +jdk=17.0.10~17.0.13+ + +# The android ndk version +# as stable as possible @setup.ps1 @gradle @axmol-cmdline +ndk=r23c + +# The android target sdk version, @gradle +# as latest as possible +target_sdk=35 + +# The android min sdk version, @gradle +# as min as possible +min_sdk=17 + +# The gradle version, @setup.ps1 +# as latest as possible +gradle=8.10 + +# The android gradle plugin, @setup.ps1 +# as stable as possible, match with build-tools,android-studio +agp=8.6.0 + +# The android build-tools, @axmol-cmdline @gradle +# as stable as possible, match with agp,android-studio +build-tools=34.0.0 + +# The android-studio, @hint +# as latest as possible, but match with agp, build-tools +android-studio=2024.2.1+ + +# --- endregion + +# --- region platform:wasm + +emsdk=3.1.66~3.1.67 + +# --- endregion diff --git a/1k/extensions.ps1 b/1k/extensions.ps1 index 94ba6d36b8ae..081ebe894bcc 100644 --- a/1k/extensions.ps1 +++ b/1k/extensions.ps1 @@ -219,3 +219,26 @@ namespace System $TrimLastMethod = [ExtensionMethods].GetMethod('TrimLast') Update-TypeData -TypeName System.String -MemberName TrimLast -MemberType CodeMethod -Value $TrimLastMethod } + + +function ConvertFrom-Props { + param( + [Parameter(Mandatory=$true)] + $InputObject + ) + + $props = @{} + + foreach($_ in $InputObject) { + if ($_ -match "^#.*$") { + continue + } + if ($_ -match "^(.+?)\s*=\s*(.*)$") { + $key = $matches[1].Trim() + $value = $matches[2].Trim() + $props[$key] = $value + } + } + + return $props +} diff --git a/1k/fetch.cmake b/1k/fetch.cmake index 6fa0c0804fde..4fb7614260a9 100644 --- a/1k/fetch.cmake +++ b/1k/fetch.cmake @@ -25,7 +25,7 @@ function(_1kfetch_init) find_program(PWSH_PROG NAMES pwsh powershell NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) endif() - execute_process(COMMAND ${PWSH_PROG} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/resolv-uri.ps1 + execute_process(COMMAND ${PWSH_PROG} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/resolv-url.ps1 -name "1kdist" -manifest ${_1kfetch_manifest} OUTPUT_VARIABLE _1kdist_url diff --git a/1k/manifest.ps1 b/1k/manifest.ps1 index 5b59b13276a9..01eed51f92da 100644 --- a/1k/manifest.ps1 +++ b/1k/manifest.ps1 @@ -9,14 +9,27 @@ # add or overwrite tool version like follow if ($Global:is_axmol_app -or $Global:is_axmol_engine) { - $manifest['nuget'] = '5.5.1' # since 5.6.0, requires .net 4.0 - $manifest['axslcc'] = '1.9.6+' - $manifest['cmake'] = '3.29.3~3.30.5+' - $manifest['emsdk'] = '3.1.66~3.1.67+' - $manifest['jdk'] = '17.0.10~17.0.12+' - $manifest['vs'] = '16.0+' -} + # load cross platform build.profiles + $build_profiles_file = Join-Path $PSScriptRoot 'build.profiles' + $build_profiles = ConvertFrom-Props (Get-Content $build_profiles_file) + + $manifest['axslcc'] = $build_profiles['axslcc'] + $manifest['nuget'] = $build_profiles['nuget'] + $manifest['emsdk'] = $build_profiles['emsdk'] + $manifest['jdk'] = $build_profiles['jdk'] + + $manifest['ninja'] = $build_profiles['ninja'] + + $manifest['ndk'] = $build_profiles['ndk'] + $manifest['cmake'] = $build_profiles['cmake'] -# android sdk tools -$android_sdk_tools['build-tools'] = '34.0.0' # match with AGP-8.2.1+, android studio 2023.1.1+ -$android_sdk_tools['platforms'] = 'android-34' + $manifest['vs'] = $build_profiles['vs'] + + # android sdk tools + $android_sdk_tools['build-tools'] = $build_profiles['build-tools'] + $android_sdk_tools['platforms'] = "android-$($build_profiles['target_sdk'])" + + $Global:build_profiles = $build_profiles +} else { + $Global:build_profiles = @{} +} diff --git a/1k/resolv-uri.ps1 b/1k/resolv-uri.ps1 deleted file mode 100644 index 9a956b809858..000000000000 --- a/1k/resolv-uri.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -# fetch repo url by name -param( - $name, - $manifest_file -) - -if(Test-Path $manifest_file -PathType Leaf) { - $mirror = if (!(Test-Path (Join-Path $PSScriptRoot '.gitee') -PathType Leaf)) {'github'} else {'gitee'} - - $manifest_map = ConvertFrom-Json (Get-Content $manifest_file -raw) - $ver = $manifest_map.versions.PSObject.Properties[$name].Value - $mirror_current = $manifest_map.mirrors.PSObject.Properties[$mirror].Value.PSObject.Properties - $url_base = "https://$($mirror_current['host'].Value)/" - $url_path = $mirror_current[$name].Value - - Write-Host "$url_base$url_path#$ver" -NoNewline -} diff --git a/1k/resolv-url.ps1 b/1k/resolv-url.ps1 new file mode 100644 index 000000000000..ac4a1e889ff8 --- /dev/null +++ b/1k/resolv-url.ps1 @@ -0,0 +1,61 @@ +# resolve artifact url +param( + [Alias('artifact')] + $name, + $manifest, + $target, + $build_id, + $branch, + $out_var +) + +$artifact_url = $null + +if ($manifest -eq 'gcloud') { + function Get-LatestGoodBuild { + param ( + [string]$branch, + [string]$target + ) + + $apiURL = "https://androidbuildinternal.googleapis.com/android/internal/build/v3/builds?branches=$([uri]::EscapeDataString($branch))&buildAttemptStatus=complete&buildType=submitted&maxResults=1&successful=true&target=$([uri]::EscapeDataString($target))" + $body = Invoke-WebRequest -Uri $apiURL + $buildData = $body | ConvertFrom-Json + if ($buildData.builds.Count -eq 0) { + throw "No build ID is found" + } + return $buildData.builds[0].buildId + } + + # Validate input parameters + $artifact = $name + if (-not $target) { throw "Missing target." } + if (-not $artifact) { throw "Missing artifact." } + if (-not $build_id -and -not $branch) { throw "Missing build_id or branch." } + if (-not $build_id -and $branch) { + $build_id = Get-LatestGoodBuild -branch $branch -target $target + } + + $artifact_url = "https://androidbuildinternal.googleapis.com/android/internal/build/v3/builds/$([uri]::EscapeDataString($build_id))/$([uri]::EscapeDataString($target))/attempts/latest/artifacts/$([uri]::EscapeDataString($artifact))/url" +} +else { + if (Test-Path $manifest -PathType Leaf) { + $mirror = if (!(Test-Path (Join-Path $PSScriptRoot '.gitee') -PathType Leaf)) { 'github' } else { 'gitee' } + + $manifest_map = ConvertFrom-Json (Get-Content $manifest -raw) + $ver = $manifest_map.versions.PSObject.Properties[$name].Value + $mirror_current = $manifest_map.mirrors.PSObject.Properties[$mirror].Value.PSObject.Properties + $url_base = "https://$($mirror_current['host'].Value)/" + $url_path = $mirror_current[$name].Value + + $artifact_url = "$url_base$url_path#$ver" + } +} + +if($artifact_url) { + if(!$out_var) { + Write-Host $artifact_url -NoNewline + } else { + Write-Information $artifact_url -InformationVariable $out_var + } +} diff --git a/1k/setup-msvc.ps1 b/1k/setup-msvc.ps1 deleted file mode 100644 index eb06c162dbe8..000000000000 --- a/1k/setup-msvc.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -param( - $ver = '14.39', - $arch = 'x64' -) -$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -$vs_installs = ConvertFrom-Json "$(&$vswhere -version '17.0' -format 'json')" -$vs_installs -$vs_installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe" -$vs_path = $vs_installs[0].installationPath - -$vs_arch = @{x64 = 'x86.x64'; x86 = 'x86.x64'; arm64 = 'ARM64'; arm = 'ARM' }[$arch] -$msvc_comp_id = "Microsoft.VisualStudio.Component.VC.$ver.17.9.$vs_arch" # refer to: https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 -echo "Installing $msvc_comp_id ..." -&$vs_installer modify --quiet --installPath $vs_path --add $msvc_comp_id | Out-Host - -if ($?) { - echo 'setup msvc success.' -} -else { - echo 'setup msvc fail' -} - -exit $LASTEXITCODE diff --git a/README.md b/README.md index 351ffbb86f47..49113d4d8173 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ In order to see some of our community works, please check our Axmol Showcase: [M ## Reference links - [1kiss](https://github.com/simdsoft/1kiss): A cross-platform one step build powershell script, with auto setup general dependent tools. -- [axmolengine/glslcc](https://github.com/axmolengine/glslcc): A fork of glslcc, for Axmol new shader workflow tool. +- [axslcc](https://github.com/axmolengine/axslcc): A fork of `glslcc`, for Axmol new shader workflow tool. - [Official Cocos2d-x](https://github.com/cocos2d/cocos2d-x) ## Axmol Stats diff --git a/core/platform/android/libaxmol/axutils.gradle b/core/platform/android/libaxmol/axutils.gradle index a3a3cc66c364..3e8ee70b03e1 100644 --- a/core/platform/android/libaxmol/axutils.gradle +++ b/core/platform/android/libaxmol/axutils.gradle @@ -89,7 +89,7 @@ class VersionComparator implements Comparator { } } -class axutils { +class AxmolUtils { // @SuppressWarnings('unused') // static String getCoreLibsDir(project) { @@ -97,7 +97,13 @@ class axutils { // } @SuppressWarnings('unused') - static String[] findNativeBuildTools(project, cmakeVer = "3.23.0+", ndkVer = "23.2.8568313") { + static Map resolveBuildProfiles(project) { + def profiles = loadProfiles(project, true) + def buildProfiles = resolveBasicBuildProfiles(project, profiles) + + def cmakeVer = translateVer(profiles['cmake']) + def ndkVer = translateNdkVer(profiles['ndk']) + // cmakeVer should overwrite by command line if (project.properties.__1K_CMAKE_VERSION != null) cmakeVer = project.properties.__1K_CMAKE_VERSION @@ -110,7 +116,7 @@ class axutils { sdkRoot = localProps.getProperty("sdk.dir") println("Using sdk.dir=$sdkRoot from local.properties") } - catch(Exception ex) { + catch(ignored) { } if (sdkRoot == null || !new File(sdkRoot).isDirectory()) { @@ -129,13 +135,14 @@ class axutils { throw new Exception('Couldn\'t find android sdk. Specify path in local.properties or system env ANDROID_HOME') } - def rets = new ArrayList(5) // ndkVer,ndkPath,cmakeVer,cmakeOptions(AX_USE_XXX, AX_ENABLE_XXX, AX_ENABLE_EXT_XXX),cmakeDir - findNDK(sdkRoot, ndkVer, rets) - findCMake(sdkRoot, cmakeVer, rets) - parseCMakeOptions(project, rets) - def cmakeDir = rets[4] + // ndkVer,ndkPath,cmakeVer,cmakeOptions(AX_USE_XXX, AX_ENABLE_XXX, AX_ENABLE_EXT_XXX),cmakeDir + // def rets = new ArrayList(5) // + findNDK(sdkRoot, ndkVer, buildProfiles) + findCMake(sdkRoot, cmakeVer, buildProfiles) + parseCMakeOptions(project, buildProfiles) + def cmakeDir = buildProfiles['cmakeDir'] if (cmakeDir != null) { - def symlinkDir = joinPath(sdkRoot, 'cmake', rets[2]) + def symlinkDir = joinPath(sdkRoot, 'cmake', buildProfiles['cmakeVer']) def symlinkDirFile = new File(symlinkDir) if (!symlinkDirFile.exists()) { println "Creating symlinkd ${symlinkDir} ==> ${cmakeDir} ..." @@ -144,20 +151,89 @@ class axutils { println "The symlinkd ${symlinkDir} ==> ${cmakeDir} exist" } } - return rets + + // dump build profiles + println("---------- :${project.rootProject.name} build profiles ----------") + + buildProfiles.each { key, value -> + println("${key}=${value}") + } + + println("========== :${project.rootProject.name} build profiles ==========") + + return buildProfiles + } + + static Map resolveBasicBuildProfiles(project, profiles = null) { + def buildProfiles = [:] + + if (profiles == null) { + profiles = loadProfiles(project, false) + } + + buildProfiles['minSdk'] = profiles['min_sdk'] + buildProfiles['targetSdk'] = profiles['target_sdk'] + buildProfiles['packageName'] = profiles['package_name'] + + return buildProfiles + } + + private static Properties loadProfiles(project, isAxmolAppProj) { + // build.profiles in axmol engine + def profiles = new Properties() + try { + profiles.load(new File(Paths.get("${System.env.AX_ROOT}/1k/build.profiles").toUri()).newDataInputStream()) + } + catch(ignored) { + } + + if(isAxmolAppProj) { + // .axproj + Properties axprojProfiles = new Properties() + def axprojFile = joinPath(project.projectDir.absolutePath, "../../.axproj") + try { + axprojProfiles.load(new File(axprojFile).newDataInputStream()) + axprojProfiles.each { key, value -> + profiles[key] = value + } + } + catch (Exception ex) { + ex.printStackTrace() + throw new Exception("Missing axmol project file: $axprojFile") + } + } + + return profiles + } + + private static String translateNdkVer(ndkVer) { + def ndkMajor = ndkVer.replaceAll('[^0-9]', '') + def ndkMinorOff = ndkMajor.length() + 1 + + def ndkMinorBase = 'a'.'charAt'(0) + def ndkMinor = ndkMinorOff < ndkVer.length() ? + (ndkVer[ndkMinorOff].toCharacter().toString().'charAt'(0) - ndkMinorBase) : + '0' + + return "${ndkMajor}.${ndkMinor}" + } + + private static String translateVer(ver) { + def ver_arr = ver.split('~') + if (ver_arr.length == 1) { + return ver_arr[0] + } + return ver_arr[1].endsWith('+') ? "${ver_arr[0]}+" : ver_arr[0] } /** * Find suitable ndk for current project * @param project The current android project * @param ndkVer The required ndk version for current project - * @param rets - * @return + * @param buildProfiles */ - private static void findNDK(sdkRoot, ndkVer, rets) { - def allowNewerNdk = null + private static void findNDK(sdkRoot, ndkVer, buildProfiles) { if (ndkVer.endsWith('+')) { - allowNewerNdk = true ndkVer = ndkVer.substring(0, ndkVer.length() - 1) } @@ -170,7 +246,7 @@ class axutils { } verList.sort {a,b -> - return axutils.compareVersion(b, a) + return compareVersion(b, a) } def ndkDirs = [] @@ -182,26 +258,22 @@ class axutils { } /* Find suitable ndk in dirs */ - rets[0] = ndkVer - for (ndkDir in ndkDirs) { - if (findNDKInDir(ndkVer, allowNewerNdk, ndkDir, rets)) { + if (findNDKInDir(ndkVer, ndkDir, buildProfiles)) { return } } - println("No installed ndk found, the gradle will install ndk: $ndkVer automatically") - rets[1] = null + throw new Exception("No installed ndk found, required $ndkVer.*") } /** * Find suitable cmake for current project * @param project The current android project * @param cmakeVer The required cmake version of project - * @param rets - * @return + * @param buildProfiles */ - private static void findCMake(sdkRoot, String cmakeVer, rets) { + private static void findCMake(sdkRoot, String cmakeVer, buildProfiles) { def allowNewerCMake = false if(cmakeVer.endsWith('+')) { allowNewerCMake = true @@ -210,7 +282,6 @@ class axutils { def cmakeBinDirs = [] - def cmakeBinDir = null def verList = [] // Scan installed cmake in $sdk_root/cmake @@ -223,19 +294,19 @@ class axutils { // Sort cmake verList verList.sort {a,b -> - return axutils.compareVersion(b, a) + return compareVersion(b, a) } // Collect cmakeBinDirs for search for(ver in verList){ if (ver.startsWith('.')) continue - cmakeBinDir = joinPath(sdkRoot, "cmake", ver, "bin") + def cmakeBinDir = joinPath(sdkRoot, "cmake", ver, "bin") if(new File(cmakeBinDir).isDirectory()) { cmakeBinDirs.add(cmakeBinDir) } } - cmakeBinDir = getCMakeBinFromPath() + def cmakeBinDir = getCMakeBinFromPath() if(cmakeBinDir != null) { cmakeBinDirs.add(cmakeBinDir) } @@ -256,7 +327,7 @@ class axutils { if (index == (cmakeBinDirs.size() - 1)) { // using cmakeBinDir=axmol/tools/external/cmake/bin - rets[4] = joinPath(Paths.get("${System.env.AX_ROOT}").toAbsolutePath().toString(), 'tools', 'external', 'cmake') + buildProfiles['cmakeDir'] = joinPath(Paths.get("${System.env.AX_ROOT}").toAbsolutePath().toString(), 'tools', 'external', 'cmake') } if(foundCMakeVer == null) { @@ -264,14 +335,14 @@ class axutils { foundCMakeVer = cmakeVer } - rets[2] = foundCMakeVer + buildProfiles['cmakeVer'] = foundCMakeVer } private static String joinPath(String first, String... more) { return Paths.get(first, more).toString() } - private static void parseCMakeOptions(project, rets) { + private static void parseCMakeOptions(project, buildProfiles) { def options = [] for(item in project.properties) { if (item.key.startsWith('_1K_')) { @@ -284,45 +355,28 @@ class axutils { options.add('"-DANDROID_TOOLCHAIN=clang"') options.add('"-DANDROID_ARM_NEON=TRUE"') options.add("\"-D_AX_ANDROID_PROJECT_DIR=${androidProjDir}\"") - rets[3] = options + buildProfiles['cmakeOptions'] = options.toString() } private static int compareVersion(String ver1, String ver2) { return new VersionComparator().compare(ver1, ver2) } - private static String findNDKInDir(ndkVer, allowNewerNdk, ndkDir, rets) { - def found = null - def properties = new Properties() + private static boolean findNDKInDir(ndkVer, ndkDir, buildProfiles) { + def sourceProps = new Properties() File propertiesFile = new File("$ndkDir${File.separator}source.properties") try { - propertiesFile.withInputStream { - properties.load(it) - def foundNdkVer = properties['Pkg.Revision'] - def ret = axutils.compareVersion(foundNdkVer, ndkVer) - if (ret == 0) { - println("Using found ndk (revision=$foundNdkVer,path=$ndkDir)") - found = true - } else if (ret > 0) { - if (allowNewerNdk) { - println("Using found newer ndk (revision=$foundNdkVer,path=$ndkDir), (minimum required is: ${ndkVer})") - ndkVer = foundNdkVer - found = true - } else { - //throw new GradleException("The ndk ${ndkVer} is required, but $foundNdkVer found!") - } - } else { - //throw new GradleException("The ndk ${ndkVer}+ is required, but $foundNdkVer found!") - } + propertiesFile.withInputStream {sourceProps.load(it) } + def foundNdkVer = sourceProps['Pkg.Revision'] + if (foundNdkVer.startsWith(ndkVer)) { + println("Using found ndk (revision=$foundNdkVer,path=$ndkDir), require=$ndkVer") + buildProfiles['ndkVer'] = foundNdkVer + buildProfiles['ndkPath'] = ndkDir + return true } - } catch (Exception) { - } - if (found) { - rets[0] = ndkVer - rets[1] = ndkDir - return true + } catch (ignored) { } - return null + return false } private static String findCMakeFromBinDir(String cmakeVer, String cmakeBin, boolean allowNewerCMake) { @@ -349,7 +403,7 @@ class axutils { def foundVer = verInfo[2] def minusIdx = foundVer.indexOf('-') def canonVer = minusIdx == -1 ? foundVer : foundVer.substring(0, minusIdx) - def ret = axutils.compareVersion(canonVer, cmakeVer) + def ret = compareVersion(canonVer, cmakeVer) if (ret == 0) { println("Using found cmake ($canonVer,path=$programPath)") foundCMakeVer = canonVer @@ -403,4 +457,4 @@ class axutils { } } -ext.axutils = axutils +ext.AxmolUtils = AxmolUtils diff --git a/core/platform/android/libaxmol/build.gradle b/core/platform/android/libaxmol/build.gradle index a85b1fb2b223..a9b7e19a35b4 100644 --- a/core/platform/android/libaxmol/build.gradle +++ b/core/platform/android/libaxmol/build.gradle @@ -1,12 +1,16 @@ apply plugin: 'com.android.library' +apply from: 'axutils.gradle' android { namespace "dev.axmol.lib" - compileSdk PROP_COMPILE_SDK_VERSION.toInteger() + def buildProfiles = AxmolUtils.resolveBasicBuildProfiles(project) + def targetSdk = buildProfiles['targetSdk'] + def minSdk = buildProfiles['minSdk'] + compileSdk targetSdk.toInteger() defaultConfig { - minSdkVersion PROP_MIN_SDK_VERSION - targetSdkVersion PROP_TARGET_SDK_VERSION + minSdkVersion minSdk + targetSdkVersion targetSdk versionCode 1 versionName "1.0" } diff --git a/extensions/scripting/lua-bindings/manual/platform/android/jni/LuaBridge.h b/extensions/scripting/lua-bindings/manual/platform/android/jni/LuaBridge.h index 956c1e25017c..9e05e2deb4dd 100644 --- a/extensions/scripting/lua-bindings/manual/platform/android/jni/LuaBridge.h +++ b/extensions/scripting/lua-bindings/manual/platform/android/jni/LuaBridge.h @@ -22,8 +22,8 @@ THE SOFTWARE. ****************************************************************************/ -#ifndef SCRIPT_LUA_PLATFORM_ANDROID_JNI_JAVA_ORG_AXMOL_LIB_AXLUA_JAVA_BRIDEG_H -#define SCRIPT_LUA_PLATFORM_ANDROID_JNI_JAVA_ORG_AXMOL_LIB_AXLUA_JAVA_BRIDEG_H +#ifndef SCRIPT_LUA_PLATFORM_ANDROID_JNI_JAVA_dev_axmol_lib_AXLUA_JAVA_BRIDEG_H +#define SCRIPT_LUA_PLATFORM_ANDROID_JNI_JAVA_dev_axmol_lib_AXLUA_JAVA_BRIDEG_H #if defined(__ANDROID__) # include @@ -70,4 +70,4 @@ JNIEXPORT jint JNICALL Java_dev_axmol_lib_LuaBridge_releaseLuaFunction(JNIEnv* e #endif /// @endcond -#endif // SCRIPT_LUA_PLATFORM_ANDROID_JNI_JAVA_ORG_AXMOL_LIB_AXLUA_JAVA_BRIDEG_H +#endif // SCRIPT_LUA_PLATFORM_ANDROID_JNI_JAVA_dev_axmol_lib_AXLUA_JAVA_BRIDEG_H diff --git a/setup.ps1 b/setup.ps1 index ce4dbe932d0c..0952e7fdba51 100755 --- a/setup.ps1 +++ b/setup.ps1 @@ -3,7 +3,7 @@ # PowerShell Param statement : every line must end in #\ except the last line must with <#\ # And, you can't use backticks in this section #\ # refer https://gist.github.com/ryanmaclean/a1f3135f49c1ab3fa7ec958ac3f8babe #\ -param( [string]$gradlewVersion #\ +param( [switch]$updateAdt #\ ) <#\ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ` #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv @@ -366,21 +366,23 @@ if (!(Test-Path $prefix -PathType Container)) { # setup toolchains: glslcc, cmake, ninja, ndk, jdk, ... . $1k_script -setupOnly -prefix $prefix @args -if ($gradlewVersion) { +if ($updateAdt) { + # ---------- Update gradle ---------- + $gradleVer = $build_profiles['gradle'] $aproj_source_root = Join-Path $AX_ROOT 'templates/common/proj.android' $aproj_source_gradle = Join-Path $aproj_source_root 'build.gradle' $aproj_source_gradle_wrapper = Join-Path $aproj_source_root 'gradle/wrapper/' - $vernums = $gradlewVersion.Split('.') + $vernums = $gradleVer.Split('.') if ($vernums.Count -lt 3) { - $gradle_tag = "v$gradlewVersion.0" + $gradle_tag = "v$gradleVer.0" } else { - $gradle_tag = "v$gradlewVersion" + $gradle_tag = "v$gradleVer" } $gradle_settings_file = Join-Path $aproj_source_gradle_wrapper 'gradle-wrapper.properties' $settings_content = [System.IO.File]::ReadAllText($gradle_settings_file) - $settings_content = [Regex]::Replace($settings_content, 'gradle-.+-bin.zip', "gradle-$gradlewVersion-bin.zip") + $settings_content = [Regex]::Replace($settings_content, 'gradle-.+-bin.zip', "gradle-$gradleVer-bin.zip") [System.IO.File]::WriteAllText($gradle_settings_file, $settings_content) # download gradle-wrapper.jar gradlew and gradlew.bat from upstream @@ -397,11 +399,30 @@ if ($gradlewVersion) { Copy-Item (Join-Path $aproj_source_root 'gradlew.bat') $aproj_root -Force } - update_gradle_for_test 'cpp-tests' - update_gradle_for_test 'fairygui-tests' - update_gradle_for_test 'live2d-tests' - update_gradle_for_test 'lua-tests' - update_gradle_for_test 'unit-tests' + $testList = @('cpp-tests', 'fairygui-tests', 'live2d-tests', 'lua-tests', 'unit-tests') + foreach($testName in $testList) { + update_gradle_for_test($testName) + } + + # ------- Update AGP -------- + $agpVer = $build_profiles['agp'] + + function update_agp($relPath) { + $aproj_root = Join-Path $AX_ROOT "$relPath/proj.android" + $build_gradle_file = Join-Path $aproj_root 'build.gradle' + $build_gradle_content = [System.IO.File]::ReadAllText($build_gradle_file) + $update_text = $build_gradle_content -replace '(\d+\.\d+\.\d+)', $agpVer + [System.IO.File]::WriteAllText($build_gradle_file, $update_text) + } + function update_agp_for_test($name) { + update_agp "tests/$name" + } + + update_agp('templates/common') + foreach($testName in $testList) { + update_gradle_for_test($testName) + update_agp_for_test($testName) + } } if ($IsLinux -and (Test-Path '/etc/wsl.conf' -PathType Leaf)) { diff --git a/templates/common/proj.android/app/build.gradle b/templates/common/proj.android/app/build.gradle index 2db12e3c7110..34f020f793cf 100644 --- a/templates/common/proj.android/app/build.gradle +++ b/templates/common/proj.android/app/build.gradle @@ -2,22 +2,26 @@ apply plugin: 'com.android.application' apply from: project(':libaxmol').projectDir.toString() + "/axutils.gradle" android { - namespace "dev.axmol.dummy" - compileSdk PROP_COMPILE_SDK_VERSION.toInteger() + // Resolve build profiles + def buildProfiles = AxmolUtils.resolveBuildProfiles(project) + def packageName = buildProfiles['packageName'] + def cmakeVer = buildProfiles['cmakeVer'] + def cmakeOptions = Eval.me(buildProfiles['cmakeOptions']) + def minSdk = buildProfiles['minSdk'] + def targetSdk = buildProfiles['targetSdk'] - // Setup native build tools: ndk & cmake - def nbtInfo = axutils.findNativeBuildTools(project, '3.28.1+') - ndkVersion = nbtInfo[0] - if(nbtInfo[1]) { - ndkPath = nbtInfo[1] + // Apply build profiles + namespace packageName + compileSdk targetSdk.toInteger() + ndkVersion = buildProfiles['ndkVer'] + if(buildProfiles.containsKey('ndkPath')) { + ndkPath = buildProfiles['ndkPath'] } - def cmakeVer = nbtInfo[2] - def cmakeOptions = Eval.me(nbtInfo[3]) defaultConfig { - applicationId "dev.axmol.dummy" - minSdkVersion PROP_MIN_SDK_VERSION - targetSdkVersion PROP_TARGET_SDK_VERSION + applicationId packageName + minSdkVersion minSdk + targetSdkVersion targetSdk versionCode 1 versionName "1.0" diff --git a/templates/common/proj.android/gradle.properties b/templates/common/proj.android/gradle.properties index 3c12f8636f9d..3121b8ced270 100644 --- a/templates/common/proj.android/gradle.properties +++ b/templates/common/proj.android/gradle.properties @@ -16,15 +16,6 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -XX\:+Heap # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -# Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=34 - -# Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=17 - -# Android SDK version that will be used as the latest version of android this application has been tested on -PROP_TARGET_SDK_VERSION=34 - # List of CPU architecture to build that application with # Available architectures (armeabi-v7a | arm64-v8a | x86 | x86_64) # To build for multiple architecture, use the `:` between them diff --git a/tests/cpp-tests/.axproj b/tests/cpp-tests/.axproj new file mode 100644 index 000000000000..4c28c43e1562 --- /dev/null +++ b/tests/cpp-tests/.axproj @@ -0,0 +1,3 @@ +package_name=dev.axmol.cpp_tests +engine_version=2.3.0 +project_type=cpp diff --git a/tests/cpp-tests/proj.android/app/build.gradle b/tests/cpp-tests/proj.android/app/build.gradle index cdde187542ef..0a48325fe480 100644 --- a/tests/cpp-tests/proj.android/app/build.gradle +++ b/tests/cpp-tests/proj.android/app/build.gradle @@ -2,22 +2,26 @@ apply plugin: 'com.android.application' apply from: project(':libaxmol').projectDir.toString() + "/axutils.gradle" android { - namespace "dev.axmol.cpp_tests" - compileSdk PROP_COMPILE_SDK_VERSION.toInteger() + // Resolve build profiles + def buildProfiles = AxmolUtils.resolveBuildProfiles(project) + def packageName = buildProfiles['packageName'] + def cmakeVer = buildProfiles['cmakeVer'] + def cmakeOptions = Eval.me(buildProfiles['cmakeOptions']) + def minSdk = buildProfiles['minSdk'] + def targetSdk = buildProfiles['targetSdk'] - // Setup native build tools: ndk & cmake - def nbtInfo = axutils.findNativeBuildTools(project) - ndkVersion = nbtInfo[0] - if(nbtInfo[1]) { - ndkPath = nbtInfo[1] + // Apply build profiles + namespace packageName + compileSdk targetSdk.toInteger() + ndkVersion = buildProfiles['ndkVer'] + if(buildProfiles.containsKey('ndkPath')) { + ndkPath = buildProfiles['ndkPath'] } - def cmakeVer = nbtInfo[2] - def cmakeOptions = Eval.me(nbtInfo[3]) defaultConfig { - applicationId "dev.axmol.cpp_tests" - minSdkVersion PROP_MIN_SDK_VERSION - targetSdkVersion PROP_TARGET_SDK_VERSION + applicationId packageName + minSdkVersion minSdk + targetSdkVersion targetSdk versionCode 1 versionName "1.0" diff --git a/tests/cpp-tests/proj.android/gradle.properties b/tests/cpp-tests/proj.android/gradle.properties index 3c12f8636f9d..3121b8ced270 100644 --- a/tests/cpp-tests/proj.android/gradle.properties +++ b/tests/cpp-tests/proj.android/gradle.properties @@ -16,15 +16,6 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -XX\:+Heap # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -# Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=34 - -# Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=17 - -# Android SDK version that will be used as the latest version of android this application has been tested on -PROP_TARGET_SDK_VERSION=34 - # List of CPU architecture to build that application with # Available architectures (armeabi-v7a | arm64-v8a | x86 | x86_64) # To build for multiple architecture, use the `:` between them diff --git a/tests/fairygui-tests/.axproj b/tests/fairygui-tests/.axproj new file mode 100644 index 000000000000..ae1d82590c1c --- /dev/null +++ b/tests/fairygui-tests/.axproj @@ -0,0 +1,3 @@ +package_name=dev.axmol.fairygui_tests +engine_version=2.3.0 +project_type=cpp diff --git a/tests/fairygui-tests/proj.android/app/build.gradle b/tests/fairygui-tests/proj.android/app/build.gradle index a082c2ce51da..3d76ebafd634 100644 --- a/tests/fairygui-tests/proj.android/app/build.gradle +++ b/tests/fairygui-tests/proj.android/app/build.gradle @@ -2,22 +2,26 @@ apply plugin: 'com.android.application' apply from: project(':libaxmol').projectDir.toString() + "/axutils.gradle" android { - namespace "dev.axmol.fairygui_tests" - compileSdk PROP_COMPILE_SDK_VERSION.toInteger() + // Resolve build profiles + def buildProfiles = AxmolUtils.resolveBuildProfiles(project) + def packageName = buildProfiles['packageName'] + def cmakeVer = buildProfiles['cmakeVer'] + def cmakeOptions = Eval.me(buildProfiles['cmakeOptions']) + def minSdk = buildProfiles['minSdk'] + def targetSdk = buildProfiles['targetSdk'] - // Setup native build tools: ndk & cmake - def nbtInfo = axutils.findNativeBuildTools(project) - ndkVersion = nbtInfo[0] - if(nbtInfo[1]) { - ndkPath = nbtInfo[1] + // Apply build profiles + namespace packageName + compileSdk targetSdk.toInteger() + ndkVersion = buildProfiles['ndkVer'] + if(buildProfiles.containsKey('ndkPath')) { + ndkPath = buildProfiles['ndkPath'] } - def cmakeVer = nbtInfo[2] - def cmakeOptions = Eval.me(nbtInfo[3]) defaultConfig { - applicationId "dev.axmol.fairygui_tests" - minSdkVersion PROP_MIN_SDK_VERSION - targetSdkVersion PROP_TARGET_SDK_VERSION + applicationId packageName + minSdkVersion minSdk + targetSdkVersion targetSdk versionCode 1 versionName "1.0" diff --git a/tests/fairygui-tests/proj.android/gradle.properties b/tests/fairygui-tests/proj.android/gradle.properties index 19ca9f2755fc..ad96eb2bde8d 100644 --- a/tests/fairygui-tests/proj.android/gradle.properties +++ b/tests/fairygui-tests/proj.android/gradle.properties @@ -16,15 +16,6 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -XX\:+Heap # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -# Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=34 - -# Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=17 - -# Android SDK version that will be used as the latest version of android this application has been tested on -PROP_TARGET_SDK_VERSION=34 - # List of CPU architecture to build that application with # Available architectures (armeabi-v7a | arm64-v8a | x86 | x86_64) # To build for multiple architecture, use the `:` between them diff --git a/tests/live2d-tests/.axproj b/tests/live2d-tests/.axproj new file mode 100644 index 000000000000..2115b8af11d7 --- /dev/null +++ b/tests/live2d-tests/.axproj @@ -0,0 +1,3 @@ +package_name=dev.axmol.lua_tests +engine_version=2.3.0 +project_type=cpp diff --git a/tests/live2d-tests/proj.android/app/build.gradle b/tests/live2d-tests/proj.android/app/build.gradle index 94c6d58f6591..119576238702 100644 --- a/tests/live2d-tests/proj.android/app/build.gradle +++ b/tests/live2d-tests/proj.android/app/build.gradle @@ -2,22 +2,26 @@ apply plugin: 'com.android.application' apply from: project(':libaxmol').projectDir.toString() + "/axutils.gradle" android { - namespace "dev.axmol.live2d_tests" - compileSdk PROP_COMPILE_SDK_VERSION.toInteger() + // Resolve build profiles + def buildProfiles = AxmolUtils.resolveBuildProfiles(project) + def packageName = buildProfiles['packageName'] + def cmakeVer = buildProfiles['cmakeVer'] + def cmakeOptions = Eval.me(buildProfiles['cmakeOptions']) + def minSdk = buildProfiles['minSdk'] + def targetSdk = buildProfiles['targetSdk'] - // Setup native build tools: ndk & cmake - def nbtInfo = axutils.findNativeBuildTools(project) - ndkVersion = nbtInfo[0] - if(nbtInfo[1]) { - ndkPath = nbtInfo[1] + // Apply build profiles + namespace packageName + compileSdk targetSdk.toInteger() + ndkVersion = buildProfiles['ndkVer'] + if(buildProfiles.containsKey('ndkPath')) { + ndkPath = buildProfiles['ndkPath'] } - def cmakeVer = nbtInfo[2] - def cmakeOptions = Eval.me(nbtInfo[3]) defaultConfig { - applicationId "dev.axmol.live2d_tests" - minSdkVersion PROP_MIN_SDK_VERSION - targetSdkVersion PROP_TARGET_SDK_VERSION + applicationId packageName + minSdkVersion minSdk + targetSdkVersion targetSdk versionCode 1 versionName "1.0" diff --git a/tests/live2d-tests/proj.android/gradle.properties b/tests/live2d-tests/proj.android/gradle.properties index 3c12f8636f9d..3121b8ced270 100644 --- a/tests/live2d-tests/proj.android/gradle.properties +++ b/tests/live2d-tests/proj.android/gradle.properties @@ -16,15 +16,6 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -XX\:+Heap # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -# Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=34 - -# Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=17 - -# Android SDK version that will be used as the latest version of android this application has been tested on -PROP_TARGET_SDK_VERSION=34 - # List of CPU architecture to build that application with # Available architectures (armeabi-v7a | arm64-v8a | x86 | x86_64) # To build for multiple architecture, use the `:` between them diff --git a/tests/lua-tests/.axproj b/tests/lua-tests/.axproj new file mode 100644 index 000000000000..6537faf4be35 --- /dev/null +++ b/tests/lua-tests/.axproj @@ -0,0 +1,3 @@ +package_name=dev.axmol.cpp_tests +engine_version=2.3.0 +project_type=lua diff --git a/tests/lua-tests/proj.android/app/build.gradle b/tests/lua-tests/proj.android/app/build.gradle index 6227dc6bd9a6..36147e046a99 100644 --- a/tests/lua-tests/proj.android/app/build.gradle +++ b/tests/lua-tests/proj.android/app/build.gradle @@ -2,22 +2,26 @@ apply plugin: 'com.android.application' apply from: project(':libaxmol').projectDir.toString() + "/axutils.gradle" android { - namespace "dev.axmol.lua_tests" - compileSdk PROP_COMPILE_SDK_VERSION.toInteger() + // Resolve build profiles + def buildProfiles = AxmolUtils.resolveBuildProfiles(project) + def packageName = buildProfiles['packageName'] + def cmakeVer = buildProfiles['cmakeVer'] + def cmakeOptions = Eval.me(buildProfiles['cmakeOptions']) + def minSdk = buildProfiles['minSdk'] + def targetSdk = buildProfiles['targetSdk'] - // Setup native build tools: ndk & cmake - def nbtInfo = axutils.findNativeBuildTools(project) - ndkVersion = nbtInfo[0] - if(nbtInfo[1]) { - ndkPath = nbtInfo[1] + // Apply build profiles + namespace packageName + compileSdk targetSdk.toInteger() + ndkVersion = buildProfiles['ndkVer'] + if(buildProfiles.containsKey('ndkPath')) { + ndkPath = buildProfiles['ndkPath'] } - def cmakeVer = nbtInfo[2] - def cmakeOptions = Eval.me(nbtInfo[3]) defaultConfig { - applicationId "dev.axmol.lua_tests" - minSdkVersion PROP_MIN_SDK_VERSION - targetSdkVersion PROP_TARGET_SDK_VERSION + applicationId packageName + minSdkVersion minSdk + targetSdkVersion targetSdk versionCode 1 versionName "1.0" diff --git a/tests/lua-tests/proj.android/gradle.properties b/tests/lua-tests/proj.android/gradle.properties index 3c12f8636f9d..3121b8ced270 100644 --- a/tests/lua-tests/proj.android/gradle.properties +++ b/tests/lua-tests/proj.android/gradle.properties @@ -16,15 +16,6 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -XX\:+Heap # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -# Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=34 - -# Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=17 - -# Android SDK version that will be used as the latest version of android this application has been tested on -PROP_TARGET_SDK_VERSION=34 - # List of CPU architecture to build that application with # Available architectures (armeabi-v7a | arm64-v8a | x86 | x86_64) # To build for multiple architecture, use the `:` between them diff --git a/tests/unit-tests/.axproj b/tests/unit-tests/.axproj new file mode 100644 index 000000000000..25a019a1e969 --- /dev/null +++ b/tests/unit-tests/.axproj @@ -0,0 +1,3 @@ +package_name=dev.axmol.unit_tests +engine_version=2.3.0 +project_type=cpp diff --git a/tests/unit-tests/proj.android/app/build.gradle b/tests/unit-tests/proj.android/app/build.gradle index 1eb7e3e623d7..16b442ca9971 100644 --- a/tests/unit-tests/proj.android/app/build.gradle +++ b/tests/unit-tests/proj.android/app/build.gradle @@ -2,22 +2,26 @@ apply plugin: 'com.android.application' apply from: project(':libaxmol').projectDir.toString() + "/axutils.gradle" android { - namespace "dev.axmol.unit_tests" - compileSdk PROP_COMPILE_SDK_VERSION.toInteger() + // Resolve build profiles + def buildProfiles = AxmolUtils.resolveBuildProfiles(project) + def packageName = buildProfiles['packageName'] + def cmakeVer = buildProfiles['cmakeVer'] + def cmakeOptions = Eval.me(buildProfiles['cmakeOptions']) + def minSdk = buildProfiles['minSdk'] + def targetSdk = buildProfiles['targetSdk'] - // Setup native build tools: ndk & cmake - def nbtInfo = axutils.findNativeBuildTools(project) - ndkVersion = nbtInfo[0] - if(nbtInfo[1]) { - ndkPath = nbtInfo[1] + // Apply build profiles + namespace packageName + compileSdk targetSdk.toInteger() + ndkVersion = buildProfiles['ndkVer'] + if(buildProfiles.containsKey('ndkPath')) { + ndkPath = buildProfiles['ndkPath'] } - def cmakeVer = nbtInfo[2] - def cmakeOptions = Eval.me(nbtInfo[3]) defaultConfig { - applicationId "dev.axmol.unit_tests" - minSdkVersion PROP_MIN_SDK_VERSION - targetSdkVersion PROP_TARGET_SDK_VERSION + applicationId packageName + minSdkVersion minSdk + targetSdkVersion targetSdk versionCode 1 versionName "1.0" diff --git a/tests/unit-tests/proj.android/gradle.properties b/tests/unit-tests/proj.android/gradle.properties index 3c12f8636f9d..3121b8ced270 100644 --- a/tests/unit-tests/proj.android/gradle.properties +++ b/tests/unit-tests/proj.android/gradle.properties @@ -16,15 +16,6 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -XX\:+Heap # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -# Android SDK version that will be used as the compile project -PROP_COMPILE_SDK_VERSION=34 - -# Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=17 - -# Android SDK version that will be used as the latest version of android this application has been tested on -PROP_TARGET_SDK_VERSION=34 - # List of CPU architecture to build that application with # Available architectures (armeabi-v7a | arm64-v8a | x86 | x86_64) # To build for multiple architecture, use the `:` between them diff --git a/tools/cmdline/build.ps1 b/tools/cmdline/build.ps1 index de54589d2391..0eac43ad4884 100644 --- a/tools/cmdline/build.ps1 +++ b/tools/cmdline/build.ps1 @@ -96,7 +96,7 @@ if (!(Test-Path $1k_script -PathType Leaf)) { $source_proj_dir = if ($options.d) { $options.d } else { $workDir } $Global:is_axmol_engine = ($source_proj_dir -eq $AX_ROOT) -$Global:is_axmol_app = (Test-Path (Join-Path $source_proj_dir '.axproj.json') -PathType Leaf) +$Global:is_axmol_app = !!(Get-ChildItem (Join-Path $source_proj_dir '.axproj*')) $is_android = $options.p -eq 'android' # start construct full cmd line