forked from tidev/titanium-sdk
/
build.gradle
81 lines (71 loc) 路 2.41 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/**
* 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.
*/
apply plugin: 'java'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
// 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).configureEach {
// Specify all files that should be checked
classpath = files()
source 'src/main/java'
}
// Execute Checkstyle on all files
tasks.register('checkJavaStyle', Checkstyle) {
// include '**/*.java'
}
tasks.register('checkstyleChanged', Checkstyle) {
include getChangedFiles()
}
// Used to strip the src dir prefixes from the changed java files
def getChangedFiles() {
if (!project.hasProperty('changedFiles')) {
return new ArrayList<>()
}
def allFiles = project.changedFiles.split(',')
// Remove the prefix
List<String> files = new ArrayList<>()
for (file in allFiles) {
def index = file.indexOf('src/main/java/')
if (index != -1) {
files.add(file.substring(index + 14))
}
}
// Return the list of touched files
files
}
// Hook into Java compile task.
tasks.withType(JavaCompile).configureEach {
// Check Java code for mistakes before compiling.
dependsOn checkJavaStyle
// Suppress compiler warning "bootstrap class path not set in conjunction with source" which happens when
// building with JDK newer than the Java version we're targeting. (Ex: Build with JDK 8, but target Java 7.)
// Note: Build tool wants a reference to runtime JAR of the same version we're targeting. Not going to happen.
options.compilerArgs << '-Xlint:-options'
options.incremental = true
}
// Bundle the below library dependencies within this project's built JAR.
// Needed when building modules via "_buildModule.js" which only references the "kroll-apt.jar".
jar {
manifest {
attributes 'Main-Class': 'org.appcelerator.kroll.annotations.generator.KrollBindingGenerator'
}
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
version '1.0.0'
}
dependencies {
implementation 'com.googlecode.json-simple:json-simple:1.1'
implementation 'org.freemarker:freemarker:2.3.30'
}