From b331a6763202dee270e1cfb5a52d89fa54d84bef Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 16:21:46 +0200 Subject: [PATCH 01/15] Try to fix Android build issues Seems to be a common problem with recent Gradle versions --- .github/workflows/workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 3452662c8..f6018502c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -586,12 +586,14 @@ jobs: echo "android.useAndroidX=true" >> gradle.properties echo "android.enableJetifier=false" >> gradle.properties echo "kotlin.incremental=true" >> gradle.properties + echo "org.gradle.warning.mode=all" >> gradle.properties mkdir -p build-outputs for ((i=0; i<${#CHAPTERS[@]}; i++)); do chapter="${CHAPTERS[$i]}" if [ -n "$chapter" ]; then echo "Building $chapter chapter..." + ./gradlew --stop ./gradlew assembleDebug --parallel --max-workers=4 --build-cache -Pchapter=$chapter -PabiFilters=x86_64 if [ -f "app/build/outputs/apk/debug/app-debug.apk" ]; then From f65a30f5c832dd4ebd60e4bfc552446dfb60a7ed Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 16:34:58 +0200 Subject: [PATCH 02/15] Update AGP --- .github/workflows/workflow.yml | 4 ++-- attachments/android/build.gradle | 2 +- attachments/android/gradle.properties | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index f6018502c..ab0572c81 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -579,6 +579,7 @@ jobs: readarray -t CHAPTERS <<< "$SUPPORTED_CHAPTERS" echo "Detected supported Android chapters: ${CHAPTERS[@]}" + # Configure gradle.properties with compatible versions echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > gradle.properties echo "org.gradle.parallel=true" >> gradle.properties echo "org.gradle.caching=true" >> gradle.properties @@ -586,14 +587,13 @@ jobs: echo "android.useAndroidX=true" >> gradle.properties echo "android.enableJetifier=false" >> gradle.properties echo "kotlin.incremental=true" >> gradle.properties - echo "org.gradle.warning.mode=all" >> gradle.properties mkdir -p build-outputs for ((i=0; i<${#CHAPTERS[@]}; i++)); do chapter="${CHAPTERS[$i]}" if [ -n "$chapter" ]; then echo "Building $chapter chapter..." - ./gradlew --stop + # Add --stop to stop the daemon before building to clear any cached state ./gradlew assembleDebug --parallel --max-workers=4 --build-cache -Pchapter=$chapter -PabiFilters=x86_64 if [ -f "app/build/outputs/apk/debug/app-debug.apk" ]; then diff --git a/attachments/android/build.gradle b/attachments/android/build.gradle index d946933bb..8f8f43a07 100644 --- a/attachments/android/build.gradle +++ b/attachments/android/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.11.0' + classpath 'com.android.tools.build:gradle:8.13.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/attachments/android/gradle.properties b/attachments/android/gradle.properties index 6c8ca9a33..8b8358ab9 100644 --- a/attachments/android/gradle.properties +++ b/attachments/android/gradle.properties @@ -8,3 +8,6 @@ org.gradle.caching=true android.nonTransitiveRClass=true android.nonFinalResIds=true org.gradle.configuration-cache=true + +# Enabled parallel sync for Gradle 9.4+ +org.gradle.tooling.parallel=true From 439bdbd808b16da59e54d82475002b2c3728cfc6 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 16:46:52 +0200 Subject: [PATCH 03/15] Update gradle --- .github/workflows/workflow.yml | 2 -- attachments/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ab0572c81..3452662c8 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -579,7 +579,6 @@ jobs: readarray -t CHAPTERS <<< "$SUPPORTED_CHAPTERS" echo "Detected supported Android chapters: ${CHAPTERS[@]}" - # Configure gradle.properties with compatible versions echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > gradle.properties echo "org.gradle.parallel=true" >> gradle.properties echo "org.gradle.caching=true" >> gradle.properties @@ -593,7 +592,6 @@ jobs: chapter="${CHAPTERS[$i]}" if [ -n "$chapter" ]; then echo "Building $chapter chapter..." - # Add --stop to stop the daemon before building to clear any cached state ./gradlew assembleDebug --parallel --max-workers=4 --build-cache -Pchapter=$chapter -PabiFilters=x86_64 if [ -f "app/build/outputs/apk/debug/app-debug.apk" ]; then diff --git a/attachments/android/gradle/wrapper/gradle-wrapper.properties b/attachments/android/gradle/wrapper/gradle-wrapper.properties index e67a86246..9b2fe0a6a 100644 --- a/attachments/android/gradle/wrapper/gradle-wrapper.properties +++ b/attachments/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Jul 03 10:37:40 PDT 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.0-milestone-1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 32fafde28758f2bf5b283b495562489aa1615d62 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 16:52:24 +0200 Subject: [PATCH 04/15] Lower target SDK --- attachments/android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachments/android/app/build.gradle b/attachments/android/app/build.gradle index d075fed7a..d39b664ef 100644 --- a/attachments/android/app/build.gradle +++ b/attachments/android/app/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId "com.vulkan.tutorial" minSdk 24 - targetSdk 36 + targetSdk 35 versionCode 1 versionName "1.0" From 2a283f2dab96206ea3515d79a5768e66158ff9a0 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 16:53:48 +0200 Subject: [PATCH 05/15] Lower target SDK --- attachments/android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachments/android/app/build.gradle b/attachments/android/app/build.gradle index d39b664ef..0f69ca8a9 100644 --- a/attachments/android/app/build.gradle +++ b/attachments/android/app/build.gradle @@ -4,7 +4,7 @@ plugins { android { namespace "com.vulkan.tutorial" - compileSdk 36 + compileSdk 35 defaultConfig { applicationId "com.vulkan.tutorial" minSdk 24 From 0ef3479a1ab36d2ddd349cfaab65f1dd4078667b Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:01:00 +0200 Subject: [PATCH 06/15] Don't cache gradle files --- .github/workflows/workflow.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 3452662c8..8a61e6d50 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -470,21 +470,21 @@ jobs: restore-keys: | android-libs- - - name: Cache Gradle packages - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - ${{github.workspace}}/attachments/android/.gradle - ${{github.workspace}}/attachments/android/app/.cxx - ${{github.workspace}}/attachments/android/app/build/intermediates - ${{github.workspace}}/attachments/android/app/build/outputs - ${{github.workspace}}/attachments/android/app/build/generated - key: ${{ runner.os }}-gradle-${{ hashFiles('attachments/android/app/src/main/cpp/CMakeLists.txt', 'attachments/34_android.cpp', 'attachments/35_gltf_ktx.cpp', 'attachments/android/app/build.gradle') }} - restore-keys: | - ${{ runner.os }}-gradle-${{ hashFiles('attachments/android/app/src/main/cpp/CMakeLists.txt') }} - ${{ runner.os }}-gradle- + # - name: Cache Gradle packages + # uses: actions/cache@v3 + # with: + # path: | + # ~/.gradle/caches + # ~/.gradle/wrapper + # ${{github.workspace}}/attachments/android/.gradle + # ${{github.workspace}}/attachments/android/app/.cxx + # ${{github.workspace}}/attachments/android/app/build/intermediates + # ${{github.workspace}}/attachments/android/app/build/outputs + # ${{github.workspace}}/attachments/android/app/build/generated + # key: ${{ runner.os }}-gradle-${{ hashFiles('attachments/android/app/src/main/cpp/CMakeLists.txt', 'attachments/34_android.cpp', 'attachments/35_gltf_ktx.cpp', 'attachments/android/app/build.gradle') }} + # restore-keys: | + # ${{ runner.os }}-gradle-${{ hashFiles('attachments/android/app/src/main/cpp/CMakeLists.txt') }} + # ${{ runner.os }}-gradle- - name: Install and configure ccache run: | From 6a55beb814e206e606853d3174f63bd74cb548e1 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:06:48 +0200 Subject: [PATCH 07/15] Force compatible gradle version --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 8a61e6d50..ce586092f 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -571,7 +571,7 @@ jobs: run: | if [ ! -f "gradlew" ]; then echo "Generating Gradle wrapper..." - gradle wrapper + gradle wrapper --gradle-version 8.6 fi SUPPORTED_CHAPTERS=$(grep -A 20 "set(SUPPORTED_CHAPTERS" app/src/main/cpp/CMakeLists.txt | sed -n '/set(SUPPORTED_CHAPTERS/,/)/p' | grep -o '"[^"]*"' | sed 's/"//g') From 407687f6723f45f4e12ebe7093242c8a5664a273 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:11:02 +0200 Subject: [PATCH 08/15] Force gradle version --- .github/workflows/workflow.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ce586092f..656de4f5a 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -569,10 +569,8 @@ jobs: - name: Build Android Chapters working-directory: ${{github.workspace}}/attachments/android run: | - if [ ! -f "gradlew" ]; then - echo "Generating Gradle wrapper..." - gradle wrapper --gradle-version 8.6 - fi + echo "Generating Gradle wrapper..." + gradle wrapper --gradle-version 8.6 SUPPORTED_CHAPTERS=$(grep -A 20 "set(SUPPORTED_CHAPTERS" app/src/main/cpp/CMakeLists.txt | sed -n '/set(SUPPORTED_CHAPTERS/,/)/p' | grep -o '"[^"]*"' | sed 's/"//g') From 28664f11d8998a8d54a1e68ada3a3ba0af09e0f6 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:17:09 +0200 Subject: [PATCH 09/15] No idea how this is supposed to work Still selects the wrong gradle version Android :( --- .github/workflows/workflow.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 656de4f5a..cbc9d211d 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -569,8 +569,7 @@ jobs: - name: Build Android Chapters working-directory: ${{github.workspace}}/attachments/android run: | - echo "Generating Gradle wrapper..." - gradle wrapper --gradle-version 8.6 + /gradlew wrapper --gradle-version 8.6 SUPPORTED_CHAPTERS=$(grep -A 20 "set(SUPPORTED_CHAPTERS" app/src/main/cpp/CMakeLists.txt | sed -n '/set(SUPPORTED_CHAPTERS/,/)/p' | grep -o '"[^"]*"' | sed 's/"//g') From c77d4fb4d5d63bc144bc249ea43e22bdc30f6ff8 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:20:01 +0200 Subject: [PATCH 10/15] No idea how this is supposed to work Still selects the wrong gradle version Android :( --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index cbc9d211d..a7899b96a 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -569,7 +569,7 @@ jobs: - name: Build Android Chapters working-directory: ${{github.workspace}}/attachments/android run: | - /gradlew wrapper --gradle-version 8.6 + ./gradlew wrapper --gradle-version 8.6 SUPPORTED_CHAPTERS=$(grep -A 20 "set(SUPPORTED_CHAPTERS" app/src/main/cpp/CMakeLists.txt | sed -n '/set(SUPPORTED_CHAPTERS/,/)/p' | grep -o '"[^"]*"' | sed 's/"//g') From aa6378565f325eb674e5f617158b1eeb0ad31c95 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:39:52 +0200 Subject: [PATCH 11/15] pin gradle --- .github/workflows/workflow.yml | 2 +- attachments/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index a7899b96a..93bcc95e4 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -569,7 +569,7 @@ jobs: - name: Build Android Chapters working-directory: ${{github.workspace}}/attachments/android run: | - ./gradlew wrapper --gradle-version 8.6 + ./gradlew --version SUPPORTED_CHAPTERS=$(grep -A 20 "set(SUPPORTED_CHAPTERS" app/src/main/cpp/CMakeLists.txt | sed -n '/set(SUPPORTED_CHAPTERS/,/)/p' | grep -o '"[^"]*"' | sed 's/"//g') diff --git a/attachments/android/gradle/wrapper/gradle-wrapper.properties b/attachments/android/gradle/wrapper/gradle-wrapper.properties index 9b2fe0a6a..a31fa8fdc 100644 --- a/attachments/android/gradle/wrapper/gradle-wrapper.properties +++ b/attachments/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Jul 03 10:37:40 PDT 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From e2083fb40867986503efb787bbc43ec728a9e8ca Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:43:51 +0200 Subject: [PATCH 12/15] Gradle --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 93bcc95e4..2cf21e18b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -569,7 +569,7 @@ jobs: - name: Build Android Chapters working-directory: ${{github.workspace}}/attachments/android run: | - ./gradlew --version + gradle --version SUPPORTED_CHAPTERS=$(grep -A 20 "set(SUPPORTED_CHAPTERS" app/src/main/cpp/CMakeLists.txt | sed -n '/set(SUPPORTED_CHAPTERS/,/)/p' | grep -o '"[^"]*"' | sed 's/"//g') From 77c9bccdfccffa37180de6d13d1cf68aa6fb8cff Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:48:29 +0200 Subject: [PATCH 13/15] Gradle --- .github/workflows/workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 2cf21e18b..7225f5de7 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -569,6 +569,8 @@ jobs: - name: Build Android Chapters working-directory: ${{github.workspace}}/attachments/android run: | + echo "Generating Gradle wrapper..." + gradle wrapper --gradle-version 8.6 gradle --version SUPPORTED_CHAPTERS=$(grep -A 20 "set(SUPPORTED_CHAPTERS" app/src/main/cpp/CMakeLists.txt | sed -n '/set(SUPPORTED_CHAPTERS/,/)/p' | grep -o '"[^"]*"' | sed 's/"//g') From 1c84fdaf646196d92320332a2c4c4c5076c2ba86 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:53:11 +0200 Subject: [PATCH 14/15] Try to fix this gradle mess --- .github/workflows/workflow.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 7225f5de7..d13c66fdd 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -569,9 +569,12 @@ jobs: - name: Build Android Chapters working-directory: ${{github.workspace}}/attachments/android run: | + unset GRADLE_VERSION + which gradle && gradle --version echo "Generating Gradle wrapper..." - gradle wrapper --gradle-version 8.6 - gradle --version + rm -rf gradle + gradle wrapper --gradle-version 8.6 --distribution-type bin + ./gradlew --version SUPPORTED_CHAPTERS=$(grep -A 20 "set(SUPPORTED_CHAPTERS" app/src/main/cpp/CMakeLists.txt | sed -n '/set(SUPPORTED_CHAPTERS/,/)/p' | grep -o '"[^"]*"' | sed 's/"//g') From 850554a6b67bb2d926868d833cb890d23860ae1f Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 16 Aug 2026 17:56:56 +0200 Subject: [PATCH 15/15] Add missing gradle files --- attachments/android/gradlew | 234 ++++++++++++++++++++++++++++++++ attachments/android/gradlew.bat | 89 ++++++++++++ 2 files changed, 323 insertions(+) create mode 100644 attachments/android/gradlew create mode 100644 attachments/android/gradlew.bat diff --git a/attachments/android/gradlew b/attachments/android/gradlew new file mode 100644 index 000000000..c53aefaa5 --- /dev/null +++ b/attachments/android/gradlew @@ -0,0 +1,234 @@ +#!/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. +# + +############################################################################## +# +# 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/master/subprojects/plugins/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 + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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"' + +# 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=$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 + 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 + which java >/dev/null 2>&1 || 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 + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + 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 + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# 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/attachments/android/gradlew.bat b/attachments/android/gradlew.bat new file mode 100644 index 000000000..107acd32c --- /dev/null +++ b/attachments/android/gradlew.bat @@ -0,0 +1,89 @@ +@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 + +@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=. +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%" == "0" goto execute + +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. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +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. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega