Skip to content

Commit 9614bb3

Browse files
committed
[hibernate#1956] Update release tasks
They are now compatible with the release scripts in https://github.com/hibernate/hibernate-release-scripts: * Calling `prepare-release.sh` won't upload any change upstream * They are compatible with the way ORM works
1 parent 65f69c3 commit 9614bb3

File tree

4 files changed

+306
-127
lines changed

4 files changed

+306
-127
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ subprojects {
203203

204204
private static String readVersionFromProperties(File file) {
205205
if ( !file.exists() ) {
206-
throw new GradleException( "Version file $file.canonicalPath does not exists" )
206+
throw new FileNotFoundException( "Version file $file.canonicalPath does not exists" )
207207
}
208208
Properties versionProperties = new Properties()
209209
file.withInputStream {

ci/release/Jenkinsfile

+33
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,39 @@ pipeline {
156156
}
157157
}
158158
}
159+
stage('Release prepare') {
160+
steps {
161+
script {
162+
checkoutReleaseScripts()
163+
164+
configFileProvider([
165+
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
166+
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
167+
]) {
168+
withCredentials([
169+
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
170+
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
171+
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
172+
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE')
173+
]) {
174+
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
175+
// set release version
176+
// update changelog from JIRA
177+
// tags the version
178+
// changes the version to the provided development version
179+
withEnv([
180+
"BRANCH=${env.GIT_BRANCH}",
181+
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
182+
"GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8'"
183+
]) {
184+
sh ".release/scripts/prepare-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
185+
}
186+
}
187+
}
188+
}
189+
}
190+
}
191+
}
159192
stage('Publish release') {
160193
steps {
161194
script {

documentation/build.gradle

+37-30
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import java.time.Year
2-
31
import org.asciidoctor.gradle.jvm.AsciidoctorTask
42

3+
import java.time.Year
4+
55
apply plugin: 'org.asciidoctor.jvm.convert'
66

77
ext {
@@ -22,21 +22,21 @@ rootProject.subprojects { subproject ->
2222
// Aggregated JavaDoc
2323
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2424

25-
final File javadocDir = mkdir( new File( (File) project.buildDir, 'javadocs' ) )
25+
final File javadocDir = mkdir( project.layout.buildDirectory.dir( "javadocs" ) )
2626

2727
/**
2828
* Builds the JavaDocs aggregated (unified) across all the sub-projects
2929
*/
30-
task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
31-
description = 'Builds the aggregated (unified) JavaDocs across all sub-projects'
30+
def aggregateJavadocsTask = tasks.register( 'aggregateJavadocs', Javadoc ) {
31+
description = 'Builds the aggregated (unified) JavaDocs across all sub-projects'
3232

3333
final int inceptionYear = 2020
34-
final int currentYear = Year.now().getValue()
34+
final int currentYear = Year.now().getValue()
3535

36-
// exclude any generated sources and internal packages
37-
exclude( '**/generated-src/**' )
36+
// exclude any generated sources and internal packages
37+
exclude( '**/generated-src/**' )
3838
exclude( '**/src/main/generated/**' )
39-
exclude( '**/internal/**' )
39+
exclude( '**/internal/**' )
4040
exclude( '**/impl/**' )
4141

4242
// apply standard config
@@ -50,6 +50,8 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
5050
use = true
5151
options.encoding = 'UTF-8'
5252

53+
logger.lifecycle "---- Aggregating javadoc with version $project.version"
54+
5355
def matcher = hibernateOrmVersion =~ /\d+\.\d+/
5456
def ormMinorVersion = matcher.find() ? matcher.group() : "5.6";
5557

@@ -63,8 +65,10 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
6365
options.addStringOption( 'Xdoclint:none', '-quiet' )
6466

6567
if ( gradle.ext.javaToolchainEnabled ) {
66-
options.setJFlags( getProperty( 'toolchain.javadoc.jvmargs' ).toString().
67-
split( ' ' ).toList().findAll( { !it.isEmpty() } ) )
68+
options.setJFlags(
69+
getProperty( 'toolchain.javadoc.jvmargs' ).toString().
70+
split( ' ' ).toList().findAll( { !it.isEmpty() } )
71+
)
6872
}
6973
}
7074

@@ -75,18 +79,18 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
7579
}
7680
}
7781

78-
// process each project, building up:
79-
// 1) appropriate sources
80-
// 2) classpath
81-
parent.subprojects.each { Project subProject->
82-
// skip certain sub-projects
83-
if ( ! project.projectsToSkipWhenAggregatingJavadocs.contains( subProject.name ) ) {
82+
// process each project, building up:
83+
// 1) appropriate sources
84+
// 2) classpath
85+
parent.subprojects.each { Project subProject ->
86+
// skip certain sub-projects
87+
if ( !project.projectsToSkipWhenAggregatingJavadocs.contains( subProject.name ) ) {
8488
// we only care about the main SourceSet...
8589
source subProject.sourceSets.main.java
8690

8791
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
8892
}
89-
}
93+
}
9094
}
9195

9296
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -98,41 +102,44 @@ asciidoctor {
98102
enabled = false
99103
}
100104

101-
task renderReferenceDocumentation(type: AsciidoctorTask, group: 'Documentation') {
102-
description = 'Renders the Reference Documentation in HTML format using Asciidoctor.'
103-
sourceDir = file( 'src/main/asciidoc/reference' )
104-
sources {
105-
include 'index.adoc'
106-
}
105+
def renderReferenceDocumentationTask = tasks.register( 'renderReferenceDocumentation', AsciidoctorTask ) {
106+
description = 'Renders the Reference Documentation in HTML format using Asciidoctor.'
107+
sourceDir = file( 'src/main/asciidoc/reference' )
108+
sources {
109+
include 'index.adoc'
110+
}
107111

108112
resources {
109-
from(sourceDir) {
113+
from( sourceDir ) {
110114
include 'images/**'
111115
include 'css/**'
112116
}
113117
}
114118

115-
outputDir = new File("$buildDir/asciidoc/reference/html_single")
116-
options logDocuments: true
119+
outputDir = project.layout.buildDirectory.dir( "asciidoc/reference/html_single" ).get().asFile
120+
options logDocuments: true
121+
122+
logger.lifecycle "---- Rendering docs with version $project.version"
123+
117124
attributes icons: 'font',
118125
'source-highlighter': 'rouge',
119126
experimental: true,
120127
linkcss: true,
121128
majorMinorVersion: project.version.family,
122129
fullVersion: project.version.toString(),
123130
docinfo: 'private'
124-
125131
}
126132

127133
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128134
// All
129135
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130136

131-
task assembleDocumentation(dependsOn: [aggregateJavadocs, renderReferenceDocumentation]) {
137+
def assembleDocumentationTask = tasks.register( 'assembleDocumentation' ) {
138+
dependsOn aggregateJavadocsTask, renderReferenceDocumentationTask
132139
group 'Documentation'
133140
description 'Grouping task for performing all documentation building tasks'
134141

135142
logger.lifecycle "Documentation groupId: '" + project.group + "', version: '" + project.version + "'"
136143
}
137144

138-
assemble.dependsOn assembleDocumentation
145+
assemble.dependsOn assembleDocumentationTask

0 commit comments

Comments
 (0)