HHH-14872 - Re-enable hibernate-gradle-plugin
plus additional improvements to Gradle scripts
This commit is contained in:
parent
58d4d8a6e1
commit
5403e95958
|
@ -56,11 +56,6 @@ if ( !project.description ) {
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Configurations and Dependencies
|
// Configurations and Dependencies
|
||||||
|
|
||||||
|
|
||||||
configurations.all {
|
|
||||||
exclude group: 'xml-apis', module: 'xml-apis'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation libraries.logging
|
implementation libraries.logging
|
||||||
|
|
||||||
|
@ -122,6 +117,20 @@ dependencies {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
javadocSources {
|
||||||
|
canBeConsumed = true
|
||||||
|
canBeResolved = false
|
||||||
|
visible = false
|
||||||
|
description = 'Configuration for accessing the sources that should be included in the javadoc for the project'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
sourceSets.main.allJava.srcDirs.each { srcDir ->
|
||||||
|
javadocSources srcDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Compilation
|
// Compilation
|
||||||
|
@ -462,21 +471,25 @@ task copyResourcesToIntelliJOutFolder(type: Task, dependsOn: project.tasks.proce
|
||||||
Afterward, you can run any test from the IDE against that particular DB.
|
Afterward, you can run any test from the IDE against that particular DB.
|
||||||
*/
|
*/
|
||||||
task setDataBase dependsOn( processTestResources, copyResourcesToIntelliJOutFolder ) {
|
task setDataBase dependsOn( processTestResources, copyResourcesToIntelliJOutFolder ) {
|
||||||
println( 'Setting current database to ' + db )
|
println( "Setting current database to ${db}" )
|
||||||
}
|
}
|
||||||
|
|
||||||
copyResourcesToIntelliJOutFolder.mustRunAfter processTestResources
|
tasks.copyResourcesToIntelliJOutFolder.mustRunAfter processTestResources
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Report configs
|
// Report configs
|
||||||
|
|
||||||
checkstyle {
|
checkstyle {
|
||||||
sourceSets = [ project.sourceSets.main ]
|
it.sourceSets = [ project.sourceSets.main ]
|
||||||
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
|
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
|
||||||
showViolations = false
|
showViolations = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// exclude generated java sources - by explicitly setting the base source dir
|
// exclude generated java sources - by explicitly setting the base source dir
|
||||||
checkstyleMain.source = 'src/main/java'
|
tasks.checkstyleMain.source = 'src/main/java'
|
||||||
|
// because cfg package is a mess mainly from annotation stuff
|
||||||
|
tasks.checkstyleMain.exclude '**/org/hibernate/cfg/**'
|
||||||
|
tasks.checkstyleMain.exclude '**/org/hibernate/cfg/*'
|
||||||
|
|
||||||
// define a second checkstyle task for checking non-fatal violations
|
// define a second checkstyle task for checking non-fatal violations
|
||||||
task nonFatalCheckstyle(type:Checkstyle) {
|
task nonFatalCheckstyle(type:Checkstyle) {
|
||||||
|
@ -486,10 +499,6 @@ task nonFatalCheckstyle(type:Checkstyle) {
|
||||||
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle-non-fatal.xml' )
|
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle-non-fatal.xml' )
|
||||||
}
|
}
|
||||||
|
|
||||||
// because cfg package is a mess mainly from annotation stuff
|
|
||||||
checkstyleMain.exclude '**/org/hibernate/cfg/**'
|
|
||||||
checkstyleMain.exclude '**/org/hibernate/cfg/*'
|
|
||||||
|
|
||||||
|
|
||||||
task forbiddenApisSystemOut(type: CheckForbiddenApis, dependsOn: compileJava) {
|
task forbiddenApisSystemOut(type: CheckForbiddenApis, dependsOn: compileJava) {
|
||||||
bundledSignatures += 'jdk-system-out'
|
bundledSignatures += 'jdk-system-out'
|
||||||
|
@ -510,26 +519,22 @@ task forbiddenApisNonPortable(type: CheckForbiddenApis, dependsOn: compileJava)
|
||||||
bundledSignatures += 'jdk-non-portable'
|
bundledSignatures += 'jdk-non-portable'
|
||||||
}
|
}
|
||||||
|
|
||||||
task forbiddenApis
|
task forbiddenApis {
|
||||||
project.tasks.withType( CheckForbiddenApis ).each { task ->
|
description 'Grouping task for all defined forbidden-apis tasks'
|
||||||
def outputFile = project.file( "${buildDir}/forbidden-apis/${task.name}-output.txt" )
|
}
|
||||||
|
|
||||||
task.classesDirs = project.sourceSets.main.output.classesDirs
|
project.tasks.withType( CheckForbiddenApis ) {
|
||||||
task.classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath
|
outputs.upToDateWhen { true }
|
||||||
task.targetCompatibility = project.forbiddenAPITargetJDKCompatibility
|
|
||||||
|
|
||||||
task.outputs.file outputFile
|
classesDirs = project.sourceSets.main.output
|
||||||
|
classpath = configurations.runtimeClasspath + configurations.compileClasspath
|
||||||
|
targetCompatibility = project.forbiddenAPITargetJDKCompatibility
|
||||||
|
|
||||||
// This slows down the checks a little, but is necessary to avoid the gradle deamon holding on
|
// This slows down the checks a little, but is necessary to avoid the gradle daemon holding on
|
||||||
// to class definitions loaded previously - even possibly in a previous build.
|
// to class definitions loaded previously - even possibly in a previous build.
|
||||||
task.disableClassloadingCache = true
|
disableClassloadingCache = true
|
||||||
|
|
||||||
tasks.forbiddenApis.finalizedBy task
|
tasks.forbiddenApis.finalizedBy it
|
||||||
|
|
||||||
task.doLast {
|
|
||||||
outputFile.parentFile.mkdirs()
|
|
||||||
outputFile.createNewFile()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
project.tasks.check.finalizedBy tasks.forbiddenApis
|
project.tasks.check.finalizedBy tasks.forbiddenApis
|
||||||
|
|
|
@ -10,20 +10,6 @@ apply plugin : 'java'
|
||||||
|
|
||||||
apply from: rootProject.file( 'gradle/base-information.gradle' )
|
apply from: rootProject.file( 'gradle/base-information.gradle' )
|
||||||
|
|
||||||
configurations {
|
|
||||||
javadocSources {
|
|
||||||
canBeConsumed = true
|
|
||||||
canBeResolved = false
|
|
||||||
description = 'Configuration for accessing the sources that should be included in the javadoc for the project'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
sourceSets.main.allJava.srcDirs.each { srcDir ->
|
|
||||||
javadocSources srcDir
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
exclude( "**/internal/*" )
|
exclude( "**/internal/*" )
|
||||||
exclude( "**/generated-src/**" )
|
exclude( "**/generated-src/**" )
|
||||||
|
|
|
@ -6,4 +6,8 @@ apply plugin: 'idea'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
// minimize changes, at least for now (gradle uses 'build' by default)..
|
// minimize changes, at least for now (gradle uses 'build' by default)..
|
||||||
buildDir = "target"
|
buildDir = "target"
|
||||||
|
|
||||||
|
configurations.all {
|
||||||
|
exclude group: 'xml-apis', module: 'xml-apis'
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ import groovy.json.JsonSlurper
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* 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>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
apply from: rootProject.file( 'gradle/base-information.gradle' )
|
apply from: rootProject.file( 'gradle/module.gradle' )
|
||||||
apply from: rootProject.file( 'gradle/libraries.gradle' )
|
apply from: rootProject.file( 'gradle/libraries.gradle' )
|
||||||
|
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
|
|
|
@ -156,11 +156,8 @@ include 'metamodel-generator'
|
||||||
project(':metamodel-generator').projectDir = new File(rootProject.projectDir, "tooling/metamodel-generator")
|
project(':metamodel-generator').projectDir = new File(rootProject.projectDir, "tooling/metamodel-generator")
|
||||||
project(':metamodel-generator').name = 'hibernate-jpamodelgen'
|
project(':metamodel-generator').name = 'hibernate-jpamodelgen'
|
||||||
|
|
||||||
//include 'hibernate-gradle-plugin'
|
include 'hibernate-gradle-plugin'
|
||||||
//project(':hibernate-gradle-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-gradle-plugin")
|
project(':hibernate-gradle-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-gradle-plugin")
|
||||||
|
|
||||||
//include 'project-template'
|
|
||||||
//project(':project-template').projectDir = new File(rootProject.projectDir, "tooling/project-template")
|
|
||||||
|
|
||||||
include 'hibernate-enhance-maven-plugin'
|
include 'hibernate-enhance-maven-plugin'
|
||||||
project(':hibernate-enhance-maven-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-enhance-maven-plugin")
|
project(':hibernate-enhance-maven-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-enhance-maven-plugin")
|
||||||
|
|
|
@ -9,12 +9,15 @@ import org.apache.tools.ant.filters.ReplaceTokens
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'java-gradle-plugin'
|
id 'java-gradle-plugin'
|
||||||
id 'com.gradle.plugin-publish' version '0.16.0'
|
id 'com.gradle.plugin-publish' version '0.20.0'
|
||||||
|
|
||||||
id 'com.github.sebersole.testkit-junit5' version '1.2.0'
|
id 'com.github.sebersole.testkit-junit5' version '1.2.0'
|
||||||
|
id 'checkstyle'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: rootProject.file( 'gradle/java-module.gradle' )
|
apply from: rootProject.file( 'gradle/module.gradle' )
|
||||||
|
apply from: rootProject.file( 'gradle/javadoc.gradle' )
|
||||||
|
apply from: rootProject.file( 'gradle/libraries.gradle' )
|
||||||
apply from: rootProject.file( 'gradle/releasable.gradle' )
|
apply from: rootProject.file( 'gradle/releasable.gradle' )
|
||||||
|
|
||||||
description = "Gradle plugin for integrating Hibernate aspects into your build"
|
description = "Gradle plugin for integrating Hibernate aspects into your build"
|
||||||
|
@ -63,6 +66,9 @@ pluginBundle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.release {
|
||||||
|
dependsOn tasks.publishPlugins
|
||||||
|
}
|
||||||
task publish {
|
task publish {
|
||||||
dependsOn tasks.publishPlugins
|
dependsOn tasks.publishPlugins
|
||||||
}
|
}
|
||||||
|
@ -87,14 +93,12 @@ else {
|
||||||
" Using the JDK that runs Gradle for Groovy compilation." )
|
" Using the JDK that runs Gradle for Groovy compilation." )
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
checkstyle {
|
||||||
// Needs add-opens because Gradle uses illegal accesses to inject... mocks? Something like that.
|
sourceSets = [ project.sourceSets.main ]
|
||||||
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
|
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
|
||||||
|
showViolations = false
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.release {
|
|
||||||
dependsOn tasks.publishPlugins
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
if ( project.ormVersion.isSnapshot ) {
|
if ( project.ormVersion.isSnapshot ) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.tooling.gradle;
|
package org.hibernate.orm.tooling.gradle;
|
||||||
|
|
||||||
import jakarta.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
import org.gradle.api.Action;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.tooling.gradle.enhance;
|
package org.hibernate.orm.tooling.gradle.enhance;
|
||||||
|
|
||||||
import jakarta.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.provider.Property;
|
import org.gradle.api.provider.Property;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package org.hibernate.orm.tooling.gradle.enhance;
|
package org.hibernate.orm.tooling.gradle.enhance;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import jakarta.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask;
|
import org.gradle.api.DefaultTask;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package org.hibernate.orm.tooling.gradle.metamodel;
|
package org.hibernate.orm.tooling.gradle.metamodel;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import jakarta.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.gradle.api.JavaVersion;
|
import org.gradle.api.JavaVersion;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.net.URLClassLoader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import jakarta.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import jakarta.persistence.SharedCacheMode;
|
import jakarta.persistence.SharedCacheMode;
|
||||||
import jakarta.persistence.ValidationMode;
|
import jakarta.persistence.ValidationMode;
|
||||||
import jakarta.persistence.spi.ClassTransformer;
|
import jakarta.persistence.spi.ClassTransformer;
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class ObjectFactory {
|
||||||
Consumer<Component> componentConsumer) {
|
Consumer<Component> componentConsumer) {
|
||||||
if ( propertyValueMapping instanceof BasicValue ) {
|
if ( propertyValueMapping instanceof BasicValue ) {
|
||||||
final BasicValue basicValue = (BasicValue) propertyValueMapping;
|
final BasicValue basicValue = (BasicValue) propertyValueMapping;
|
||||||
return basicValue.resolve().getDomainJavaDescriptor().getJavaTypeClass();
|
return basicValue.resolve().getDomainJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( propertyValueMapping instanceof Component ) {
|
if ( propertyValueMapping instanceof Component ) {
|
||||||
|
@ -191,7 +191,7 @@ public class ObjectFactory {
|
||||||
|
|
||||||
if ( partJavaType instanceof BasicValue ) {
|
if ( partJavaType instanceof BasicValue ) {
|
||||||
final BasicValue basicValue = (BasicValue) partJavaType;
|
final BasicValue basicValue = (BasicValue) partJavaType;
|
||||||
return basicValue.resolve().getDomainJavaDescriptor().getJavaTypeClass();
|
return basicValue.resolve().getDomainJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( partJavaType instanceof Component ) {
|
if ( partJavaType instanceof Component ) {
|
||||||
|
|
|
@ -19,6 +19,10 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'jakarta.persistence:jakarta.persistence-api:3.0.0'
|
||||||
|
}
|
||||||
|
|
||||||
hibernate {
|
hibernate {
|
||||||
enhancement {
|
enhancement {
|
||||||
lazyInitialization( true )
|
lazyInitialization( true )
|
||||||
|
|
Loading…
Reference in New Issue