From 416edb121bef6c2488cf426c529317407706aa5c Mon Sep 17 00:00:00 2001 From: m1ga Date: Sat, 29 Jul 2023 00:35:47 +0200 Subject: [PATCH] chore: update gradle files --- android/app/build.gradle | 8 +-- android/build.gradle | 4 +- android/kroll-apt/build.gradle | 8 +-- android/templates/build/root.build.gradle | 2 +- .../templates/module/generated/build.gradle | 2 +- android/titanium/build.gradle | 18 ++--- android/untar.gradle | 72 +++++++++---------- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index be53a3dc73b..ea5f8d25426 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 2f329bb416c..7c49c24e500 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -30,7 +30,7 @@ allprojects { project.apply plugin: 'checkstyle' checkstyle { toolVersion = '8.38' - configFile file("${rootDir}/checkstyle.xml"); + configFile file("${rootDir}/checkstyle.xml") ignoreFailures false showViolations true } @@ -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 cf2bb024c05..d3d359f81f4 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 f28a5aee09c..db6a40b20ec 100644 --- a/android/templates/module/generated/build.gradle +++ b/android/templates/module/generated/build.gradle @@ -162,7 +162,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 383477d1487..d329d3f3265 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 d6a9b0531b0..e2bf0074b25 100644 --- a/android/untar.gradle +++ b/android/untar.gradle @@ -1,36 +1,36 @@ -/** - * TiDev Titanium Mobile - * 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' +/** + * TiDev Titanium Mobile + * 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'