6.7.0 - Alpha12 - 新增 Gradle 切换工具 (gradle-wrapper-switcher), 用于切换本地 Gradle 主版本

This commit is contained in:
SuperMonster003
2025-12-23 18:41:23 +08:00
parent e98c3c2c63
commit b1dcb59824
17 changed files with 1017 additions and 1 deletions

View File

@@ -28,7 +28,8 @@
"设置页面增加 \"应用启动器图标\" 设置选项, 支持自适应图标/透明背景图标 _[`issue #405`](http://issues.autojs6.com/405)_",
"设置页面增加 \"重启策略\" 设置选项, 用于设置主页抽屉栏重启按钮是否使用快速重启策略",
"设置页面启动器快捷方式增加 \"插件\" 选项, 用于通过快捷方式跳转到插件中心页面",
"Scrapers 工具 (run-scrapers.mjs) 用于自动更新 Gradle 构建脚本结构化数据/README 通用数据/README 模板数据等"
"Scrapers 工具 (run-scrapers.mjs) 用于自动更新 Gradle 构建脚本结构化数据/README 通用数据/README 模板数据等",
"Gradle Wrapper 切换工具 (gradle-wrapper-switcher), 用于切换本地 Gradle 主版本 (如 Gradle 8.x 与 Gradle 9.x)"
],
"fix": [
"notice 方法参数数量及类型限制错误 _[`issue #462`](http://issues.autojs6.com/462)_",

2
.gitignore vendored
View File

@@ -35,6 +35,8 @@ sync.ffs_db
/releases/
/tools/
/gradle/wrappers/backup/
/local.properties
/sign.properties
/*dependecies_tree.txt

View File

@@ -0,0 +1,161 @@
#!/usr/bin/env bash
set -euo pipefail
# Repo root = directory where this script lives
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
WRAPPERS_DIR="$ROOT_DIR/gradle/wrappers"
BACKUP_ROOT="$WRAPPERS_DIR/backup"
# Parse Gradle version from gradle-wrapper.properties (distributionUrl)
extract_version() {
local props="$1"
local url
url="$(grep -E '^\s*distributionUrl=' "$props" | head -n 1 | cut -d= -f2- || true)"
# Match: gradle-9.2.1-bin.zip / gradle-8.14.3-all.zip / gradle-9.0-rc-1-bin.zip
if [[ "$url" =~ gradle-([0-9A-Za-z.\-]+)-(bin|all)\.zip ]]; then
echo "${BASH_REMATCH[1]}"
else
echo "unknown"
fi
}
major_of() {
local v="$1"
# major = digits before first dot or dash
if [[ "$v" =~ ^([0-9]+) ]]; then
echo "${BASH_REMATCH[1]}"
else
echo "0"
fi
}
list_wrappers() {
shopt -s nullglob
local d
for d in "$WRAPPERS_DIR"/g[0-9]*; do
[[ -d "$d" ]] || continue
local name
name="$(basename "$d")"
[[ "$name" =~ ^g[0-9]+$ ]] || continue
local props="$d/gradle/wrapper/gradle-wrapper.properties"
local jar="$d/gradle/wrapper/gradle-wrapper.jar"
local sh="$d/gradlew"
local bat="$d/gradlew.bat"
[[ -f "$props" && -f "$jar" && -f "$sh" && -f "$bat" ]] || continue
local ver major
ver="$(extract_version "$props")"
major="$(major_of "$ver")"
printf "%s|%s|%s\n" "$name" "$major" "$ver"
done | sort -t'|' -k2,2n
}
backup_current() {
mkdir -p "$BACKUP_ROOT"
local stamp
stamp="$(date +%Y%m%d-%H%M%S)"
local dest="$BACKUP_ROOT/$stamp"
mkdir -p "$dest/gradle/wrapper"
# Backup only if exists
[[ -f "$ROOT_DIR/gradlew" ]] && cp -f "$ROOT_DIR/gradlew" "$dest/" || true
[[ -f "$ROOT_DIR/gradlew.bat" ]] && cp -f "$ROOT_DIR/gradlew.bat" "$dest/" || true
[[ -f "$ROOT_DIR/gradle/wrapper/gradle-wrapper.jar" ]] && cp -f "$ROOT_DIR/gradle/wrapper/gradle-wrapper.jar" "$dest/gradle/wrapper/" || true
[[ -f "$ROOT_DIR/gradle/wrapper/gradle-wrapper.properties" ]] && cp -f "$ROOT_DIR/gradle/wrapper/gradle-wrapper.properties" "$dest/gradle/wrapper/" || true
echo "Backed up current wrapper to: $dest"
# Cleanup old backups (keep last 10)
local backups
mapfile -t backups < <(ls -1dt "$BACKUP_ROOT"/*/ 2>/dev/null)
if [[ ${#backups[@]} -gt 10 ]]; then
local i
for ((i=10; i<${#backups[@]}; i++)); do
rm -rf "${backups[$i]}"
done
echo "Deleted $(( ${#backups[@]} - 10 )) old backup(s)."
fi
}
apply_wrapper() {
local wrapper_dir="$1"
# Try to stop current Gradle daemon (best-effort)
if [[ -x "$ROOT_DIR/gradlew" ]]; then
"$ROOT_DIR/gradlew" --stop >/dev/null 2>&1 || true
fi
backup_current
mkdir -p "$ROOT_DIR/gradle/wrapper"
cp -f "$wrapper_dir/gradlew" "$ROOT_DIR/gradlew"
cp -f "$wrapper_dir/gradlew.bat" "$ROOT_DIR/gradlew.bat"
cp -f "$wrapper_dir/gradle/wrapper/gradle-wrapper.jar" "$ROOT_DIR/gradle/wrapper/gradle-wrapper.jar"
cp -f "$wrapper_dir/gradle/wrapper/gradle-wrapper.properties" "$ROOT_DIR/gradle/wrapper/gradle-wrapper.properties"
chmod +x "$ROOT_DIR/gradlew" || true
}
usage() {
cat <<EOF
Usage:
./gradle-wrapper-switcher # interactive menu
./gradle-wrapper-switcher --use g9 # switch to a specific wrapper directory
./gradle-wrapper-switcher --list # list detected wrappers
EOF
}
main() {
[[ -d "$WRAPPERS_DIR" ]] || { echo "Wrappers directory not found: $WRAPPERS_DIR"; exit 1; }
if [[ "${1:-}" == "--list" ]]; then
list_wrappers | while IFS='|' read -r name major ver; do
echo "$name -> Gradle $major.x ($ver)"
done
exit 0
fi
if [[ "${1:-}" == "--use" ]]; then
local target="${2:-}"
[[ -n "$target" ]] || { usage; exit 1; }
local dir="$WRAPPERS_DIR/$target"
[[ -d "$dir" ]] || { echo "Wrapper not found: $dir"; exit 1; }
apply_wrapper "$dir"
local ver major
ver="$(extract_version "$dir/gradle/wrapper/gradle-wrapper.properties")"
major="$(major_of "$ver")"
echo "Switched to: Gradle $major.x ($ver) from $target"
echo "Tip: In IntelliJ IDEA or Android Studio, use \"Reload All Gradle Projects\" if needed."
exit 0
fi
# interactive
mapfile -t items < <(list_wrappers)
[[ "${#items[@]}" -gt 0 ]] || { echo "No valid wrappers found under: $WRAPPERS_DIR"; exit 1; }
echo "Please choose the Gradle version to switch to:"
local i=1
local names=()
local line name major ver
for line in "${items[@]}"; do
IFS='|' read -r name major ver <<<"$line"
names+=("$name")
echo "$i. Gradle ${major}.x (Pinned version: $ver)"
i=$((i+1))
done
echo -n "> "
read -r choice
[[ "$choice" =~ ^[0-9]+$ ]] || { echo "Invalid selection."; exit 1; }
(( choice>=1 && choice<=${#names[@]} )) || { echo "Out of range."; exit 1; }
local picked="${names[$((choice-1))]}"
apply_wrapper "$WRAPPERS_DIR/$picked"
local picked_ver
picked_ver="$(extract_version "$WRAPPERS_DIR/$picked/gradle/wrapper/gradle-wrapper.properties")"
echo "Switched to: Gradle ${picked//[^0-9]/}.x (Pinned version: $picked_ver)"
echo "Tip: In IntelliJ IDEA or Android Studio, use \"Reload All Gradle Projects\" if needed."
}
main "$@"

View File

@@ -0,0 +1,7 @@
@echo off
setlocal
set SCRIPT_DIR=%~dp0
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%gradle-wrapper-switcher.ps1" %*
echo.
pause
endlocal

View File

@@ -0,0 +1,130 @@
param(
[string]$Use,
[switch]$List
)
$RootDir = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
$WrappersDir = Join-Path $RootDir "gradle\wrappers"
$BackupRoot = Join-Path $WrappersDir "backup"
function Extract-Version([string]$PropsPath) {
$line = Select-String -Path $PropsPath -Pattern '^\s*distributionUrl=' | Select-Object -First 1
if (-not $line) { return "unknown" }
$url = ($line.Line -split '=', 2)[1]
$m = [regex]::Match($url, 'gradle-([0-9A-Za-z\.\-]+)-(bin|all)\.zip')
if ($m.Success) { return $m.Groups[1].Value }
return "unknown"
}
function Major-Of([string]$Version) {
$m = [regex]::Match($Version, '^(\d+)')
if ($m.Success) { return [int]$m.Groups[1].Value }
return 0
}
function Get-Wrappers() {
if (-not (Test-Path $WrappersDir)) { return @() }
Get-ChildItem -Path $WrappersDir -Directory |
Where-Object { $_.Name -match '^g\d+$' } |
ForEach-Object {
$dir = $_.FullName
$props = Join-Path $dir "gradle\wrapper\gradle-wrapper.properties"
$jar = Join-Path $dir "gradle\wrapper\gradle-wrapper.jar"
$sh = Join-Path $dir "gradlew"
$bat = Join-Path $dir "gradlew.bat"
if ((Test-Path $props) -and (Test-Path $jar) -and (Test-Path $sh) -and (Test-Path $bat)) {
$ver = Extract-Version $props
[pscustomobject]@{
Name = $_.Name
Dir = $dir
Ver = $ver
Major = (Major-Of $ver)
}
}
} | Sort-Object Major
}
function Backup-Current() {
New-Item -ItemType Directory -Force $BackupRoot | Out-Null
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
$dest = Join-Path $BackupRoot $stamp
New-Item -ItemType Directory -Force (Join-Path $dest "gradle\wrapper") | Out-Null
$files = @(
(Join-Path $RootDir "gradlew"),
(Join-Path $RootDir "gradlew.bat"),
(Join-Path $RootDir "gradle\wrapper\gradle-wrapper.jar"),
(Join-Path $RootDir "gradle\wrapper\gradle-wrapper.properties")
)
foreach ($f in $files) {
if (Test-Path $f) {
$rel = $f.Substring($RootDir.Length).TrimStart('\')
$target = Join-Path $dest $rel
$targetDir = Split-Path -Parent $target
New-Item -ItemType Directory -Force $targetDir | Out-Null
Copy-Item $f $target -Force
}
}
Write-Host "Backed up current wrapper to: $dest"
# Cleanup old backups (keep last 10)
$backups = Get-ChildItem -Path $BackupRoot -Directory | Sort-Object CreationTime
if ($backups.Count -gt 10) {
$toDelete = $backups.Count - 10
$backups | Select-Object -First $toDelete | Remove-Item -Recurse -Force
Write-Host "Deleted $toDelete old backup(s)."
}
}
function Apply-Wrapper([string]$WrapperDir) {
# best-effort stop
$gradlewBat = Join-Path $RootDir "gradlew.bat"
if (Test-Path $gradlewBat) {
cmd /c "`"$gradlewBat`" --stop" *> $null
}
Backup-Current
New-Item -ItemType Directory -Force (Join-Path $RootDir "gradle\wrapper") | Out-Null
Copy-Item (Join-Path $WrapperDir "gradlew") (Join-Path $RootDir "gradlew") -Force
Copy-Item (Join-Path $WrapperDir "gradlew.bat") (Join-Path $RootDir "gradlew.bat") -Force
Copy-Item (Join-Path $WrapperDir "gradle\wrapper\gradle-wrapper.jar") (Join-Path $RootDir "gradle\wrapper\gradle-wrapper.jar") -Force
Copy-Item (Join-Path $WrapperDir "gradle\wrapper\gradle-wrapper.properties") (Join-Path $RootDir "gradle\wrapper\gradle-wrapper.properties") -Force
}
$wrappers = Get-Wrappers
if ($List) {
$wrappers | ForEach-Object { Write-Host ("{0} -> Gradle {1}.x ({2})" -f $_.Name, $_.Major, $_.Ver) }
exit 0
}
if ($Use) {
$target = $wrappers | Where-Object { $_.Name -eq $Use } | Select-Object -First 1
if (-not $target) { Write-Error "Wrapper not found: $Use"; exit 1 }
Apply-Wrapper $target.Dir
Write-Host ("Switched to: {0}.x (Pinned version: {1})" -f ($target.Name -replace '\D', ''), $target.Ver)
Write-Host "Tip: In IntelliJ IDEA or Android Studio, use ""Reload All Gradle Projects"" if needed."
exit 0
}
if (-not $wrappers -or $wrappers.Count -eq 0) {
Write-Error "No valid wrappers found under: $WrappersDir"
exit 1
}
Write-Host "Please choose the Gradle version to switch to:"
for ($i=0; $i -lt $wrappers.Count; $i++) {
$w = $wrappers[$i]
Write-Host ("{0}. Gradle {1}.x (Pinned version: {2})" -f ($i+1), $w.Major, $w.Ver)
}
$choice = Read-Host "> "
if ($choice -notmatch '^\d+$') { Write-Error "Invalid selection."; exit 1 }
$idx = [int]$choice - 1
if ($idx -lt 0 -or $idx -ge $wrappers.Count) { Write-Error "Out of range."; exit 1 }
$picked = $wrappers[$idx]
Apply-Wrapper $picked.Dir
Write-Host ("Switched to: Gradle {0}.x (Pinned version: {1})" -f ($picked.Name -replace '\D', ''), $picked.Ver)
Write-Host "Tip: In IntelliJ IDEA or Android Studio, use ""Reload All Gradle Projects"" if needed."

Binary file not shown.

View File

@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

251
gradle/wrappers/g8/gradlew vendored Normal file
View File

@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

94
gradle/wrappers/g8/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Binary file not shown.

View File

@@ -0,0 +1,8 @@
#Mon Dec 22 12:46:26 GMT+8 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

251
gradle/wrappers/g9/gradlew vendored Normal file
View File

@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

94
gradle/wrappers/g9/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

3
gradle/wrappers/gradlew8 Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -euo pipefail
exec "$(dirname "$0")/g8/gradlew" "$@"

View File

@@ -0,0 +1,2 @@
@echo off
call "%~dp0\g8\gradlew.bat" %*

3
gradle/wrappers/gradlew9 Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -euo pipefail
exec "$(dirname "$0")/g9/gradlew" "$@"

View File

@@ -0,0 +1,2 @@
@echo off
call "%~dp0\g9\gradlew.bat" %*