Skip to content

Commit

Permalink
[hibernate#1956] Update release tasks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DavideD committed Sep 16, 2024
1 parent 65f69c3 commit 9614bb3
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 127 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ subprojects {

private static String readVersionFromProperties(File file) {
if ( !file.exists() ) {
throw new GradleException( "Version file $file.canonicalPath does not exists" )
throw new FileNotFoundException( "Version file $file.canonicalPath does not exists" )
}
Properties versionProperties = new Properties()
file.withInputStream {
Expand Down
33 changes: 33 additions & 0 deletions ci/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,39 @@ pipeline {
}
}
}
stage('Release prepare') {
steps {
script {
checkoutReleaseScripts()

configFileProvider([
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
]) {
withCredentials([
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE')
]) {
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
// set release version
// update changelog from JIRA
// tags the version
// changes the version to the provided development version
withEnv([
"BRANCH=${env.GIT_BRANCH}",
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
"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'"
]) {
sh ".release/scripts/prepare-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
}
}
}
}
}
}
}
stage('Publish release') {
steps {
script {
Expand Down
67 changes: 37 additions & 30 deletions documentation/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import java.time.Year

import org.asciidoctor.gradle.jvm.AsciidoctorTask

import java.time.Year

apply plugin: 'org.asciidoctor.jvm.convert'

ext {
Expand All @@ -22,21 +22,21 @@ rootProject.subprojects { subproject ->
// Aggregated JavaDoc
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

final int inceptionYear = 2020
final int currentYear = Year.now().getValue()
final int currentYear = Year.now().getValue()

// exclude any generated sources and internal packages
exclude( '**/generated-src/**' )
// exclude any generated sources and internal packages
exclude( '**/generated-src/**' )
exclude( '**/src/main/generated/**' )
exclude( '**/internal/**' )
exclude( '**/internal/**' )
exclude( '**/impl/**' )

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

logger.lifecycle "---- Aggregating javadoc with version $project.version"

def matcher = hibernateOrmVersion =~ /\d+\.\d+/
def ormMinorVersion = matcher.find() ? matcher.group() : "5.6";

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

if ( gradle.ext.javaToolchainEnabled ) {
options.setJFlags( getProperty( 'toolchain.javadoc.jvmargs' ).toString().
split( ' ' ).toList().findAll( { !it.isEmpty() } ) )
options.setJFlags(
getProperty( 'toolchain.javadoc.jvmargs' ).toString().
split( ' ' ).toList().findAll( { !it.isEmpty() } )
)
}
}

Expand All @@ -75,18 +79,18 @@ task aggregateJavadocs(type: Javadoc, group: 'Documentation') {
}
}

// process each project, building up:
// 1) appropriate sources
// 2) classpath
parent.subprojects.each { Project subProject->
// skip certain sub-projects
if ( ! project.projectsToSkipWhenAggregatingJavadocs.contains( subProject.name ) ) {
// process each project, building up:
// 1) appropriate sources
// 2) classpath
parent.subprojects.each { Project subProject ->
// skip certain sub-projects
if ( !project.projectsToSkipWhenAggregatingJavadocs.contains( subProject.name ) ) {
// we only care about the main SourceSet...
source subProject.sourceSets.main.java

classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
}
}
}
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -98,41 +102,44 @@ asciidoctor {
enabled = false
}

task renderReferenceDocumentation(type: AsciidoctorTask, group: 'Documentation') {
description = 'Renders the Reference Documentation in HTML format using Asciidoctor.'
sourceDir = file( 'src/main/asciidoc/reference' )
sources {
include 'index.adoc'
}
def renderReferenceDocumentationTask = tasks.register( 'renderReferenceDocumentation', AsciidoctorTask ) {
description = 'Renders the Reference Documentation in HTML format using Asciidoctor.'
sourceDir = file( 'src/main/asciidoc/reference' )
sources {
include 'index.adoc'
}

resources {
from(sourceDir) {
from( sourceDir ) {
include 'images/**'
include 'css/**'
}
}

outputDir = new File("$buildDir/asciidoc/reference/html_single")
options logDocuments: true
outputDir = project.layout.buildDirectory.dir( "asciidoc/reference/html_single" ).get().asFile
options logDocuments: true

logger.lifecycle "---- Rendering docs with version $project.version"

attributes icons: 'font',
'source-highlighter': 'rouge',
experimental: true,
linkcss: true,
majorMinorVersion: project.version.family,
fullVersion: project.version.toString(),
docinfo: 'private'

}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// All
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

task assembleDocumentation(dependsOn: [aggregateJavadocs, renderReferenceDocumentation]) {
def assembleDocumentationTask = tasks.register( 'assembleDocumentation' ) {
dependsOn aggregateJavadocsTask, renderReferenceDocumentationTask
group 'Documentation'
description 'Grouping task for performing all documentation building tasks'

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

assemble.dependsOn assembleDocumentation
assemble.dependsOn assembleDocumentationTask
Loading

0 comments on commit 9614bb3

Please sign in to comment.