Skip to content

Commit

Permalink
chore: update gradle files (#13888)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga authored Sep 12, 2024
1 parent 3db8223 commit f3676e1
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 56 deletions.
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand All @@ -73,7 +73,7 @@ def getChangedFiles() {
files
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
dependsOn checkJavaStyle
}

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 4 additions & 4 deletions android/kroll-apt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion android/templates/build/root.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ allprojects {
project.apply from: "${rootDir}/ti.constants.gradle"
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/templates/module/generated/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
18 changes: 9 additions & 9 deletions android/titanium/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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()
}

Expand All @@ -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"
Expand All @@ -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 {
Expand Down
72 changes: 36 additions & 36 deletions android/untar.gradle
Original file line number Diff line number Diff line change
@@ -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 <untar/> 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 <untar/> 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'

0 comments on commit f3676e1

Please sign in to comment.