diff --git a/android/app/build.gradle b/android/app/build.gradle index 378dd030525..dccbb8dec72 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -12,9 +12,9 @@ android { defaultConfig { applicationId 'com.titanium.test' minSdkVersion 19 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 1 - versionName "1.0" + versionName '1.0' manifestPlaceholders = project.ext.tiManifestPlaceholders manifestPlaceholders.put('localApplicationId', applicationId) // Legacy placeholder old AARs sometimes use. } diff --git a/android/build.gradle b/android/build.gradle index ca04f15b356..a3187d5da9d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -13,7 +13,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.2' + classpath 'com.android.tools.build:gradle:3.6.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/cli/commands/_buildModule.js b/android/cli/commands/_buildModule.js index 86302e1a8e4..a8767530023 100644 --- a/android/cli/commands/_buildModule.js +++ b/android/cli/commands/_buildModule.js @@ -502,6 +502,7 @@ AndroidModuleBuilder.prototype.generateRootProjectFiles = async function generat // Create a "gradle.properties" file. Will add network proxy settings if needed. const gradleProperties = await gradlew.fetchDefaultGradleProperties(); + gradleProperties.push({ key: 'android.useAndroidX', value: 'true' }); gradleProperties.push({ key: 'org.gradle.jvmargs', value: `-Xmx${this.javacMaxMemory} -Dkotlin.daemon.jvm.options="-Xmx${this.javacMaxMemory}"` diff --git a/android/gradle.properties b/android/gradle.properties index 369e62bb87a..085c6ba8d5b 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,15 +1,14 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html +# -------------------------------------------------------------------------------- +# Appcelerator Titanium Mobile +# Copyright (c) 2009-2020 by Axway. All Rights Reserved. +# Licensed under the terms of the Apache Public License. +# Please see the LICENSE included with this distribution for details. +# -------------------------------------------------------------------------------- -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. +# Set max Java heap size for gradle daemon process. org.gradle.jvmargs=-Xmx1536m -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -#org.gradle.parallel=true +# Enable usage of Google's AndroidX libraries. +# Note: Jetifier is not needed for test app since it doesn't use Google's deprecated support libraries. +android.useAndroidX=true +android.enableJetifier=false diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar index f6b961fd5a8..f3d88b1c2fa 100644 Binary files a/android/gradle/wrapper/gradle-wrapper.jar and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index d757f3d33fc..4a6ebceacd2 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/android/gradlew b/android/gradlew index cccdd3d517f..2fe81a7d95e 100755 --- a/android/gradlew +++ b/android/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or 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 UN*X @@ -28,7 +44,7 @@ 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="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` 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" ;; + 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 @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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")" -fi - exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat index e95643d6a2c..24467a141f7 100644 --- a/android/gradlew.bat +++ b/android/gradlew.bat @@ -1,3 +1,19 @@ +@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 @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @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 diff --git a/android/templates/build/root.build.gradle b/android/templates/build/root.build.gradle index 0e1a24bc614..a80e788f614 100644 --- a/android/templates/build/root.build.gradle +++ b/android/templates/build/root.build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.2' + classpath 'com.android.tools.build:gradle:3.6.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/templates/module/generated/build.gradle b/android/templates/module/generated/build.gradle index 84b2ef41072..691e4ee8b6c 100644 --- a/android/templates/module/generated/build.gradle +++ b/android/templates/module/generated/build.gradle @@ -151,6 +151,14 @@ preBuild.doFirst { } } +// Set up project to compile Java side before compiling the C/C++ side. +// We must do this because our "kroll-apt" Java annotation processor generates C++ source files. +project.afterEvaluate { + externalNativeBuildDebug.dependsOn compileDebugJavaWithJavac + externalNativeBuildRelease.dependsOn compileReleaseJavaWithJavac +} + +// Hook into Java compile task. tasks.withType(JavaCompile) { // Log all Java linting errors/warnings. options.compilerArgs << "-Xlint:all" diff --git a/android/titanium/build.gradle b/android/titanium/build.gradle index 563c5239ddf..2a6c830b694 100644 --- a/android/titanium/build.gradle +++ b/android/titanium/build.gradle @@ -155,6 +155,13 @@ task snapshotTiCommonFiles() { } } +// Set up project to compile Java side before compiling the C/C++ side. +// We must do this because our "kroll-apt" Java annotation processor generates C++ source files. +project.afterEvaluate { + externalNativeBuildDebug.dependsOn compileDebugJavaWithJavac + externalNativeBuildRelease.dependsOn compileReleaseJavaWithJavac +} + // Runs our "prebuild.js" script before the C/C++ compile, but after Java compile. (Mid-build script?) // This downloads the V8 library, generates C/C++ files, and generates some asset files. tasks.withType(JavaCompile) { diff --git a/support/module/packaged/modules.json b/support/module/packaged/modules.json index 0bdd5c87dd4..7d3ce4b68f5 100644 --- a/support/module/packaged/modules.json +++ b/support/module/packaged/modules.json @@ -63,8 +63,8 @@ }, "hyperloop": { "hyperloop": { - "url": "https://github.com/appcelerator-modules/hyperloop-builds/releases/download/v5.0.1/hyperloop-5.0.1.zip", - "integrity": "sha512-eXrt/lCD77PRhkvJzhcezVeeoq7PGFjOa4FnkF+59Vc4F416vf1uGq+NTMqnl/+oUiHaTmuB8pxfZ+2AC/TN7A==" + "url": "https://github.com/appcelerator-modules/hyperloop-builds/releases/download/v5.0.2/hyperloop-5.0.2.zip", + "integrity": "sha512-CJQ5FlZfN09vXnyXoqFWL8cwCbR/1rDLYA8rB+U+R4CIuv/BKBTcTxzXjJgTm6SmmqOpv5pEkmK7OZZIXjWCGQ==" } } }