-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
97 lines (80 loc) · 2.98 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
// Use GradleRIO for the FRC libraries
id 'edu.wpi.first.GradleRIO' version '2020.1.2'
// Checkstyle
id 'checkstyle'
}
// Set source and target compatibility to version 11
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
project.version = "0.2.0"
// Needed to fix Javadoc search
// See comments below
final JAVADOC_FIX_SEARCH_STR = '\n\n' +
'/****************************************************************\n' +
' * THE BELOW SNIPPET WAS APPENDED BY THE BUILD PROCESS *\n' +
' * This fixes the broken search functionality due to not having *\n' +
' * modules without breaking external links *\n' +
' ****************************************************************/\n' +
'getURLPrefix = function(ui) {\n' +
' return \'\';\n' +
'};\n'
tasks.withType(Javadoc) {
// Link to external docs for all the builtin classes
options.with {
links 'https://docs.oracle.com/en/java/javase/11/docs/api/',
'https://first.wpi.edu/FRC/roborio/release/docs/java/'
}
// Only generate docs for public methods, fields and types
options.addBooleanOption('public', true)
doLast {
// Since the introduction of modules in Java 9, the Javadoc search functionality would break if the
// project was not using modules. Although --no-module-directories fixes this, it breaks external
// links in the process. Therefore, we append a short snippet of code to the end of the JavaScript
// to fix it.
def searchScript = new File(destinationDir.getAbsolutePath() + '/search.js')
searchScript.append JAVADOC_FIX_SEARCH_STR
}
}
// Checkstyle config
checkstyle {
project.ext.checkstyleVersion = '8.20'
ignoreFailures = false
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
}
// Include all Java source files in checkstyleMain
checkstyleMain {
source = sourceSets.main.allSource
}
// Disable XML reports and enable HTML reports for checkstyle
tasks.withType(Checkstyle) {
reports {
xml.enabled false
html.enabled true
}
}
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
// Use WPILib API
implementation wpi.deps.wpilib()
nativeZip wpi.deps.wpilibJni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop)
implementation wpi.deps.vendor.java()
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
// Hamcrest matchers
testImplementation 'org.hamcrest:hamcrest:2.1'
}
// Add sources to the jar and exclude API classes
jar {
from sourceSets.main.allSource
archiveName "${rootProject.name}-${version}.jar"
}