diff --git a/android/app/build.gradle b/android/app/build.gradle
index f9ee6f9cdb1..d2ac439bee8 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -39,17 +39,17 @@ android {
// Checks our Java code against our style guidelines and for common coding mistakes using "checkstyle.xml".
// Will trigger a build failure if any violations have been detected.
// Customize all the Checkstyle tasks
-tasks.withType(Checkstyle) {
+tasks.withType(Checkstyle).configureEach {
// Specify all files that should be checked
classpath = files()
source android.sourceSets.main.java.srcDirs
}
// Execute Checkstyle on all files
-task checkJavaStyle(type: Checkstyle) {
+tasks.register('checkJavaStyle', Checkstyle) {
// include '**/*.java'
}
// Execute Checkstyle on all modified files
-task checkstyleChanged(type: Checkstyle) {
+tasks.register('checkstyleChanged', Checkstyle) {
include getChangedFiles()
}
@@ -73,7 +73,7 @@ def getChangedFiles() {
files
}
-tasks.withType(JavaCompile) {
+tasks.withType(JavaCompile).configureEach {
dependsOn checkJavaStyle
}
diff --git a/android/build.gradle b/android/build.gradle
index 319eec9c71a..325c0af0c32 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -39,6 +39,6 @@ allprojects {
project.apply from: "${rootDir}/templates/build/ti.constants.gradle"
}
-task clean(type: Delete) {
+tasks.register('clean', Delete) {
delete rootProject.buildDir
}
diff --git a/android/kroll-apt/build.gradle b/android/kroll-apt/build.gradle
index 8f5d9d6ddc6..addda9dcd4f 100644
--- a/android/kroll-apt/build.gradle
+++ b/android/kroll-apt/build.gradle
@@ -13,16 +13,16 @@ targetCompatibility = JavaVersion.VERSION_11
// Checks our Java code against our style guidelines and for common coding mistakes using "checkstyle.xml".
// Will trigger a build failure if any violations have been detected.
// Customize all the Checkstyle tasks
-tasks.withType(Checkstyle) {
+tasks.withType(Checkstyle).configureEach {
// Specify all files that should be checked
classpath = files()
source 'src/main/java'
}
// Execute Checkstyle on all files
-task checkJavaStyle(type: Checkstyle) {
+tasks.register('checkJavaStyle', Checkstyle) {
// include '**/*.java'
}
-task checkstyleChanged(type: Checkstyle) {
+tasks.register('checkstyleChanged', Checkstyle) {
include getChangedFiles()
}
@@ -47,7 +47,7 @@ def getChangedFiles() {
}
// Hook into Java compile task.
-tasks.withType(JavaCompile) {
+tasks.withType(JavaCompile).configureEach {
// Check Java code for mistakes before compiling.
dependsOn checkJavaStyle
diff --git a/android/templates/build/root.build.gradle b/android/templates/build/root.build.gradle
index 8df90e3f35f..c8b563a07cc 100644
--- a/android/templates/build/root.build.gradle
+++ b/android/templates/build/root.build.gradle
@@ -21,6 +21,6 @@ allprojects {
project.apply from: "${rootDir}/ti.constants.gradle"
}
-task clean(type: Delete) {
+tasks.register('clean', Delete) {
delete rootProject.buildDir
}
diff --git a/android/templates/module/generated/build.gradle b/android/templates/module/generated/build.gradle
index 83bb889a7ba..35106af223b 100644
--- a/android/templates/module/generated/build.gradle
+++ b/android/templates/module/generated/build.gradle
@@ -164,7 +164,7 @@ project.afterEvaluate {
}
// Hook into Java compile task.
-tasks.withType(JavaCompile) {
+tasks.withType(JavaCompile).configureEach {
// Log all Java linting errors/warnings.
options.compilerArgs << "-Xlint:all"
diff --git a/android/titanium/build.gradle b/android/titanium/build.gradle
index 160a9417a4d..2e78280442e 100644
--- a/android/titanium/build.gradle
+++ b/android/titanium/build.gradle
@@ -125,7 +125,7 @@ android {
}
// Downloads/extracts V8 library and creates a cmake file for it. To be executed before C/C++ "build" or "clean".
-task updateV8Library() {
+tasks.register('updateV8Library') {
def packageJson = new JsonSlurper().parse(file("${projectDir}/../package.json"))
def v8MakeFilePath = "${projectDir}/../runtime/v8/src/ndk-modules/libv8/V8Settings.cmake"
inputs.property 'v8.version', packageJson.v8.version
@@ -139,8 +139,8 @@ task updateV8Library() {
def v8MakeFile = file(v8MakeFilePath)
v8MakeFile.getParentFile().mkdirs()
v8MakeFile.text = [
- "set(LIBV8_VERSION \"${packageJson.v8.version}\")",
- "set(LIBV8_MODE \"${packageJson.v8.mode}\")"
+ "set(LIBV8_VERSION \"${packageJson.v8.version}\")",
+ "set(LIBV8_MODE \"${packageJson.v8.mode}\")"
].join('\n') + '\n'
// Download/install the V8 library referenced in our "package.json", if not already done.
@@ -152,24 +152,24 @@ task updateV8Library() {
}
}
preBuild.dependsOn updateV8Library
-tasks.withType(ExternalNativeCleanTask) {
+tasks.withType(ExternalNativeCleanTask).configureEach {
dependsOn updateV8Library
}
// Checks our Java code against our style guidelines and for common coding mistakes using "checkstyle.xml".
// Will trigger a build failure if any violations have been detected.
// Customize all the Checkstyle tasks
-tasks.withType(Checkstyle) {
+tasks.withType(Checkstyle).configureEach {
// Specify all files that should be checked
classpath = files()
source android.sourceSets.main.java.srcDirs
}
// Execute Checkstyle on all files
-task checkJavaStyle(type: Checkstyle) {
+tasks.register('checkJavaStyle', Checkstyle) {
// include '**/*.java'
}
// Execute Checkstyle on all modified files
-task checkstyleChanged(type: Checkstyle) {
+tasks.register('checkstyleChanged', Checkstyle) {
include getChangedFiles()
}
@@ -196,7 +196,7 @@ def getChangedFiles() {
// Performs a transpile/polyfill/rollup of our "titanium_mobile/common/Resources" directory tree's JS files,
// takes a V8 snapshot of rolled-up files, and then generates a C++ header file of that snapshot to be compiled-in.
// Note: This supports incremental builds. Only executes when JS files change or snapshot output file is missing.
-task snapshotTiCommonFiles() {
+tasks.register('snapshotTiCommonFiles') {
inputs.dir "${projectDir}/../../common/Resources"
inputs.file "${projectDir}/../../build/lib/builder.js"
inputs.file "${projectDir}/../../build/lib/android/index.js"
@@ -221,7 +221,7 @@ project.afterEvaluate {
// Runs our "prebuild.js" script before the C/C++ compile, but after Java compile. (Mid-build script?)
// Generates C/C++ files providing our Android-only JS files via byte arrays.
-tasks.withType(JavaCompile) {
+tasks.withType(JavaCompile).configureEach {
dependsOn checkJavaStyle
dependsOn snapshotTiCommonFiles
doLast {
diff --git a/android/untar.gradle b/android/untar.gradle
index c8073c36141..145bb23b4eb 100644
--- a/android/untar.gradle
+++ b/android/untar.gradle
@@ -1,36 +1,36 @@
-/**
- * Titanium SDK
- * Copyright TiDev, Inc. 04/07/2022-Present
- * Licensed under the terms of the Apache Public License.
- * Please see the LICENSE included with this distribution for details.
- */
-
-// Extracts a "*.tar" file using the same parameters as the ant task.
-// Used by our prebuild step to extract our "libv8-*.tar.bz2" file.
-task untar() {
- // Throw an error if required gradle property has not been set.
- if (!project.hasProperty('src')) {
- throw new InvalidUserDataException('You must set a "src" property.')
- }
-
- // Assign a default value to any unassigned properties.
- if (!project.hasProperty('compression')) {
- project.ext.compression = 'none'
- }
- if (!project.hasProperty('overwrite')) {
- project.ext.overwrite = 'true'
- }
- if (!project.hasProperty('dest')) {
- def sourceFile = new File(src)
- project.ext.dest = sourceFile.getParentFile().getPath()
- }
-
- // Use "ant" to extract the given tarball.
- ant.untar(
- compression: project.properties.compression,
- overwrite: project.properties.overwrite,
- src: project.properties.src,
- dest: project.properties.dest)
-}
-
-defaultTasks 'untar'
+/**
+ * Titanium SDK
+ * Copyright TiDev, Inc. 04/07/2022-Present
+ * Licensed under the terms of the Apache Public License.
+ * Please see the LICENSE included with this distribution for details.
+ */
+
+// Extracts a "*.tar" file using the same parameters as the ant task.
+// Used by our prebuild step to extract our "libv8-*.tar.bz2" file.
+tasks.register('untar') {
+ // Throw an error if required gradle property has not been set.
+ if (!project.hasProperty('src')) {
+ throw new InvalidUserDataException('You must set a "src" property.')
+ }
+
+ // Assign a default value to any unassigned properties.
+ if (!project.hasProperty('compression')) {
+ project.ext.compression = 'none'
+ }
+ if (!project.hasProperty('overwrite')) {
+ project.ext.overwrite = 'true'
+ }
+ if (!project.hasProperty('dest')) {
+ def sourceFile = new File(src)
+ project.ext.dest = sourceFile.getParentFile().getPath()
+ }
+
+ // Use "ant" to extract the given tarball.
+ ant.untar(
+ compression: project.properties.compression,
+ overwrite: project.properties.overwrite,
+ src: project.properties.src,
+ dest: project.properties.dest)
+}
+
+defaultTasks 'untar'
\ No newline at end of file