Skip to content

Commit 6e3aea8

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 6e3aea8

File tree

4 files changed

+300
-125
lines changed

4 files changed

+300
-125
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

+31-28
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
@@ -75,18 +75,18 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
7575
}
7676
}
7777

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 ) ) {
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 ) ) {
8484
// we only care about the main SourceSet...
8585
source subProject.sourceSets.main.java
8686

8787
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
8888
}
89-
}
89+
}
9090
}
9191

9292
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -98,41 +98,44 @@ asciidoctor {
9898
enabled = false
9999
}
100100

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-
}
101+
def renderReferenceDocumentationTask = tasks.register( 'renderReferenceDocumentation', AsciidoctorTask ) {
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+
}
107107

108108
resources {
109-
from(sourceDir) {
109+
from( sourceDir ) {
110110
include 'images/**'
111111
include 'css/**'
112112
}
113113
}
114114

115-
outputDir = new File("$buildDir/asciidoc/reference/html_single")
116-
options logDocuments: true
115+
outputDir = project.layout.buildDirectory.dir( "asciidoc/reference/html_single" ).get().asFile
116+
options logDocuments: true
117+
118+
logger.lifecycle "---- Rendering docs with version $project.version"
119+
117120
attributes icons: 'font',
118121
'source-highlighter': 'rouge',
119122
experimental: true,
120123
linkcss: true,
121124
majorMinorVersion: project.version.family,
122125
fullVersion: project.version.toString(),
123126
docinfo: 'private'
124-
125127
}
126128

127129
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128130
// All
129131
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130132

131-
task assembleDocumentation(dependsOn: [aggregateJavadocs, renderReferenceDocumentation]) {
133+
def assembleDocumentationTask = tasks.register( 'assembleDocumentation' ) {
134+
dependsOn aggregateJavadocsTask, renderReferenceDocumentationTask
132135
group 'Documentation'
133136
description 'Grouping task for performing all documentation building tasks'
134137

135138
logger.lifecycle "Documentation groupId: '" + project.group + "', version: '" + project.version + "'"
136139
}
137140

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

0 commit comments

Comments
 (0)