forked from tidev/titanium-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
78 lines (68 loc) · 2.38 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
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2020 by Axway. All Rights Reserved.
* Licensed under the terms of the Apache Public License.
* Please see the LICENSE included with this distribution for details.
*/
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_11
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) {
// Specify all files that should be checked
classpath = files()
source 'src/main/java'
}
// Execute Checkstyle on all files
task checkJavaStyle(type: Checkstyle) {
// include '**/*.java'
}
task checkstyleChanged(type: 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) {
// 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'
}
// 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
}
dependencies {
implementation 'com.googlecode.json-simple:json-simple:1.1'
implementation 'org.freemarker:freemarker:2.3.30'
implementation 'log4j:log4j:1.2.17'
}