-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
130 lines (104 loc) · 3.7 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
// Apply the javafxplugin for JavaFX classes
id 'org.openjfx.javafxplugin' version '0.0.7'
// Use GradleRIO for the FRC libraries
id 'edu.wpi.first.GradleRIO' version '2019.3.2'
// Checkstyle
id 'checkstyle'
}
project.version = "0.2.0"
// Set up JavaFX plugin
javafx {
version = "12.0.1"
modules = [ 'javafx.graphics', 'javafx.fxml', 'javafx.controls' ]
}
// 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
}
}
// Needed to fix Javadoc search
// See comments below
final JAVADOC_FIX_SEARCH_STR = '\n\n' +
'/****************************************************************\n' +
' * THE BELOW SNIPPET WAS APPENDED BY THE STDPLUG 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)
// Only include the public API classes
exclude 'com/arctos6135/stdplug/*.java'
exclude 'com/arctos6135/stdplug/data/*'
exclude 'com/arctos6135/stdplug/datatypes/*'
exclude 'com/arctos6135/stdplug/widgets/*'
exclude 'com/arctos6135/stdplug/util/*'
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
}
}
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
// FRC Maven Server
// For the Shuffleboard plugins framework
maven {
url "https://first.wpi.edu/FRC/roborio/maven/release/"
}
}
dependencies {
// Shuffleboard plugins framework
implementation(group: "edu.wpi.first.shuffleboard", name: "api", version: "2019.4.1")
// WPILib for the API
api wpi.deps.wpilib()
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
// Add sources to the jar and exclude API classes
jar {
from sourceSets.main.allSource
archiveName 'StdPlug-' + project.version + '.jar'
exclude 'com/arctos6135/stdplug/api/datatypes/**'
}
task apiJar(type: Jar, group: 'Build', description: 'Generates a jar of the StdPlug robot-side API.') {
dependsOn classes
archiveName 'StdPlug-API-' + project.version + '.jar'
from(sourceSets.main.output) {
include 'com/arctos6135/stdplug/api/**'
}
from(sourceSets.main.allSource) {
include 'com/arctos6135/stdplug/api/**'
}
}
build {
dependsOn apiJar
}