-
Notifications
You must be signed in to change notification settings - Fork 612
/
javacommon.gradle
144 lines (117 loc) · 3.34 KB
/
javacommon.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
apply plugin: 'maven-publish'
apply plugin: 'java-library'
apply plugin: 'jacoco'
def baseArtifactId = project.baseId
def artifactGroupId = project.groupId
def javaBaseName = "_GROUP_${project.groupId.replace('.', '_')}_ID_${project.baseId}-java_CLS"
def outputsFolder = file("$project.buildDir/outputs")
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
task outputJar(type: Jar, dependsOn: classes) {
archiveBaseName = javaBaseName
destinationDirectory = outputsFolder
from sourceSets.main.output
}
task outputSourcesJar(type: Jar, dependsOn: classes) {
archiveBaseName = javaBaseName
destinationDirectory = outputsFolder
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task outputJavadocJar(type: Jar, dependsOn: javadoc) {
archiveBaseName = javaBaseName
destinationDirectory = outputsFolder
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
archives outputJar
archives outputSourcesJar
archives outputJavadocJar
}
addTaskToCopyAllOutputs(outputSourcesJar)
addTaskToCopyAllOutputs(outputJavadocJar)
addTaskToCopyAllOutputs(outputJar)
build.dependsOn outputSourcesJar
build.dependsOn outputJavadocJar
build.dependsOn outputJar
project(':').libraryBuild.dependsOn build
publishing {
publications {
java(MavenPublication) {
artifact jar
artifact sourcesJar
artifact javadocJar
artifactId = "${baseArtifactId}-java"
groupId artifactGroupId
version wpilibVersioning.version.get()
}
}
}
test {
useJUnitPlatform()
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
testLogging {
events "failed"
exceptionFormat "full"
}
finalizedBy jacocoTestReport
}
if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64') || project.hasProperty('onlywindowsarm64')) {
test.enabled = false
}
repositories {
maven {
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
}
//maven.url "https://oss.sonatype.org/content/repositories/snapshots/"
}
sourceSets {
dev
}
configurations {
devImplementation.extendsFrom(implementation)
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs = [
'--release',
'17',
'-encoding',
'UTF8',
"-Werror",
"-Xlint:all",
// ignore AutoCloseable warnings
"-Xlint:-try",
// ignore missing serialVersionUID warnings
"-Xlint:-serial",
// ignore unclaimed annotation warning from annotation processing
"-Xlint:-processing",
]
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
devImplementation sourceSets.main.output
}
task run(type: JavaExec) {
classpath = sourceSets.dev.runtimeClasspath
mainClass = project.devMain
}
build.dependsOn devClasses
jacoco {
toolVersion = "0.8.10"
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}