forked from hibernate/hibernate-orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
182 lines (149 loc) · 5.55 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
179
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'de.thetaphi:forbiddenapis:3.2'
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.1'
}
}
plugins {
id 'org.hibernate.build.xjc-jakarta' version '1.0.2' apply false
id 'org.hibernate.matrix-test' version '3.1.1' apply false
id 'org.hibernate.orm.database-service' version '1.0.0-SNAPSHOT' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'nu.studer.credentials' version '2.1'
id 'idea'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.0'
id 'eclipse'
}
allprojects {
repositories {
mavenCentral()
//Allow loading additional dependencies from a local path;
//useful to load JDBC drivers which can not be distributed in public.
if (System.env['ADDITIONAL_REPO'] != null) {
flatDir {
dirs "${System.env.ADDITIONAL_REPO}"
}
}
}
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'org.hibernate.orm.database-service'
apply plugin: 'idea'
apply plugin: 'eclipse'
// minimize changes, at least for now (gradle uses 'build' by default)..
buildDir = "target"
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Release Task
task release {
description = "The task performed when we are performing a release build. Relies on " +
"the fact that subprojects will appropriately define a release task " +
"themselves if they have any release-related activities to perform"
doFirst {
def javaVersionsInUse = [gradle.ext.javaVersions.main.compiler, gradle.ext.javaVersions.main.release,
gradle.ext.javaVersions.test.compiler, gradle.ext.javaVersions.test.release,
gradle.ext.javaVersions.test.launcher].toSet()
if ( javaVersionsInUse != [JavaLanguageVersion.of( 11 )].toSet() ) {
throw new IllegalStateException( "Please use JDK 11 to perform the release. Currently using: ${javaVersionsInUse}" )
}
}
}
task publish {
description = "The task performed when we want to just publish maven artifacts. Relies on " +
"the fact that subprojects will appropriately define a release task " +
"themselves if they have any release-related activities to perform"
}
ext {
// look for command-line overrides of the username/password pairs for publishing
if ( project.hasProperty( 'hibernatePublishUsername' ) ) {
if ( ! project.hasProperty( 'hibernatePublishPassword' ) ) {
throw new GradleException( "Should specify both `hibernatePublishUsername` and `hibernatePublishPassword` as project properties" );
}
credentials.hibernatePublishUsername = project.property( 'hibernatePublishUsername' )
credentials.hibernatePublishPassword = project.property( 'hibernatePublishPassword' )
}
else if ( System.properties.hibernatePublishUsername != null ) {
if ( System.properties.hibernatePublishPassword == null ) {
throw new GradleException( "Should specify both `hibernatePublishUsername` and `hibernatePublishPassword` as system properties" );
}
credentials.hibernatePublishUsername = System.properties.hibernatePublishUsername
credentials.hibernatePublishPassword = System.properties.hibernatePublishPassword
}
}
nexusPublishing {
repositories {
sonatype {
username = credentials.hibernatePublishUsername
password = credentials.hibernatePublishPassword
}
}
}
gradle.taskGraph.addTaskExecutionGraphListener(
new TaskExecutionGraphListener() {
@Override
void graphPopulated(TaskExecutionGraph graph) {
String[] tasksToLookFor = [
'publish',
'publishToSonatype',
'publishAllPublicationsToSonatype',
'publishPublishedArtifactsPublicationToSonatypeRepository',
'publishRelocationArtifactsPublicationToSonatypeRepository',
]
for ( String taskToLookFor : tasksToLookFor ) {
if ( graph.hasTask( taskToLookFor ) ) {
// trying to publish - make sure the needed credentials are available
if ( credentials.hibernatePublishUsername == null ) {
throw new GradleException( "Publishing credentials not specified" );
}
if ( credentials.hibernatePublishPassword == null ) {
throw new GradleException( "Publishing credentials not specified" );
}
break;
}
}
}
}
)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CI Build Task
task ciBuild {
description = "The task performed when one of the 'main' jobs are triggered on the " +
"CI server. Just as above, relies on the fact that subprojects will " +
"appropriately define a release task themselves if they have any tasks " +
"which should be performed from these CI jobs"
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Misc...
wrapper {
// To upgrade the version of gradle used in the wrapper, run:
// ./gradlew wrapper --gradle-version NEW_VERSION
distributionType = Wrapper.DistributionType.ALL
}
idea {
// project {
// jdkName = gradle.ext.baselineJavaVersion
// languageLevel = gradle.ext.baselineJavaVersion
//
// vcs = 'Git'
//
// settings {
// taskTriggers {
// afterSync tasks.getByName("projects"), tasks.getByName("tasks")
// }
// }
// }
module {
name = "hibernate-orm"
}
}