Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apply plugin: 'com.android.application'
// Set up Android app project.
android {
compileSdkVersion 35
ndkVersion project.ext.tiNdkVersion
ndkVersion = project.ext.tiNdkVersion
defaultConfig {
applicationId 'com.titanium.test'
minSdkVersion 21
Expand All @@ -32,9 +32,9 @@ android {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
namespace 'com.titanium.test'
namespace = 'com.titanium.test'
lint {
checkReleaseBuilds false
checkReleaseBuilds = false
}
}

Expand Down
10 changes: 5 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
*/

buildscript {
ext.kotlin_version = '1.9.23'
ext.kotlin_version = '2.0.20'

repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.8.2'
classpath 'com.android.tools.build:gradle:8.11.1'
classpath 'com.google.gms:google-services:4.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.codehaus.groovy:groovy-json:3.0.17'
Expand All @@ -30,9 +30,9 @@ allprojects {
project.apply plugin: 'checkstyle'
checkstyle {
toolVersion = '10.11.0'
configFile file("${rootDir}/checkstyle.xml");
ignoreFailures false
showViolations true
configFile = file("${rootDir}/checkstyle.xml");
ignoreFailures = false
showViolations = true
}

// Include Titanium's gradle constants in all gradle sub-projects.
Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
9 changes: 4 additions & 5 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# 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
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
Expand Down Expand Up @@ -115,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -206,15 +205,15 @@ fi
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,
# * 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" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
Expand Down
4 changes: 2 additions & 2 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%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
Expand Down
18 changes: 9 additions & 9 deletions android/templates/build/app.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ if (file("${projectDir}/google-services.json").exists()) {

repositories {
<% if (mavenRepositoryUrls) { for (let nextUrl of mavenRepositoryUrls) { %>
maven { url '<%- nextUrl %>' }
maven { url = '<%- nextUrl %>' }
<% } } %>
}

android {
compileSdkVersion <%- compileSdkVersion %>
namespace '<%- applicationId %>'
namespace = '<%- applicationId %>'
defaultConfig {
applicationId '<%- applicationId %>'
minSdkVersion <%- minSdkVersion %>
Expand All @@ -23,11 +23,11 @@ android {
versionName '<%- versionName %>'
manifestPlaceholders = project.ext.tiManifestPlaceholders
manifestPlaceholders.put('localApplicationId', applicationId) // Legacy placeholder old AARs sometimes use.
multiDexEnabled true
multiDexEnabled = true
aaptOptions {
// Android build tools ignores asset directories with leading underscores, but iOS supports it.
// So, we must redefine ignore string with underscore pattern removed to support this too.
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
<% if (ndkAbiArray && (ndkAbiArray.length > 0)) { %>
ndk {
Expand All @@ -40,7 +40,7 @@ android {
targetCompatibility JavaVersion.VERSION_17
}
buildFeatures {
buildConfig true
buildConfig = true
}
signingConfigs {
def tiKeystoreFilePath = <%- "'" + tiSdkAndroidDir.replace(/\\/g, '\\\\') + "/dev_keystore'" %>
Expand All @@ -66,15 +66,15 @@ android {
storePassword tiKeystorePassword
keyAlias tiKeystoreAliasName
keyPassword tiKeystoreAliasPassword
enableV3Signing true
enableV3Signing = true
}
}
buildTypes {
debug {
signingConfig signingConfigs.config
signingConfig = signingConfigs.config
}
release {
signingConfig signingConfigs.config
signingConfig = signingConfigs.config
<% if (proguardFilePaths && (proguardFilePaths.length > 0)) { %>
minifyEnabled true
proguardFiles(
Expand All @@ -84,7 +84,7 @@ android {
}
}
lintOptions {
checkReleaseBuilds false
checkReleaseBuilds = false
}
packagingOptions {
pickFirst '/lib/arm64-v8a/libc++_shared.so'
Expand Down
4 changes: 2 additions & 2 deletions android/templates/build/root.build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.9.23'
ext.kotlin_version = '2.0.20'

repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.8.2'
classpath 'com.android.tools.build:gradle:8.11.1'
classpath 'com.google.gms:google-services:4.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
<% for (let i = 0; i < classpaths.length; i++) {%>
Expand Down
67 changes: 33 additions & 34 deletions android/templates/module/generated/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apply plugin: '<%= plugins[i] %>'
repositories {
maven {
// Path to the Titanium SDK's "m2repository" containing the "titanium.aar" library.
url '<%- tiMavenUrl %>'
url = uri('<%- tiMavenUrl %>')
}
}

Expand All @@ -19,8 +19,8 @@ def tiModuleBindingsJsonPath = "${buildDir}/ti-generated/json/<%- moduleName %>.

android {
compileSdkVersion <%- compileSdkVersion %>
namespace '<%- moduleId %>'
ndkVersion '28.1.13356709'
namespace = '<%- moduleId %>'
ndkVersion = '28.1.13356709'
defaultConfig {
minSdkVersion 21
targetSdkVersion <%- compileSdkVersion %>
Expand All @@ -44,7 +44,7 @@ android {
aaptOptions {
// Android build tools ignores asset directories with leading underscores, but iOS supports it.
// So, we must redefine ignore string with underscore pattern removed to support this too.
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
javaCompileOptions {
annotationProcessorOptions {
Expand Down Expand Up @@ -74,7 +74,7 @@ android {
}
}
buildFeatures {
buildConfig true
buildConfig = true
}
externalNativeBuild {
ndkBuild {
Expand Down Expand Up @@ -148,7 +148,7 @@ android {
// Trigger a build failure if an AAR library was found under the "lib" directory.
// While it will compile with the library, Google's build system won't merge the AAR into this module's AAR.
preBuild.doFirst {
def libDirectory = new File("${projectDir}/../../lib")
def libDirectory = file("${projectDir}/../../lib")
if (libDirectory.exists()) {
libDirectory.eachFile {
if (it.name.toLowerCase().endsWith('.aar')) {
Expand Down Expand Up @@ -179,27 +179,26 @@ project.afterEvaluate {
}
}

tasks.register('generateCppFiles', Exec) {
environment 'TI_MODULE_BINDINGS_JSON_FILE', tiModuleBindingsJsonPath
environment 'TI_MODULE_GENERATED_JNI_DIR', "${projectDir}/build/ti-generated/jni"
environment 'TI_MODULE_GENERATED_JS_DIR', "${projectDir}/build/ti-generated/js"
environment 'TI_MODULE_ID', '<%- moduleId %>'
environment 'TI_MODULE_NAMESPACE', '<%- moduleId.toLowerCase() %>'
environment 'TI_MODULE_TEMPLATE_DIR', '<%- tiSdkModuleTemplateDir.replace(/\\/g, '\\\\') %>'
executable = 'node'
workingDir = projectDir
args = ['generate-cpp-files.js']
}

// Hook into Java compile task.
tasks.withType(JavaCompile).configureEach {
// Log all Java linting errors/warnings.
options.compilerArgs << "-Xlint:all"
options.compilerArgs << "-Xlint:all"

// Execute our "generate-cpp-files.js" script after Java compile to finish generating C++ files.
// Depends on the JSON file produced by our "kroll-apt" Java annotation processor.
// TODO: Our annotation processor should do ALL of the proxy code generation. Don't piece-meal it.
doLast {
exec {
environment 'TI_MODULE_BINDINGS_JSON_FILE', tiModuleBindingsJsonPath
environment 'TI_MODULE_GENERATED_JNI_DIR', "${projectDir}/build/ti-generated/jni"
environment 'TI_MODULE_GENERATED_JS_DIR', "${projectDir}/build/ti-generated/js"
environment 'TI_MODULE_ID', '<%- moduleId %>'
environment 'TI_MODULE_NAMESPACE', '<%- moduleId.toLowerCase() %>'
environment 'TI_MODULE_TEMPLATE_DIR', '<%- tiSdkModuleTemplateDir.replace(/\\/g, '\\\\') %>'
executable = 'node'
workingDir = projectDir
args = ['generate-cpp-files.js']
}
}
// Execute our "generate-cpp-files.js" script after Java compile to finish generating C++ files.
// Depends on the JSON file produced by our "kroll-apt" Java annotation processor.
// TODO: Our annotation processor should do ALL of the proxy code generation. Don't piece-meal it.
finalizedBy(tasks.generateCppFiles)
}

// Titanium does not support incremental @Kroll annotation processing. Disable it in kotlin to avoid build warnings.
Expand All @@ -208,18 +207,18 @@ project.ext['kapt.incremental.apt'] = false
dependencies {
// This reads the code's @Kroll annotations and generates code which interops between V8 and proxy classes.
def krollAptJarPath = '<%- krollAptJarPath.replace(/\\/g, '\\\\') %>'
annotationProcessor files(krollAptJarPath)
compileOnly files(krollAptJarPath)
kapt files(krollAptJarPath)
annotationProcessor(files(krollAptJarPath))
compileOnly(files(krollAptJarPath))
kapt(files(krollAptJarPath))

// Reference this module's local JAR file dependencies.
implementation fileTree(dir: "${projectDir}/../../lib", include: ['*.jar'])
implementation(project.fileTree(dir: "${projectDir}/../../lib", include: ['*.jar']))

// Reference the main Titanium library.
implementation 'org.appcelerator:titanium:<%- tiSdkVersion %>'
implementation("org.appcelerator:titanium:<%- tiSdkVersion %>")

// Reference the core kotlin library.
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
}

// This block is used when we run "gradlew :module:publish" at the command line.
Expand All @@ -228,9 +227,9 @@ publishing {
publications {
titaniumPublication(MavenPublication) {
// Set up maven repo info.
groupId '<%- moduleMavenGroupId %>'
artifactId '<%- moduleMavenArtifactId %>'
version '<%- moduleVersion %>'
groupId = '<%- moduleMavenGroupId %>'
artifactId = '<%- moduleMavenArtifactId %>'
version = '<%- moduleVersion %>'
artifact file("${buildDir}/outputs/aar/${project.name}-release.aar")

// Generates the "*.pom" XML file containing all of Titanium's above dependencies.
Expand Down Expand Up @@ -259,7 +258,7 @@ publishing {
repositories {
maven {
// The maven directory tree produced above will be outputted to the following local directory.
url "${buildDir}/outputs/m2repository"
url = uri("${buildDir}/outputs/m2repository")
}
}
}
Expand Down
Loading
Loading