From 4c3c9bd2ae52001b876df97a7d77f6755efe828d Mon Sep 17 00:00:00 2001 From: arman hossiny <42970068+armanhossiny@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:38:13 +0330 Subject: [PATCH 1/2] Enable default aidl file to project especially for In-app purchases (#1620) --- templates/cpp-template-default/proj.android/app/build.gradle | 4 ++++ templates/lua-template-default/proj.android/app/build.gradle | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/templates/cpp-template-default/proj.android/app/build.gradle b/templates/cpp-template-default/proj.android/app/build.gradle index cc1ab50a5ea4..c93e9405c10f 100644 --- a/templates/cpp-template-default/proj.android/app/build.gradle +++ b/templates/cpp-template-default/proj.android/app/build.gradle @@ -86,6 +86,10 @@ android { aaptOptions { noCompress 'mp3','ogg','wav','mp4','ttf','ttc' } + + buildFeatures { + aidl true + } } android.applicationVariants.configureEach { variant -> diff --git a/templates/lua-template-default/proj.android/app/build.gradle b/templates/lua-template-default/proj.android/app/build.gradle index 5735bc41f785..f4a2e5f07398 100644 --- a/templates/lua-template-default/proj.android/app/build.gradle +++ b/templates/lua-template-default/proj.android/app/build.gradle @@ -86,6 +86,10 @@ android { aaptOptions { noCompress 'mp3','ogg','wav','mp4','ttf','ttc' } + + buildFeatures { + aidl true + } } android.applicationVariants.configureEach { variant -> From 8ee68b58c96031fbe94aea72c7b3d8ec94a7b1da Mon Sep 17 00:00:00 2001 From: halx99 Date: Fri, 19 Jan 2024 20:33:40 +0800 Subject: [PATCH 2/2] Bump 2.1.0 --- .github/FUNDING.yml | 13 +++ .github/workflows/publish.yml | 3 - 1k/build.ps1 | 110 +++++++++--------- 1k/{versionex.ps1 => extensions.ps1} | 15 +++ .../AXPlatform.cmake => 1k/platform.cmake | 4 +- CHANGELOG.md | 1 + cmake/Modules/AXBuildSet.cmake | 3 +- cmake/Modules/AXConfigDefine.cmake | 3 +- cmake/Modules/AXLinkHelpers.cmake | 5 +- setup.ps1 | 2 +- thirdparty/angle/CMakeLists.txt | 2 +- thirdparty/c-ares/CMakeLists.txt | 2 +- thirdparty/curl/CMakeLists.txt | 2 +- thirdparty/jpeg-turbo/CMakeLists.txt | 2 +- thirdparty/lua/luajit/CMakeLists.txt | 2 +- thirdparty/openssl/CMakeLists.txt | 2 +- thirdparty/zlib/CMakeLists.txt | 2 +- tools/ci/make-pkg.ps1 | 2 +- tools/console/axmol.ps1 | 2 +- 19 files changed, 100 insertions(+), 77 deletions(-) create mode 100644 .github/FUNDING.yml rename 1k/{versionex.ps1 => extensions.ps1} (91%) rename cmake/Modules/AXPlatform.cmake => 1k/platform.cmake (91%) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000000..520da8290c72 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 01ff9bc151aa..ad5340f72752 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,6 @@ name: publish on: - workflow_run: - workflows: [build] - types: [completed] workflow_dispatch: # Inputs the workflow accepts. inputs: diff --git a/1k/build.ps1 b/1k/build.ps1 index 28da89f68fe4..271ebb745d0c 100644 --- a/1k/build.ps1 +++ b/1k/build.ps1 @@ -94,7 +94,7 @@ $exeSuffix = if ($HOST_OS -eq 0) { '.exe' } else { '' } $Script:cmake_generator = $null # import VersionEx -. (Join-Path $PSScriptRoot 'versionex.ps1') +. (Join-Path $PSScriptRoot 'extensions.ps1') class build1k { [void] println($msg) { @@ -301,6 +301,8 @@ $Global:is_darwin_embed_family = $Global:is_ios -or $Global:is_tvos -or $Global: $Global:is_darwin_family = $Global:is_mac -or $Global:is_darwin_embed_family $Global:is_gh_act = "$env:GITHUB_ACTIONS" -eq 'true' +$Script:cmake_ver = '' + if (!$is_wasm) { $TARGET_CPU = $options.a if (!$TARGET_CPU) { @@ -665,7 +667,7 @@ function setup_ninja() { function setup_cmake($skipOS = $false) { $cmake_prog, $cmake_ver = find_prog -name 'cmake' if ($cmake_prog -and (!$skipOS -or $cmake_prog.IndexOf($myRoot) -ne -1)) { - return $cmake_prog + return $cmake_prog, $cmake_ver } $cmake_root = $(Join-Path $external_prefix 'cmake') @@ -731,7 +733,7 @@ function setup_cmake($skipOS = $false) { if (($null -ne $cmake_bin) -and ($env:PATH.IndexOf($cmake_bin) -eq -1)) { $env:PATH = "$cmake_bin$ENV_PATH_SEP$env:PATH" } - return $cmake_prog + return $cmake_prog, $cmake_ver } function ensure_cmake_ninja($cmake_prog, $ninja_prog) { @@ -1254,7 +1256,7 @@ function preprocess_andorid([string[]]$inputOptions) { $archs = $archlist -join ':' # TODO: modify gradle, split by ';' - $outputOptions += "-P__1K_CMAKE_VERSION=$($manifest['cmake'])" + $outputOptions += "-P__1K_CMAKE_VERSION=$($Script:cmake_ver.TrimLast('-'))" $outputOptions += "-P__1K_ARCHS=$archs" $outputOptions += '--parallel', '--info' } @@ -1374,7 +1376,7 @@ validHostAndToolchain $null = setup_glslcc -$cmake_prog = setup_cmake +$cmake_prog,$Script:cmake_ver = setup_cmake if ($Global:is_win_family) { find_vs_latest @@ -1394,7 +1396,7 @@ elseif ($Global:is_android) { $ninja_prog = setup_ninja # ensure ninja in cmake_bin if (!(ensure_cmake_ninja $cmake_prog $ninja_prog)) { - $cmake_prog = setup_cmake -Force + $cmake_prog,$Script:cmake_ver = setup_cmake -Force if (!(ensure_cmake_ninja $cmake_prog $ninja_prog)) { $b1k.println("Ensure ninja in cmake bin directory fail") } @@ -1576,10 +1578,9 @@ if (!$setupOnly) { $b1k.println("CONFIG_ALL_OPTIONS=$CONFIG_ALL_OPTIONS, Count={0}" -f $CONFIG_ALL_OPTIONS.Count) if ($Global:is_android -and $is_gradlew) { - $storedLocation = (Get-Location).Path $build_tool = (Get-Command $options.xt).Source $build_tool_dir = Split-Path $build_tool -Parent - Set-Location $build_tool_dir + Push-Location $build_tool_dir if (!$configOnly) { if ($optimize_flag -eq 'Debug') { & $build_tool assembleDebug $CONFIG_ALL_OPTIONS | Out-Host @@ -1591,65 +1592,64 @@ if (!$setupOnly) { else { & $build_tool tasks } - Set-Location $storedLocation + Pop-Location } else { # step3. configure - $workDir = $(Get-Location).Path - $mainDep = Join-Path $workDir 'CMakeLists.txt' - if (!$b1k.isfile($mainDep)) { - $b1k.println("Missing CMakeLists.txt in $workDir") - Set-Location $stored_cwd - return - } - - $mainDepChanged = $false - # A Windows file time is a 64-bit value that represents the number of 100-nanosecond - $tempFileItem = Get-Item $mainDep - $lastWriteTime = $tempFileItem.LastWriteTime.ToFileTimeUTC() - $tempFile = Join-Path $BUILD_DIR 'b1k_cache.txt' - - $storeHash = 0 - if ($b1k.isfile($tempFile)) { - $storeHash = Get-Content $tempFile -Raw - } - $hashValue = $b1k.hash("$CONFIG_ALL_OPTIONS#$lastWriteTime") - $mainDepChanged = "$storeHash" -ne "$hashValue" - $cmakeCachePath = $b1k.realpath("$BUILD_DIR/CMakeCache.txt") - - if ($mainDepChanged -or !$b1k.isfile($cmakeCachePath) -or $forceConfig) { - if (!$is_wasm) { - cmake -B $BUILD_DIR $CONFIG_ALL_OPTIONS | Out-Host + if ($b1k.isfile($mainDep)) { + $mainDepChanged = $false + # A Windows file time is a 64-bit value that represents the number of 100-nanosecond + $tempFileItem = Get-Item $mainDep + $lastWriteTime = $tempFileItem.LastWriteTime.ToFileTimeUTC() + $tempFile = Join-Path $BUILD_DIR 'b1k_cache.txt' + + $storeHash = 0 + if ($b1k.isfile($tempFile)) { + $storeHash = Get-Content $tempFile -Raw } - else { - emcmake cmake -B $BUILD_DIR $CONFIG_ALL_OPTIONS | Out-Host - } - Set-Content $tempFile $hashValue -NoNewline - } + $hashValue = $b1k.hash("$CONFIG_ALL_OPTIONS#$lastWriteTime") + $mainDepChanged = "$storeHash" -ne "$hashValue" + $cmakeCachePath = $b1k.realpath("$BUILD_DIR/CMakeCache.txt") - if (!$configOnly) { - if (!$is_engine) { - if (!$b1k.isfile($cmakeCachePath)) { - throw "The cmake generate incomplete, pelase add '-f' to re-generate again" + if ($mainDepChanged -or !$b1k.isfile($cmakeCachePath) -or $forceConfig) { + if (!$is_wasm) { + cmake -B $BUILD_DIR $CONFIG_ALL_OPTIONS | Out-Host + } + else { + emcmake cmake -B $BUILD_DIR $CONFIG_ALL_OPTIONS | Out-Host } + Set-Content $tempFile $hashValue -NoNewline } - # step4. build - # apply additional build options - $BUILD_ALL_OPTIONS += "--parallel" - if ($Global:is_linux) { - $BUILD_ALL_OPTIONS += "$(nproc)" - } - if (($cmake_generator -eq 'Xcode') -and ($BUILD_ALL_OPTIONS.IndexOf('--verbose') -eq -1)) { - $BUILD_ALL_OPTIONS += '--', '-quiet' - } - $b1k.println("BUILD_ALL_OPTIONS=$BUILD_ALL_OPTIONS, Count={0}" -f $BUILD_ALL_OPTIONS.Count) + if (!$configOnly) { + if (!$is_engine) { + if (!$b1k.isfile($cmakeCachePath)) { + Set-Location $stored_cwd + throw "The cmake generate incomplete, pelase add '-f' to re-generate again" + } + } - cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS | Out-Host + # step4. build + # apply additional build options + $BUILD_ALL_OPTIONS += "--parallel" + if ($Global:is_linux) { + $BUILD_ALL_OPTIONS += "$(nproc)" + } + if (($cmake_generator -eq 'Xcode') -and ($BUILD_ALL_OPTIONS.IndexOf('--verbose') -eq -1)) { + $BUILD_ALL_OPTIONS += '--', '-quiet' + } + $b1k.println("BUILD_ALL_OPTIONS=$BUILD_ALL_OPTIONS, Count={0}" -f $BUILD_ALL_OPTIONS.Count) + + cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS | Out-Host + } + } else { + $b1k.println("Missing CMakeLists.txt in $workDir") } } + + Set-Location $stored_cwd } else { # google gclient/gn build system # refer: https://chromium.googlesource.com/chromium/src/+/eca97f87e275a7c9c5b7f13a65ff8635f0821d46/tools/gn/docs/reference.md#args_specifies-build-arguments-overrides-examples @@ -1728,7 +1728,5 @@ if (!$setupOnly) { isHostTarget = $is_host_target compilerID = $TOOLCHAIN_NAME } - - Set-Location $stored_cwd } diff --git a/1k/versionex.ps1 b/1k/extensions.ps1 similarity index 91% rename from 1k/versionex.ps1 rename to 1k/extensions.ps1 index fea6e2cc416f..94ba6d36b8ae 100644 --- a/1k/versionex.ps1 +++ b/1k/extensions.ps1 @@ -201,6 +201,21 @@ namespace System return v1.CompareTo(v2) >= 0; } } + + public static class ExtensionMethods + { + public static string TrimLast(this Management.Automation.PSObject thiz, string separator) + { + var str = thiz.BaseObject as string; + var index = str.LastIndexOf(separator); + if (index != -1) + return str.Substring(0, index); + return str; + } + } } "@ + +$TrimLastMethod = [ExtensionMethods].GetMethod('TrimLast') +Update-TypeData -TypeName System.String -MemberName TrimLast -MemberType CodeMethod -Value $TrimLastMethod } diff --git a/cmake/Modules/AXPlatform.cmake b/1k/platform.cmake similarity index 91% rename from cmake/Modules/AXPlatform.cmake rename to 1k/platform.cmake index 54e0688017cc..6e1ea45cd88c 100644 --- a/cmake/Modules/AXPlatform.cmake +++ b/1k/platform.cmake @@ -69,8 +69,8 @@ elseif(CMAKE_GENERATOR MATCHES Visual) set(VS TRUE) endif() -function(ax_check_archs) +function(_1k_deprecated_32bit project_name release_ver) if(("${ARCH_ALIAS}" MATCHES "x86") OR ("${ARCH_ALIAS}" MATCHES "armeabi-v7a")) - message(WARNING "Building 32-bit[${ARCH_ALIAS}] axmol is deprecated, and will be removed in next release axmol-2.2.0") + message(WARNING "Building 32-bit[${ARCH_ALIAS}] ${project_name} is deprecated, and will be removed in next release ${release_ver}") endif() endfunction() diff --git a/CHANGELOG.md b/CHANGELOG.md index 9954b009c531..8f73d72ba4e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -124,6 +124,7 @@ - KEY_STORE_PASSWORD ==> KEY_STORE_PASSWORD - RELEASE_KEY_ALIAS ==> KEY_ALIAS - RELEASE_KEY_PASSWORD ==> KEY_PASSWORD +- Enable template projects' `aidl` by default for In-app purchases by @armanhossiny ### Break changes diff --git a/cmake/Modules/AXBuildSet.cmake b/cmake/Modules/AXBuildSet.cmake index cb62dca313db..92b521d06176 100644 --- a/cmake/Modules/AXBuildSet.cmake +++ b/cmake/Modules/AXBuildSet.cmake @@ -49,6 +49,7 @@ include(AXConfigDefine) # config libraries dependence include(AXConfigDepend) +message(AUTHOR_WARNING "CMAKE_VERSION:" ${CMAKE_VERSION}) message(STATUS "CMAKE_HOST_SYSTEM_NAME:" ${CMAKE_HOST_SYSTEM_NAME}) message(STATUS "CMAKE_SYSTEM_NAME:" ${CMAKE_SYSTEM_NAME}) message(STATUS "CMAKE_GENERATOR_PLATFORM:" ${CMAKE_GENERATOR_PLATFORM}) @@ -65,4 +66,4 @@ message(STATUS "PROJECT_BINARY_DIR:" ${PROJECT_BINARY_DIR}) message(STATUS "ENGINE_BINARY_PATH:" ${ENGINE_BINARY_PATH}) message(STATUS "ARCH_ALIAS:" ${ARCH_ALIAS}) -ax_check_archs() +_1k_deprecated_32bit(axmol 2.2.0) diff --git a/cmake/Modules/AXConfigDefine.cmake b/cmake/Modules/AXConfigDefine.cmake index 2f6dde47016a..4d97b1a1bf3f 100644 --- a/cmake/Modules/AXConfigDefine.cmake +++ b/cmake/Modules/AXConfigDefine.cmake @@ -1,5 +1,4 @@ - -include(AXPlatform) +include(${_AX_ROOT}/1k/platform.cmake) # custom target property for lua/js link define_property(TARGET diff --git a/cmake/Modules/AXLinkHelpers.cmake b/cmake/Modules/AXLinkHelpers.cmake index 6b9319d4c3f7..0a545a6743a3 100644 --- a/cmake/Modules/AXLinkHelpers.cmake +++ b/cmake/Modules/AXLinkHelpers.cmake @@ -1,6 +1,5 @@ -include(AXPlatform) - -ax_check_archs() +include(${_AX_ROOT}/1k/platform.cmake) +_1k_deprecated_32bit(axmol 2.2.0) if(NOT CMAKE_GENERATOR MATCHES "Ninja") set(BUILD_CONFIG_DIR "\$\(Configuration\)/") diff --git a/setup.ps1 b/setup.ps1 index 5d8c48cb8fc6..3764268b36d6 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -6,7 +6,7 @@ $AX_ROOT = $myRoot Set-Alias println Write-Host # import VersionEx -. (Join-Path $PSScriptRoot '1k/versionex.ps1') +. (Join-Path $PSScriptRoot '1k/extensions.ps1') $pwsh_ver = [VersionEx]$PSVersionTable.PSVersion.ToString() diff --git a/thirdparty/angle/CMakeLists.txt b/thirdparty/angle/CMakeLists.txt index 0392faf3546d..cdc0b5e789b2 100644 --- a/thirdparty/angle/CMakeLists.txt +++ b/thirdparty/angle/CMakeLists.txt @@ -3,7 +3,7 @@ set(lib_name angle) project(${lib_name}) -_1kfetch_dist(angle "${PARENT_DIRECTORY}/_deps") +_1kfetch_dist(angle) if(WINRT) # -----macro: set openssl sub target----- diff --git a/thirdparty/c-ares/CMakeLists.txt b/thirdparty/c-ares/CMakeLists.txt index 0a027b29430d..44cbc31ee5bb 100644 --- a/thirdparty/c-ares/CMakeLists.txt +++ b/thirdparty/c-ares/CMakeLists.txt @@ -3,7 +3,7 @@ set(target_name c-ares) project(${target_name}) -_1kfetch_dist(cares "${PARENT_DIRECTORY}/_deps") +_1kfetch_dist(cares) if(WINDOWS) add_library(${target_name} SHARED IMPORTED GLOBAL) diff --git a/thirdparty/curl/CMakeLists.txt b/thirdparty/curl/CMakeLists.txt index 886b01e235ab..873097f10636 100644 --- a/thirdparty/curl/CMakeLists.txt +++ b/thirdparty/curl/CMakeLists.txt @@ -3,7 +3,7 @@ set(target_name ${lib_name}) project(${lib_name}) -_1kfetch_dist(curl "${PARENT_DIRECTORY}/_deps") +_1kfetch_dist(curl) if(WINDOWS) add_library(${target_name} SHARED IMPORTED GLOBAL) diff --git a/thirdparty/jpeg-turbo/CMakeLists.txt b/thirdparty/jpeg-turbo/CMakeLists.txt index 62c959ec82b5..d5b45e3a67e5 100644 --- a/thirdparty/jpeg-turbo/CMakeLists.txt +++ b/thirdparty/jpeg-turbo/CMakeLists.txt @@ -4,7 +4,7 @@ set(target_name ${lib_name}) project(${lib_name}) -_1kfetch_dist(jpeg-turbo "${PARENT_DIRECTORY}/_deps") +_1kfetch_dist(jpeg-turbo) add_library(${target_name} STATIC IMPORTED GLOBAL) diff --git a/thirdparty/lua/luajit/CMakeLists.txt b/thirdparty/lua/luajit/CMakeLists.txt index 7f929d6839b3..ec26b282e6ab 100644 --- a/thirdparty/lua/luajit/CMakeLists.txt +++ b/thirdparty/lua/luajit/CMakeLists.txt @@ -3,7 +3,7 @@ set(lib_name luajit) set(target_name ${lib_name}) project(${lib_name}) -_1kfetch_dist(luajit "${PARENT_DIRECTORY}/_deps") +_1kfetch_dist(luajit) if(WINDOWS) add_library(${target_name} SHARED IMPORTED GLOBAL) diff --git a/thirdparty/openssl/CMakeLists.txt b/thirdparty/openssl/CMakeLists.txt index 96b531ec5243..c920bd00398b 100644 --- a/thirdparty/openssl/CMakeLists.txt +++ b/thirdparty/openssl/CMakeLists.txt @@ -3,7 +3,7 @@ set(lib_name openssl) project(${lib_name}) -_1kfetch_dist(openssl "${PARENT_DIRECTORY}/_deps") +_1kfetch_dist(openssl) set(OPENSSL_INCLUDE_DIR "${openssl_INC_DIR}" CACHE STRING "OpenSSL include dir" FORCE) diff --git a/thirdparty/zlib/CMakeLists.txt b/thirdparty/zlib/CMakeLists.txt index 7480ff400808..0d7afd673d47 100644 --- a/thirdparty/zlib/CMakeLists.txt +++ b/thirdparty/zlib/CMakeLists.txt @@ -1,7 +1,7 @@ set(target_name "zlib") project(${target_name}) -_1kfetch_dist(zlib "${PARENT_DIRECTORY}/_deps") +_1kfetch_dist(zlib) if(WINDOWS) add_library(${target_name} SHARED IMPORTED GLOBAL) diff --git a/tools/ci/make-pkg.ps1 b/tools/ci/make-pkg.ps1 index 997f23363d3f..329a1c84f509 100644 --- a/tools/ci/make-pkg.ps1 +++ b/tools/ci/make-pkg.ps1 @@ -90,7 +90,7 @@ function Compress-ArchiveEx() { } # import VersionEx - . (Join-Path $AX_ROOT '1k/versionex.ps1') + . (Join-Path $AX_ROOT '1k/extensions.ps1') if (([VersionEx]$PSVersionTable.PSVersion.ToString() -ge [VersionEx]'7.0') -and $IsWindows) { diff --git a/tools/console/axmol.ps1 b/tools/console/axmol.ps1 index ea0984122b93..2f8c935e3286 100644 --- a/tools/console/axmol.ps1 +++ b/tools/console/axmol.ps1 @@ -327,4 +327,4 @@ if ($args[0] -eq 'new') { } } -. $plugin.proc @sub_args @sub_opts +. $plugin.proc $sub_args @sub_opts