HHH-15193 - Fix Gradle plugin - forcing dependency on hibernate-core SNAPSHOT

Capability to publish plugin locally (to maven local) for testing
This commit is contained in:
Steve Ebersole 2022-04-12 17:47:04 -05:00
parent 43f310da92
commit aef21b18dc
1 changed files with 32 additions and 4 deletions

View File

@ -15,6 +15,9 @@ plugins {
// which unfortunately also means we do not get any functional testing of the plugin // which unfortunately also means we do not get any functional testing of the plugin
// id 'com.github.sebersole.testkit-junit5' version '1.2.0' // id 'com.github.sebersole.testkit-junit5' version '1.2.0'
id 'checkstyle' id 'checkstyle'
// for local publishing
id 'maven-publish'
} }
apply from: rootProject.file( 'gradle/module.gradle' ) apply from: rootProject.file( 'gradle/module.gradle' )
@ -68,15 +71,40 @@ pluginBundle {
} }
} }
tasks.release { // Publish to the Gradle Plugin Portal
dependsOn tasks.publishPlugins tasks.release.dependsOn tasks.publishPlugins
// local publishing (SNAPSHOT testing)
tasks.publish.dependsOn tasks.publishPlugins
// local publishing (SNAPSHOT testing)
publishing {
repositories {
maven {
name = 'localPluginRepository'
url = "${buildDir}/local-plugin-repository"
}
}
} }
task publish {
dependsOn tasks.publishPlugins // local publishing (SNAPSHOT testing), cont.
// - https://github.com/gradle-nexus/publish-plugin/issues/143
// - https://github.com/gradle-nexus/publish-plugin/pull/144
gradle.taskGraph.whenReady {
tasks.withType(PublishToMavenRepository) { PublishToMavenRepository t ->
if ( t.repository == null ) {
logger.info( "Task `{}` had null repository", t.path )
}
else if ( t.repository.name == "sonatype" ) {
logger.lifecycle( "Disabling task `{}` because it publishes to Sonatype", t.path )
t.enabled = false
}
}
} }
processResources { processResources {
inputs.property( "orm-version", getVersion() ) inputs.property( "orm-version", getVersion() )
description = description + " (injected with Hibernate version)"
filter( ReplaceTokens, tokens: [ 'hibernateVersion': getVersion() ] ) filter( ReplaceTokens, tokens: [ 'hibernateVersion': getVersion() ] )
} }