-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
178 lines (150 loc) · 6.1 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins {
id "com.peterabeles.gversion" version "1.10.3" apply false
}
allprojects {
apply plugin: 'com.peterabeles.gversion'
group = 'org.deepboof'
version = '0.5.3'
createVersionFile.enabled = false // run only once. enabled in types
}
project.ext.ddogleg_version = '0.24.0'
project.ext.lombok_version = '1.18.28'
project.ext.jabel_version = '1.0.1-1'
project.ext.jetnull_version = '23.0.0'
project.ext.jsr250_version = '1.0'
project.ext.junit_version = '5.11.4'
project.ext.auto64to32_version = '3.2.2'
project.ext.zip4j_version = '2.11.5'
project.ext.protobuf_version = '3.25.6'
project.ext.plexus_version = '4.10.0'
project.ext.jcommander_version = '1.82'
project.ext.jgraphx_version = '4.2.2'
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
java {
withJavadocJar()
withSourcesJar()
toolchain { languageVersion = JavaLanguageVersion.of(17) }
}
// Prevents tons of errors if someone is using ASCII
tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" }
// Creates Java 11 byte code but Java 17 syntax
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = 17
options.release = 11
}
// Enable incremental compile. Should make single file changes faster
tasks.withType(JavaCompile) { options.incremental = true }
// Fail on jar conflict
configurations.configureEach { resolutionStrategy { failOnVersionConflict() } }
repositories {
mavenCentral()
mavenLocal()
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = 'https://jitpack.io' } // Allows annotations past Java 8 to be used
}
dependencies {
implementation "org.ddogleg:ddogleg:$project.ddogleg_version"
compileOnly "org.jetbrains:annotations:$project.jetnull_version" // @Nullable
compileOnly "javax.annotation:jsr250-api:$project.jsr250_version" // @Generated
compileOnly "org.projectlombok:lombok:$project.lombok_version"
testImplementation files(project.sourceSets.main.compileClasspath)
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit_version")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junit_version")
// needed to use Java 11+ syntax with Java 11 byte code
annotationProcessor("com.pkware.jabel:jabel-javac-plugin:${project.jabel_version}")
testAnnotationProcessor("com.pkware.jabel:jabel-javac-plugin:${project.jabel_version}")
}
sourceSets {
autogenerate { java { srcDir 'autogenerate/java' } }
}
test {
useJUnitPlatform()
reports.html.setRequired(false)
// Make the error logging verbose to make debugging on CI easier
testLogging.showStandardStreams = true
testLogging.exceptionFormat TestExceptionFormat.FULL
testLogging.showCauses true
testLogging.showExceptions true
testLogging.showStackTraces true
}
javadoc {
configure(options) {
links = ['http://docs.oracle.com/javase/8/docs/api/',
'http://ejml.org/javadoc/',
'http://ddogleg.org/javadoc/']
failOnError = false
enabled = !project.version.contains("SNAPSHOT") // disable to stop it from spamming stdout
}
// https://github.com/gradle/gradle/issues/11182 Error introduced in JDK 11
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_9) >= 0) {
options.addStringOption("-release", "8")
}
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
// Disable the creation of jars for distribution. If you don't do this it will crash
if (['modules','examples'].contains(name)) {
project.jar.enabled = false
project.tasks.publish.enabled = false
}
if (!project.tasks.publish.enabled)
return
// if Maven central isn't setup in ~/.gradle/gradle.properties fill in these variables to make it happy
if( !project.hasProperty('ossrhUsername') ) {
ext.ossrhUsername = "dummy"
ext.ossrhPassword = "dummy"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'DeepBoof'
description = 'Trainer Agnostic Deep Learning'
url = 'https://boofcv.org'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'pabeles'
name = 'Peter Abeles'
email = 'peter.abeles@gmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/lessthanoptimal/DeepBoof.git'
developerConnection = 'scm:git:git://github.com/lessthanoptimal/DeepBoof.git'
url = 'https://github.com/lessthanoptimal/DeepBoof'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
if (ext.ossrhPassword != "dummy") {
signing { sign publishing.publications.mavenJava }
}
}
wrapper {
distributionType = Wrapper.DistributionType.BIN
gradleVersion = '8.12.1'
}