diff options
| author | Zephyron <zephyron@citron-emu.org> | 2025-01-13 15:17:39 +1000 | 
|---|---|---|
| committer | Zephyron <zephyron@citron-emu.org> | 2025-01-13 15:17:39 +1000 | 
| commit | 6d5475a9cf51feb36bb1a45d88b51182ede4a1f8 (patch) | |
| tree | cd1b0e93152d7fb5f59408495a0a4aad10f4bd66 /src/android | |
| parent | 2d7f9d921b3508a5c5effba5604aaea5620441ef (diff) | |
Android: Update build system and dependencies
- Update Gradle from 8.1 to 8.10.2
- Update Android Gradle Plugin from 8.1.2 to 8.8.0
- Update Kotlin from 1.9.20 to 2.1.20-Beta1
- Update various AndroidX dependencies to latest versions
- Update NDK from 26.1 to 27.2 (with RC1/RC2 options commented)
- Update Java target from 17 to 21
- Update Android target SDK from 34 to 35
- Enable additional optimizations in release builds:
  - Enable shrinkResources
  - Use proguard-android-optimize.txt
  - Disable JNI debugging
- Replace vector drawables with PNG for ic_citron
- Comment out unused ComputeInline constant in dma_pusher.cpp
- Update Gradle wrapper and configuration files
This updates the Android build system and dependencies to their latest
versions while enabling additional optimizations for release builds.
The ic_citron icon was converted from vector to PNG format for better
compatibility.
Diffstat (limited to 'src/android')
| -rw-r--r-- | src/android/app/build.gradle.kts | 56 | ||||
| -rw-r--r-- | src/android/app/src/main/res/drawable/ic_citron.png | bin | 0 -> 10453 bytes | |||
| -rw-r--r-- | src/android/app/src/main/res/drawable/ic_citron.xml | 22 | ||||
| -rw-r--r-- | src/android/app/src/main/res/drawable/ic_citron_full.png | bin | 0 -> 10453 bytes | |||
| -rw-r--r-- | src/android/app/src/main/res/drawable/ic_citron_full.xml | 12 | ||||
| -rw-r--r-- | src/android/app/src/main/res/drawable/ic_citron_title.png | bin | 0 -> 10453 bytes | |||
| -rw-r--r-- | src/android/app/src/main/res/drawable/ic_citron_title.xml | 24 | ||||
| -rw-r--r-- | src/android/build.gradle.kts | 8 | ||||
| -rw-r--r-- | src/android/gradle/wrapper/gradle-wrapper.jar | bin | 54708 -> 43504 bytes | |||
| -rw-r--r-- | src/android/gradle/wrapper/gradle-wrapper.properties | 5 | ||||
| -rwxr-xr-x | src/android/gradlew | 307 | ||||
| -rw-r--r-- | src/android/gradlew.bat | 96 | 
12 files changed, 269 insertions, 261 deletions
diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index 4965b9564..793a8621c 100644 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts @@ -10,10 +10,10 @@ plugins {      id("com.android.application")      id("org.jetbrains.kotlin.android")      id("kotlin-parcelize") -    kotlin("plugin.serialization") version "1.9.20" +    kotlin("plugin.serialization") version "2.1.20-Beta1"      id("androidx.navigation.safeargs.kotlin") -    id("org.jlleitschuh.gradle.ktlint") version "11.4.0" -    id("com.github.triplet.play") version "3.8.6" +    id("org.jlleitschuh.gradle.ktlint") version "12.1.2" +    id("com.github.triplet.play") version "3.12.1"  }  /** @@ -27,20 +27,20 @@ val autoVersion = (((System.currentTimeMillis() / 1000) - 1451606400) / 10).toIn  android {      namespace = "org.citron.citron_emu" -    compileSdkVersion = "android-34" -    ndkVersion = "26.1.10909125" +    compileSdkVersion = "android-35" +    ndkVersion = "27.2.12479018" // "28.0.12433566 rc1"// "28.0.12674087 rc2" // "26.1.10909125"      buildFeatures {          viewBinding = true      }      compileOptions { -        sourceCompatibility = JavaVersion.VERSION_17 -        targetCompatibility = JavaVersion.VERSION_17 +        sourceCompatibility = JavaVersion.VERSION_21 +        targetCompatibility = JavaVersion.VERSION_21      }      kotlinOptions { -        jvmTarget = "17" +        jvmTarget = "21"      }      packaging { @@ -56,7 +56,7 @@ android {          // TODO If this is ever modified, change application_id in strings.xml          applicationId = "org.citron.citron_emu"          minSdk = 30 -        targetSdk = 34 +        targetSdk = 35          versionName = getGitVersion()          versionCode = if (System.getenv("AUTO_VERSIONED") == "true") { @@ -104,10 +104,13 @@ android {              }              resValue("string", "app_name_suffixed", "citron") +            isDefault = true +            isShrinkResources = true              isMinifyEnabled = true +            isJniDebuggable = false              isDebuggable = false              proguardFiles( -                getDefaultProguardFile("proguard-android.txt"), +                getDefaultProguardFile("proguard-android-optimize.txt"),                  "proguard-rules.pro"              )          } @@ -115,13 +118,12 @@ android {          // builds a release build that doesn't need signing          // Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.          register("relWithDebInfo") { -            isDefault = true              resValue("string", "app_name_suffixed", "citron Debug Release")              signingConfig = signingConfigs.getByName("default")              isMinifyEnabled = true              isDebuggable = true              proguardFiles( -                getDefaultProguardFile("proguard-android.txt"), +                getDefaultProguardFile("proguard-android-optimize.txt"),                  "proguard-rules.pro"              )              versionNameSuffix = "-relWithDebInfo" @@ -146,7 +148,7 @@ android {          create("mainline") {              isDefault = true              dimension = "version" -            buildConfigField("Boolean", "PREMIUM", "false") +            buildConfigField("Boolean", "PREMIUM", "true") // Spoof EA Version          }          create("ea") { @@ -184,7 +186,7 @@ android {      }  } -tasks.create<Delete>("ktlintReset") { +tasks.create<Delete>("ktlintReset") { // Deprecated, Still Works.      delete(File(buildDir.path + File.separator + "intermediates/ktLint"))  } @@ -202,7 +204,7 @@ ktlint {      version.set("0.47.1")      android.set(true)      ignoreFailures.set(false) -    disabledRules.set( +    disabledRules.set( // Deprecated, Still Works.          setOf(              "no-wildcard-imports",              "package-name", @@ -224,24 +226,24 @@ play {  }  dependencies { -    implementation("androidx.core:core-ktx:1.12.0") -    implementation("androidx.appcompat:appcompat:1.6.1") -    implementation("androidx.recyclerview:recyclerview:1.3.1") -    implementation("androidx.constraintlayout:constraintlayout:2.1.4") -    implementation("androidx.fragment:fragment-ktx:1.6.1") +    implementation("androidx.core:core-ktx:1.15.0") +    implementation("androidx.appcompat:appcompat:1.7.0") +    implementation("androidx.recyclerview:recyclerview:1.3.2") +    implementation("androidx.constraintlayout:constraintlayout:2.2.0") +    implementation("androidx.fragment:fragment-ktx:1.8.5")      implementation("androidx.documentfile:documentfile:1.0.1") -    implementation("com.google.android.material:material:1.9.0") +    implementation("com.google.android.material:material:1.12.0")      implementation("androidx.preference:preference-ktx:1.2.1") -    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2") +    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")      implementation("io.coil-kt:coil:2.2.2")      implementation("androidx.core:core-splashscreen:1.0.1") -    implementation("androidx.window:window:1.2.0-beta03") -    implementation("androidx.constraintlayout:constraintlayout:2.1.4") +    implementation("androidx.window:window:1.3.0") +    implementation("androidx.constraintlayout:constraintlayout:2.2.0")      implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") -    implementation("androidx.navigation:navigation-fragment-ktx:2.7.4") -    implementation("androidx.navigation:navigation-ui-ktx:2.7.4") +    implementation("androidx.navigation:navigation-fragment-ktx:2.8.5") +    implementation("androidx.navigation:navigation-ui-ktx:2.8.5")      implementation("info.debatty:java-string-similarity:2.0.0") -    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") +    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")  }  fun runGitCommand(command: List<String>): String { diff --git a/src/android/app/src/main/res/drawable/ic_citron.png b/src/android/app/src/main/res/drawable/ic_citron.png Binary files differnew file mode 100644 index 000000000..5b6dd81ca --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_citron.png diff --git a/src/android/app/src/main/res/drawable/ic_citron.xml b/src/android/app/src/main/res/drawable/ic_citron.xml deleted file mode 100644 index 5e2a8efd0..000000000 --- a/src/android/app/src/main/res/drawable/ic_citron.xml +++ /dev/null @@ -1,22 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" -    android:width="200dp" -    android:height="200dp" -    android:viewportWidth="500" -    android:viewportHeight="500"> -    <path -        android:fillColor="#FF3C28" -        android:fillType="nonZero" -        android:pathData="M262.66,175.11L262.66,375.05C318.54,375.05 363.85,330.29 363.85,275.08C363.85,219.87 318.54,175.11 262.66,175.11M282.43,197.01C318.67,206 344.09,238.19 344.09,275.11C344.09,312.03 318.67,344.22 282.43,353.2L282.43,197.01" -        android:strokeWidth="1.46" -        android:strokeColor="#00000000" -        android:strokeLineCap="butt" -        android:strokeLineJoin="miter" /> -    <path -        android:fillColor="#0AB9E6" -        android:fillType="nonZero" -        android:pathData="M237.31,125.11C181.43,125.11 136.12,169.87 136.12,225.08C136.12,280.29 181.43,325.05 237.31,325.05ZM217.57,147.01L217.57,303.2C189.11,296.16 166.67,274.54 158.84,246.6C151.01,218.65 159,188.71 179.75,168.21C190.16,157.86 203.24,150.53 217.57,147.01" -        android:strokeWidth="1.46" -        android:strokeColor="#00000000" -        android:strokeLineCap="butt" -        android:strokeLineJoin="miter" /> -</vector> diff --git a/src/android/app/src/main/res/drawable/ic_citron_full.png b/src/android/app/src/main/res/drawable/ic_citron_full.png Binary files differnew file mode 100644 index 000000000..5b6dd81ca --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_citron_full.png diff --git a/src/android/app/src/main/res/drawable/ic_citron_full.xml b/src/android/app/src/main/res/drawable/ic_citron_full.xml deleted file mode 100644 index 04e458400..000000000 --- a/src/android/app/src/main/res/drawable/ic_citron_full.xml +++ /dev/null @@ -1,12 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" -    android:width="155.3dp" -    android:height="172.55dp" -    android:viewportWidth="155.3" -    android:viewportHeight="172.55"> -    <path -        android:fillColor="#FF3C28" -        android:pathData="M86.28,34.51v138a69,69 0,0 0,0 -138M99.76,49.63a55.57,55.57 0,0 1,0 107.8V49.63" /> -    <path -        android:fillColor="#0AB9E6" -        android:pathData="M69,0a69,69 0,0 0,0 138ZM55.54,15.12v107.8A55.55,55.55 0,0 1,29.75 29.75,55.1 55.1,0 0,1 55.54,15.12" /> -</vector> diff --git a/src/android/app/src/main/res/drawable/ic_citron_title.png b/src/android/app/src/main/res/drawable/ic_citron_title.png Binary files differnew file mode 100644 index 000000000..5b6dd81ca --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_citron_title.png diff --git a/src/android/app/src/main/res/drawable/ic_citron_title.xml b/src/android/app/src/main/res/drawable/ic_citron_title.xml deleted file mode 100644 index b733e5248..000000000 --- a/src/android/app/src/main/res/drawable/ic_citron_title.xml +++ /dev/null @@ -1,24 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" -    android:width="340.97dp" -    android:height="389.85dp" -    android:viewportWidth="340.97" -    android:viewportHeight="389.85"> -    <path -        android:fillColor="?attr/colorOnSurface" -        android:pathData="M341,268.68v73c0,14.5 -2.24,25.24 -6.83,32.82 -5.92,10.15 -16.21,15.32 -30.54,15.32S279,384.61 273,374.27c-4.56,-7.64 -6.8,-18.42 -6.8,-32.92V268.68a4.52,4.52 0,0 1,4.51 -4.51H273a4.5,4.5 0,0 1,4.5 4.51v72.5c0,33.53 14.88,37.4 26.07,37.4 12.14,0 26.08,-4.17 26.08,-36.71V268.68a4.52,4.52 0,0 1,4.52 -4.51h2.27A4.5,4.5 0,0 1,341 268.68Z" /> -    <path -        android:fillColor="?attr/colorOnSurface" -        android:pathData="M246.49,389.85H178.6c-2.35,0 -4.72,-1.88 -4.72,-6.08a8.28,8.28 0,0 1,1.33 -4.48l60.33,-104.47H186a4.51,4.51 0,0 1,-4.51 -4.51v-1.58a4.51,4.51 0,0 1,4.48 -4.51h0.8c58.69,-0.11 59.12,0 59.67,0.07a5.19,5.19 0,0 1,4 5.8,8.69 8.69,0 0,1 -1.33,3.76l-60.6,104.77h58a4.51,4.51 0,0 1,4.51 4.51v2.21A4.51,4.51 0,0 1,246.49 389.85Z" /> -    <path -        android:fillColor="?attr/colorOnSurface" -        android:pathData="M73.6,268.68v82.06c0,26 -11.8,38.44 -37.12,39.09h-0.12a4.51,4.51 0,0 1,-4.51 -4.51V383a4.51,4.51 0,0 1,4.48 -4.5c18.49,-0.15 26,-8.23 26,-27.9v-2.37A32.34,32.34 0,0 1,59 351.46c-6.39,5.5 -14.5,8.29 -24.07,8.29C12.09,359.75 0,347.34 0,323.86V268.68a4.52,4.52 0,0 1,4.51 -4.51H6.73a4.52,4.52 0,0 1,4.5 4.51v55c0,7.6 1.82,14.22 5,18.18 3.57,4.56 9.17,6.49 18.75,6.49 10.13,0 17.32,-3.76 22,-11.5 3.61,-5.92 5.43,-13.66 5.43,-23V268.68a4.52,4.52 0,0 1,4.51 -4.51h2.22A4.52,4.52 0,0 1,73.6 268.68Z" /> -    <path -        android:fillColor="?attr/colorOnSurface" -        android:pathData="M163.27,268.68v73c0,14.5 -2.24,25.24 -6.84,32.82 -5.92,10.15 -16.2,15.32 -30.53,15.32s-24.62,-5.23 -30.58,-15.57c-4.56,-7.64 -6.79,-18.42 -6.79,-32.92V268.68A4.51,4.51 0,0 1,93 264.17h2.28a4.51,4.51 0,0 1,4.51 4.51v72.5c0,33.53 14.88,37.4 26.07,37.4 12.14,0 26.08,-4.17 26.08,-36.71V268.68a4.51,4.51 0,0 1,4.51 -4.51h2.27A4.51,4.51 0,0 1,163.27 268.68Z" /> -    <path -        android:fillColor="#ff3c28" -        android:pathData="M181.2,42.83V214.17a85.67,85.67 0,0 0,0 -171.34M197.93,61.6a69,69 0,0 1,0 133.8V61.6" /> -    <path -        android:fillColor="#0ab9e6" -        android:pathData="M159.78,0a85.67,85.67 0,1 0,0 171.33ZM143.05,18.77v133.8A69,69 0,0 1,111 36.92a68.47,68.47 0,0 1,32 -18.15" /> -</vector> diff --git a/src/android/build.gradle.kts b/src/android/build.gradle.kts index 2bdd77c55..2f993b197 100644 --- a/src/android/build.gradle.kts +++ b/src/android/build.gradle.kts @@ -3,9 +3,9 @@  // Top-level build file where you can add configuration options common to all sub-projects/modules.  plugins { -    id("com.android.application") version "8.1.2" apply false -    id("com.android.library") version "8.1.2" apply false -    id("org.jetbrains.kotlin.android") version "1.9.20" apply false +    id("com.android.application") version "8.8.0" apply false +    id("com.android.library") version "8.8.0" apply false +    id("org.jetbrains.kotlin.android") version "2.1.20-Beta1" apply false  }  tasks.register("clean").configure { @@ -17,6 +17,6 @@ buildscript {          google()      }      dependencies { -        classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0") +        classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.8.5")      }  } diff --git a/src/android/gradle/wrapper/gradle-wrapper.jar b/src/android/gradle/wrapper/gradle-wrapper.jar Binary files differindex 7a3265ee9..2c3521197 100644 --- a/src/android/gradle/wrapper/gradle-wrapper.jar +++ b/src/android/gradle/wrapper/gradle-wrapper.jar diff --git a/src/android/gradle/wrapper/gradle-wrapper.properties b/src/android/gradle/wrapper/gradle-wrapper.properties index 578c71b94..df97d72b8 100644 --- a/src/android/gradle/wrapper/gradle-wrapper.properties +++ b/src/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Sun Feb 21 18:16:59 EST 2021  distributionBase=GRADLE_USER_HOME  distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true  zipStoreBase=GRADLE_USER_HOME  zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip diff --git a/src/android/gradlew b/src/android/gradlew index 09659d810..f5feea6d6 100755 --- a/src/android/gradlew +++ b/src/android/gradlew @@ -1,81 +1,130 @@ -#!/usr/bin/env sh - -# SPDX-FileCopyrightText: 2023 yuzu Emulator Project & 2025 citron Homebrew Project -# SPDX-License-Identifier: GPL-3.0-or-later +#!/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 UN*X -## +# +#   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 -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do -    ls=`ls -ld "$PRG"` -    link=`expr "$ls" : '.*-> \(.*\)$'` -    if expr "$link" : '/.*' > /dev/null; then -        PRG="$link" -    else -        PRG=`dirname "$PRG"`"/$link" -    fi +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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# 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 +' "$PWD" ) || exit  # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +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 -    ;; -  MINGW* ) -    msys=true -    ;; -  NONSTOP* ) -    nonstop=true -    ;; +case "$( uname )" in                #( +  CYGWIN* )         cygwin=true  ;; #( +  Darwin* )         darwin=true  ;; #( +  MSYS* | MINGW* )  msys=true    ;; #( +  NONSTOP* )        nonstop=true ;;  esac  CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +  # 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" +        JAVACMD=$JAVA_HOME/jre/sh/java      else -        JAVACMD="$JAVA_HOME/bin/java" +        JAVACMD=$JAVA_HOME/bin/java      fi      if [ ! -x "$JAVACMD" ] ; then          die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -84,92 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the  location of your Java installation."      fi  else -    JAVACMD="java" -    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +    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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then -    MAX_FD_LIMIT=`ulimit -H -n` -    if [ $? -eq 0 ] ; then -        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then -            MAX_FD="$MAX_FD_LIMIT" -        fi -        ulimit -n $MAX_FD -        if [ $? -ne 0 ] ; then -            warn "Could not set maximum file descriptor limit: $MAX_FD" -        fi -    else -        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" -    fi +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 -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then -    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -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" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then -    APP_HOME=`cygpath --path --mixed "$APP_HOME"` -    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` -    JAVACMD=`cygpath --unix "$JAVACMD"` - -    # We build the pattern for arguments to be converted via cygpath -    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` -    SEP="" -    for dir in $ROOTDIRSRAW ; do -        ROOTDIRS="$ROOTDIRS$SEP$dir" -        SEP="|" -    done -    OURCYGPATTERN="(^($ROOTDIRS))" -    # Add a user-defined pattern to the cygpath arguments -    if [ "$GRADLE_CYGPATTERN" != "" ] ; then -        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" -    fi      # Now convert the arguments - kludge to limit ourselves to /bin/sh -    i=0 -    for arg in "$@" ; do -        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` -        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option - -        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition -            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` -        else -            eval `echo args$i`="\"$arg\"" +    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 -        i=$((i+1)) +        # 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 -    case $i in -        (0) set -- ;; -        (1) set -- "$args0" ;; -        (2) set -- "$args0" "$args1" ;; -        (3) set -- "$args0" "$args1" "$args2" ;; -        (4) set -- "$args0" "$args1" "$args2" "$args3" ;; -        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; -        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; -        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; -        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; -        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; -    esac  fi -# Escape application args -save () { -    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done -    echo " " -} -APP_ARGS=$(save "$@") -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then -  cd "$(dirname "$0")" +# 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, 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" \ +        org.gradle.wrapper.GradleWrapperMain \ +        "$@" + +# 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" "$@" diff --git a/src/android/gradlew.bat b/src/android/gradlew.bat index a36f5fbca..cf29ff660 100644 --- a/src/android/gradlew.bat +++ b/src/android/gradlew.bat @@ -1,87 +1,73 @@ -@rem SPDX-FileCopyrightText: 2023 yuzu Emulator Project & 2025 citron Homebrew Project -@rem SPDX-License-Identifier: GPL-3.0-or-later - -@if "%DEBUG%" == "" @echo off +@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=. +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= - +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%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - +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 init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - +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 - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -  :execute  @rem Setup the command line -  set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar -  @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*  :end  @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - +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! -if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - +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  | 
