forked from hibernate/hibernate-reactive
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
158 lines (138 loc) · 5.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
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
plugins {
id "local.versions"
id 'java-library'
id 'maven-publish'
id 'com.diffplug.spotless' version '6.25.0'
id 'org.asciidoctor.jvm.convert' version '4.0.2' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
}
group = "org.hibernate.reactive"
// leverage the ProjectVersion which comes from the `local.versions` plugin
version = project.projectVersion.fullName
ext {
if ( !project.hasProperty( 'hibernatePublishUsername' ) ) {
hibernatePublishUsername = null
}
if ( !project.hasProperty( 'hibernatePublishPassword' ) ) {
hibernatePublishPassword = null
}
}
// Versions which need to be aligned across modules; this also
// allows overriding the build using a parameter, which can be
// useful to monitor compatibility for upcoming versions on CI:
//
// ./gradlew clean build -PhibernateOrmVersion=5.6.15-SNAPSHOT
ext {
// Mainly, to allow CI to test the latest versions of Vert.X
// Example:
// ./gradlew build -PvertxSqlClientVersion=4.0.0-SNAPSHOT
if ( !project.hasProperty( 'vertxSqlClientVersion' ) ) {
vertxSqlClientVersion = '4.5.10'
}
testcontainersVersion = '1.19.8'
logger.lifecycle "Vert.x SQL Client Version: " + project.vertxSqlClientVersion
}
// To release, see task ciRelease in release/build.gradle
// To publish on Sonatype (Maven Central):
// ./gradlew publishToSonatype closeAndReleaseStagingRepository -PhibernatePublishUsername="<YOUR USERNAME>" -PhibernatePublishPassword="<YOUR PASSWORD>"
nexusPublishing {
repositories {
sonatype {
username = project.hibernatePublishUsername
password = project.hibernatePublishPassword
}
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'com.diffplug.spotless'
group = rootProject.group
version = rootProject.version
spotless {
//Don't fail during the check: rather than enforcing guidelines, we use this plugin to fix mistakes automatically.
enforceCheck false
java {
licenseHeaderFile rootProject.file('spotless.license.java')
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
tasks.compileJava.dependsOn(spotlessApply)
repositories {
// Example: ./gradlew build -PenableMavenLocalRepo
if ( project.hasProperty('enableMavenLocalRepo') ) {
// Useful for local development, it should be disabled otherwise
mavenLocal()
}
// Example: ./gradlew build -PenableSonatypeOpenSourceSnapshotsRep
if ( project.hasProperty('enableSonatypeOpenSourceSnapshotsRep') ) {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
mavenCentral()
}
ext.publishScript = rootProject.rootDir.absolutePath + '/publish.gradle'
tasks.withType( JavaCompile ) {
options.encoding = 'UTF-8'
}
if ( !gradle.ext.javaToolchainEnabled ) {
sourceCompatibility = JavaVersion.toVersion( gradle.ext.baselineJavaVersion )
targetCompatibility = JavaVersion.toVersion( gradle.ext.baselineJavaVersion )
}
else {
// Configure generated bytecode
// "sourceCompatibility" is not supported with toolchains. We have to work around that limitation.
tasks.compileJava.configure {
options.release = gradle.ext.javaVersions.main.release.asInt()
}
tasks.compileTestJava.configure {
options.release = gradle.ext.javaVersions.test.release.asInt()
}
// Configure version of Java tools
java {
toolchain {
languageVersion = gradle.ext.javaVersions.main.compiler
}
}
tasks.compileTestJava {
javaCompiler = javaToolchains.compilerFor {
languageVersion = gradle.ext.javaVersions.test.compiler
}
}
tasks.test {
javaLauncher = javaToolchains.launcherFor {
languageVersion = gradle.ext.javaVersions.test.launcher
}
}
// Configure JVM Options
tasks.withType( JavaCompile ).configureEach {
options.forkOptions.jvmArgs.addAll( getProperty( 'toolchain.compiler.jvmargs' ).toString().split( ' ' ) )
}
tasks.withType( Javadoc ).configureEach {
options.setJFlags( getProperty( 'toolchain.javadoc.jvmargs' ).toString().split( ' ' ).toList().findAll( { !it.isEmpty() } ) )
}
tasks.test {
// Configure JVM Options
jvmArgs(getProperty('toolchain.launcher.jvmargs').toString().split(' '))
if ( project.hasProperty( 'test.jdk.launcher.args' ) ) {
jvmArgs( project.getProperty( 'test.jdk.launcher.args' ).toString().split( ' ' ) )
}
}
// Display version of Java tools
tasks.withType( JavaCompile ).configureEach {
doFirst {
logger.lifecycle "Compiling with '${javaCompiler.get().metadata.installationPath}'"
}
}
tasks.withType( Javadoc ).configureEach {
doFirst {
logger.lifecycle "Generating javadoc with '${javadocTool.get().metadata.installationPath}'"
}
}
tasks.test {
doFirst {
logger.lifecycle "Testing with '${javaLauncher.get().metadata.installationPath}'"
}
}
}
}