Improved build configuration to better leverage Gradle up-to-date handling;
Preparation for moving to Gradle 7.0 - Moved custom Antlr plugin to hibernate-orm-build module - more deprecation clean ups
This commit is contained in:
parent
172ddf8700
commit
59f033194a
|
@ -1 +0,0 @@
|
|||
rootProject.name = 'hibernate-build-plugin'
|
|
@ -8,36 +8,32 @@ import org.asciidoctor.gradle.AsciidoctorTask
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
ext {
|
||||
projectsToSkipWhenAggregatingJavadocs = [
|
||||
'documentation',
|
||||
'hibernate-entitymanager',
|
||||
'hibernate-gradle-plugin',
|
||||
'project-template',
|
||||
'hibernate-infinispan',
|
||||
'hibernate-ehcache',
|
||||
'hibernate-java8',
|
||||
'hibernate-integrationtest-java-modules',
|
||||
'hibernate-core-jakarta',
|
||||
'hibernate-testing-jakarta',
|
||||
'hibernate-envers-jakarta',
|
||||
'hibernate-jpamodelgen-jakarta',
|
||||
'release'
|
||||
]
|
||||
}
|
||||
def projectsToIncludeInAggregatedJavadoc = [
|
||||
':hibernate-core',
|
||||
':hibernate-testing',
|
||||
':hibernate-envers',
|
||||
':hibernate-agroal',
|
||||
':hibernate-c3p0',
|
||||
':hibernate-graalvm',
|
||||
':hibernate-hikaricp',
|
||||
':hibernate-jcache',
|
||||
':hibernate-micrometer',
|
||||
':hibernate-proxool',
|
||||
':hibernate-vibur',
|
||||
':hibernate-gradle-plugin',
|
||||
':hibernate-enhance-maven-plugin',
|
||||
':hibernate-jpamodelgen',
|
||||
]
|
||||
|
||||
rootProject.subprojects { subproject ->
|
||||
if ( !this.projectsToSkipWhenAggregatingJavadocs.contains( subproject.name ) ) {
|
||||
this.evaluationDependsOn( subproject.path )
|
||||
}
|
||||
projectsToIncludeInAggregatedJavadoc.each {projectPath ->
|
||||
evaluationDependsOn projectPath
|
||||
}
|
||||
|
||||
apply from: rootProject.file( 'gradle/java-module.gradle' )
|
||||
|
||||
apply plugin: 'org.asciidoctor.convert'
|
||||
|
||||
apply plugin: 'hibernate-matrix-testing'
|
||||
|
||||
tasks.build.dependsOn 'buildDocs'
|
||||
defaultTasks 'buildDocs'
|
||||
|
||||
|
||||
|
@ -110,7 +106,7 @@ final File javadocDir = mkdir( new File( (File) project.buildDir, 'javadocs' ) )
|
|||
* Builds the JavaDocs aggregated (unified) across all the sub-projects
|
||||
*/
|
||||
task aggregateJavadocs(type: Javadoc) {
|
||||
description = 'Builds the aggregated (unified) JavaDocs across all sub-projects'
|
||||
description = 'Builds an aggregated JavaDoc across all ORM sub-projects'
|
||||
|
||||
final int currentYear = new GregorianCalendar().get( Calendar.YEAR )
|
||||
|
||||
|
@ -165,15 +161,14 @@ task aggregateJavadocs(type: Javadoc) {
|
|||
// process each project, building up:
|
||||
// 1) appropriate sources
|
||||
// 2) classpath
|
||||
parent.subprojects.each { Project subProject->
|
||||
// skip certain sub-projects
|
||||
if ( ! projectsToSkipWhenAggregatingJavadocs.contains( subProject.name ) ) {
|
||||
// we only care about the main SourceSet...
|
||||
source subProject.sourceSets.main.java
|
||||
projectsToIncludeInAggregatedJavadoc.each {projectPath ->
|
||||
def includeProject = parent.project(projectPath)
|
||||
|
||||
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath + subProject.configurations.provided
|
||||
}
|
||||
}
|
||||
// we only care about the main SourceSet...
|
||||
source includeProject.sourceSets.main.java
|
||||
classpath += ( includeProject.sourceSets.main.output + includeProject.sourceSets.main.compileClasspath )
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tasks.asciidoctor {
|
||||
|
@ -221,8 +216,8 @@ task renderGettingStartedGuides(type: AsciidoctorTask, group: 'Documentation') {
|
|||
|
||||
task buildTutorialZip(type: Zip) {
|
||||
from 'src/main/asciidoc/quickstart/tutorials'
|
||||
destinationDir = tasks.renderGettingStartedGuides.outputDir
|
||||
archiveName = 'hibernate-tutorials.zip'
|
||||
destinationDirectory = tasks.renderGettingStartedGuides.outputDir
|
||||
archiveBaseName = 'hibernate-tutorials.zip'
|
||||
expand(
|
||||
version: project.version,
|
||||
slf4j: "1.7.5",
|
||||
|
|
|
@ -223,15 +223,6 @@ convention.findPlugin( JavaPluginConvention.class ).sourceSets.each { sourceSet
|
|||
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// mac-specific stuff
|
||||
final File toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
|
||||
if ( ext.toolsJar.exists() ) {
|
||||
dependencies{
|
||||
testCompile files( toolsJar )
|
||||
}
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Testing
|
||||
|
||||
|
|
|
@ -8,7 +8,15 @@
|
|||
apply from: rootProject.file( 'gradle/java-module.gradle' )
|
||||
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
|
||||
|
||||
configurations {
|
||||
javadocSources {
|
||||
description 'Used to aggregate javadocs for the whole project'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
javadocSources sourceSets.main.allJava
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Publishing
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
|
|||
description = 'Hibernate\'s core ORM functionality'
|
||||
|
||||
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
|
||||
apply plugin: Antlr4Plugin
|
||||
apply plugin: 'org.hibernate.orm.antlr'
|
||||
apply plugin: 'hibernate-matrix-testing'
|
||||
|
||||
ext {
|
||||
|
@ -69,7 +69,7 @@ dependencies {
|
|||
compileOnly libraries.validation
|
||||
compileOnly libraries.ant
|
||||
compileOnly libraries.cdi
|
||||
compileOnly configurations.javassist
|
||||
compileOnly libraries.javassist
|
||||
|
||||
testImplementation project(':hibernate-testing')
|
||||
testImplementation libraries.shrinkwrap_api
|
||||
|
@ -294,125 +294,3 @@ tasks.withType( Test.class ).each { test ->
|
|||
test.include 'org/hibernate/event/service/internal/**'
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Custom Antlr v4 Plugin
|
||||
// - the Gradle-supplied Antlr plugin attempts to simultaneously support
|
||||
// multiple versions of Antlr which leads to many difficulties. this custom
|
||||
// plugin provides dedicated and simplified support for Antlr v4
|
||||
|
||||
ext {
|
||||
baseAntlrInputPath = 'src/main/antlr'
|
||||
baseAntlrOutputPath = 'generated-src/antlr/main'
|
||||
}
|
||||
|
||||
class GrammarDescriptor {
|
||||
String packageName
|
||||
String grammarName
|
||||
|
||||
GrammarDescriptor(String packageName, String grammarName) {
|
||||
this.packageName = packageName
|
||||
this.grammarName = grammarName
|
||||
}
|
||||
|
||||
File resolveSourceFile(Project project) {
|
||||
return project.file(
|
||||
project.baseAntlrInputPath +
|
||||
'/' + packageName.replace( '.', '/' ) +
|
||||
'/' + grammarName + '.g4'
|
||||
)
|
||||
}
|
||||
|
||||
File resolveOutputFile(Project project) {
|
||||
final File baseOutputDir = project.file( "${project.buildDir}/${project.baseAntlrOutputPath}/" )
|
||||
final File packagedOutputDirectory = new File( baseOutputDir, packageName.replace( '.', '/' ) )
|
||||
|
||||
return new File( packagedOutputDirectory, grammarName + '.g4' )
|
||||
}
|
||||
}
|
||||
|
||||
class Antlr4Plugin implements Plugin<Project> {
|
||||
void apply(Project project) {
|
||||
project.with {
|
||||
apply plugin : 'java'
|
||||
|
||||
configurations.maybeCreate 'antlr'
|
||||
|
||||
Antlr4GenerationTask genTask = tasks.create 'antlr', Antlr4GenerationTask
|
||||
genTask.group = 'Build'
|
||||
genTask.description = 'Generate source code from ANTLR grammar'
|
||||
|
||||
tasks.getByName('compileJava').dependsOn genTask
|
||||
|
||||
SourceSet mainSourceSet = project.convention.getPlugin( JavaPluginConvention ).sourceSets.getByName( SourceSet.MAIN_SOURCE_SET_NAME );
|
||||
mainSourceSet.compileClasspath += configurations.antlr
|
||||
|
||||
SourceSet testSourceSet = project.convention.getPlugin( JavaPluginConvention ).sourceSets.getByName( SourceSet.TEST_SOURCE_SET_NAME );
|
||||
testSourceSet.compileClasspath += configurations.antlr
|
||||
|
||||
project.afterEvaluate({
|
||||
mainSourceSet.java.srcDir( genTask.outputDirectory )
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Antlr4GenerationTask extends DefaultTask {
|
||||
static final String HQL_PCKG = 'org.hibernate.grammars.hql'
|
||||
static final String IMPORT_SQL_PCKG = 'org.hibernate.grammars.importsql'
|
||||
static final String GRAPH_PCKG = 'org.hibernate.grammars.graph'
|
||||
static final String ORDER_PCKG = 'org.hibernate.grammars.ordering'
|
||||
|
||||
List<GrammarDescriptor> grammarDescriptors = [
|
||||
new GrammarDescriptor( HQL_PCKG, 'HqlLexer' ),
|
||||
new GrammarDescriptor( HQL_PCKG, 'HqlParser' ),
|
||||
new GrammarDescriptor( IMPORT_SQL_PCKG, 'SqlScriptLexer' ),
|
||||
new GrammarDescriptor( IMPORT_SQL_PCKG, 'SqlScriptParser' ),
|
||||
new GrammarDescriptor( GRAPH_PCKG, 'GraphLanguageLexer' ),
|
||||
new GrammarDescriptor( GRAPH_PCKG, 'GraphLanguageParser' ),
|
||||
new GrammarDescriptor( ORDER_PCKG, 'OrderingLexer' ),
|
||||
new GrammarDescriptor( ORDER_PCKG, 'OrderingParser' )
|
||||
]
|
||||
|
||||
@InputFiles
|
||||
@SkipWhenEmpty
|
||||
FileCollection getSource() {
|
||||
// only used for UP-TO-DATE checking
|
||||
return project.files( grammarDescriptors*.resolveSourceFile( project ) )
|
||||
}
|
||||
|
||||
@OutputDirectory
|
||||
File getOutputDirectory() {
|
||||
// only used for UP-TO-DATE checking
|
||||
return project.file( "${project.buildDir}/${project.baseAntlrOutputPath}" )
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void antlrGeneration() {
|
||||
logger.lifecycle( "Starting custom Antlr (v4) grammar generation" )
|
||||
|
||||
grammarDescriptors.forEach( { grammarDescriptor -> generate( grammarDescriptor ) } )
|
||||
}
|
||||
|
||||
def generate(GrammarDescriptor grammarDescriptor) {
|
||||
final File sourceFile = grammarDescriptor.resolveSourceFile( project )
|
||||
final File outputFile = grammarDescriptor.resolveOutputFile( project )
|
||||
|
||||
logger.lifecycle( "Starting Antlr grammar generation `${grammarDescriptor.grammarName} : [${sourceFile.absolutePath}] -> [${outputFile.absolutePath}]" )
|
||||
|
||||
outputFile.parentFile.mkdirs()
|
||||
|
||||
project.javaexec {
|
||||
main 'org.antlr.v4.Tool'
|
||||
classpath project.configurations.antlr
|
||||
args '-o', outputFile.parentFile.absolutePath
|
||||
// args '-lib', sourceFile.parentFile.absolutePath
|
||||
args '-long-messages'
|
||||
args '-listener'
|
||||
args '-visitor'
|
||||
args sourceFile.absolutePath
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ description = 'Hibernate\'s entity version (audit/history) support Jakarta editi
|
|||
apply from: rootProject.file( 'gradle/jakarta-java-module.gradle' )
|
||||
|
||||
evaluationDependsOn( ':hibernate-envers' )
|
||||
evaluationDependsOn( ':hibernate-transaction-client' )
|
||||
|
||||
dependencies {
|
||||
api( project( ':hibernate-core-jakarta' ) ) {
|
||||
|
@ -132,7 +133,7 @@ tasks.test {
|
|||
}
|
||||
}
|
||||
|
||||
tasks.test.dependsOn project( ':hibernate-transaction-client' ).tasks.jar
|
||||
tasks.test.dependsOn ':hibernate-transaction-client:jar'
|
||||
|
||||
task testJar(type: Jar, dependsOn: testClasses) {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
|
|
@ -30,6 +30,10 @@ gradlePlugin {
|
|||
id = 'org.hibernate.orm.database-service'
|
||||
implementationClass = 'org.hibernate.orm.db.DatabaseServicePlugin'
|
||||
}
|
||||
antlrPlugin {
|
||||
id = 'org.hibernate.orm.antlr'
|
||||
implementationClass = 'org.hibernate.orm.antlr.Antlr4Plugin'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
rootProject.name = 'hibernate-orm-build'
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package org.hibernate.orm.antlr;
|
||||
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.plugins.JavaPluginConvention;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
|
||||
/**
|
||||
* Custom Antlr v4 Plugin
|
||||
*
|
||||
* The Gradle-supplied Antlr plugin attempts to simultaneously support multiple
|
||||
* versions of Antlr which leads to many difficulties. This custom plugin provides
|
||||
* dedicated and simplified support for Antlr v4
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class Antlr4Plugin implements Plugin<Project> {
|
||||
public static final String HQL_PKG = "org.hibernate.grammars.hql";
|
||||
public static final String IMPORT_SQL_PKG = "org.hibernate.grammars.importsql";
|
||||
public static final String GRAPH_PKG = "org.hibernate.grammars.graph";
|
||||
public static final String ORDER_PKG = "org.hibernate.grammars.ordering";
|
||||
public static final String ANTLR = "antlr";
|
||||
|
||||
public final GrammarDescriptor[] grammarDescriptors = new GrammarDescriptor[] {
|
||||
new GrammarDescriptor( "HqlLexer", HQL_PKG ),
|
||||
new GrammarDescriptor( "HqlParser", HQL_PKG ),
|
||||
new GrammarDescriptor( "SqlScriptLexer", IMPORT_SQL_PKG ),
|
||||
new GrammarDescriptor( "SqlScriptParser", IMPORT_SQL_PKG ),
|
||||
new GrammarDescriptor( "GraphLanguageLexer", GRAPH_PKG ),
|
||||
new GrammarDescriptor( "GraphLanguageParser", GRAPH_PKG ),
|
||||
new GrammarDescriptor( "OrderingLexer", ORDER_PKG ),
|
||||
new GrammarDescriptor( "OrderingParser", ORDER_PKG )
|
||||
};
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
final Antlr4Spec antlr4Spec = project.getExtensions().create(
|
||||
Antlr4Spec.REGISTRATION_NAME,
|
||||
Antlr4Spec.class
|
||||
);
|
||||
|
||||
final Configuration antlrDependencies = project.getConfigurations().maybeCreate( ANTLR );
|
||||
|
||||
final Task groupingTask = project.getTasks().create( ANTLR );
|
||||
groupingTask.setDescription( "Performs all defined Antlr grammar generations" );
|
||||
groupingTask.setGroup( ANTLR );
|
||||
|
||||
for ( GrammarDescriptor grammarDescriptor : grammarDescriptors ) {
|
||||
final GeneratorTask generatorTask = project.getTasks().create(
|
||||
"generate" + grammarDescriptor.getGrammarName() + "Grammar",
|
||||
GeneratorTask.class,
|
||||
grammarDescriptor,
|
||||
antlr4Spec
|
||||
);
|
||||
generatorTask.setDescription( "Performs Antlr grammar generation for `" + grammarDescriptor.getGrammarName() + "`" );
|
||||
generatorTask.setGroup( ANTLR );
|
||||
groupingTask.dependsOn( generatorTask );
|
||||
}
|
||||
|
||||
final SourceSet mainSourceSet = project.getConvention()
|
||||
.getPlugin( JavaPluginConvention.class )
|
||||
.getSourceSets()
|
||||
.getByName( SourceSet.MAIN_SOURCE_SET_NAME );
|
||||
mainSourceSet.setCompileClasspath( mainSourceSet.getCompileClasspath().plus( antlrDependencies ) );
|
||||
mainSourceSet.getJava().srcDir( antlr4Spec.getOutputBaseDirectory() );
|
||||
|
||||
final Task compileTask = project.getTasks().getByName( mainSourceSet.getCompileJavaTaskName() );
|
||||
compileTask.dependsOn( groupingTask );
|
||||
|
||||
// SourceSet testSourceSet = project.convention.getPlugin( JavaPluginConvention ).sourceSets.getByName( SourceSet.TEST_SOURCE_SET_NAME );
|
||||
// testSourceSet.compileClasspath += configurations.antlr
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package org.hibernate.orm.antlr;
|
||||
|
||||
import org.gradle.api.NamedDomainObjectContainer;
|
||||
import org.gradle.api.file.DirectoryProperty;
|
||||
import org.gradle.api.file.ProjectLayout;
|
||||
import org.gradle.api.model.ObjectFactory;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class Antlr4Spec {
|
||||
public static final String REGISTRATION_NAME = "antlr4";
|
||||
|
||||
private final DirectoryProperty grammarBaseDirectory;
|
||||
private final DirectoryProperty outputBaseDirectory;
|
||||
|
||||
private final NamedDomainObjectContainer<GrammarDescriptor> grammarDescriptors;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public Antlr4Spec(ObjectFactory objectFactory, ProjectLayout layout) {
|
||||
grammarBaseDirectory = objectFactory.directoryProperty();
|
||||
grammarBaseDirectory.convention( layout.getProjectDirectory().dir( "src/main/antlr" ) );
|
||||
|
||||
outputBaseDirectory = objectFactory.directoryProperty();
|
||||
outputBaseDirectory.convention( layout.getBuildDirectory().dir( "generated-src/antlr/main" ) );
|
||||
|
||||
grammarDescriptors = objectFactory.domainObjectContainer( GrammarDescriptor.class );
|
||||
}
|
||||
|
||||
public DirectoryProperty getGrammarBaseDirectory() {
|
||||
return grammarBaseDirectory;
|
||||
}
|
||||
|
||||
public DirectoryProperty getOutputBaseDirectory() {
|
||||
return outputBaseDirectory;
|
||||
}
|
||||
|
||||
public NamedDomainObjectContainer<GrammarDescriptor> getGrammarDescriptors() {
|
||||
return grammarDescriptors;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package org.hibernate.orm.antlr;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.file.Directory;
|
||||
import org.gradle.api.file.RegularFile;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.tasks.InputFile;
|
||||
import org.gradle.api.tasks.OutputDirectory;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public abstract class GeneratorTask extends DefaultTask {
|
||||
private final Provider<RegularFile> grammarFile;
|
||||
private final Provider<Directory> outputDirectory;
|
||||
|
||||
@Inject
|
||||
public GeneratorTask(GrammarDescriptor grammarDescriptor, Antlr4Spec antlrSpec) {
|
||||
final String relativePackagePath = grammarDescriptor.getPackageName().replace( '.', '/' );
|
||||
|
||||
grammarFile = antlrSpec.getGrammarBaseDirectory().file( relativePackagePath + "/" + grammarDescriptor.getGrammarName() + ".g4" );
|
||||
outputDirectory = antlrSpec.getOutputBaseDirectory().dir( relativePackagePath );
|
||||
}
|
||||
|
||||
@InputFile
|
||||
public Provider<RegularFile> getGrammarFile() {
|
||||
return grammarFile;
|
||||
}
|
||||
|
||||
@OutputDirectory
|
||||
public Provider<Directory> getOutputDirectory() {
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
public void generate() {
|
||||
final File grammarFileAsFile = grammarFile.get().getAsFile();
|
||||
final File outputDirectoryAsFile = outputDirectory.get().getAsFile();
|
||||
|
||||
getProject().getLogger().info(
|
||||
"Starting Antlr grammar generation `{}` -> `{}`",
|
||||
grammarFileAsFile.getName(),
|
||||
outputDirectoryAsFile.getAbsolutePath()
|
||||
);
|
||||
|
||||
outputDirectoryAsFile.mkdirs();
|
||||
|
||||
getProject().javaexec(
|
||||
(javaExecSpec) -> {
|
||||
javaExecSpec.setMain( "org.antlr.v4.Tool" );
|
||||
javaExecSpec.classpath( getProject().getConfigurations().getByName( "antlr" ) );
|
||||
javaExecSpec.args(
|
||||
"-o", outputDirectoryAsFile.getAbsolutePath(),
|
||||
"-long-messages",
|
||||
"-listener",
|
||||
"-visitor",
|
||||
grammarFileAsFile.getAbsolutePath()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package org.hibernate.orm.antlr;
|
||||
|
||||
import org.gradle.api.Named;
|
||||
|
||||
/**
|
||||
* Describes a grammar for generation
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class GrammarDescriptor implements Named {
|
||||
private final String grammarName;
|
||||
private final String packageName;
|
||||
|
||||
GrammarDescriptor(String grammarName, String packageName) {
|
||||
this.grammarName = grammarName;
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getGrammarName();
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public String getGrammarName() {
|
||||
return grammarName;
|
||||
}
|
||||
}
|
|
@ -151,7 +151,7 @@ task uploadDocumentation(type:Exec) {
|
|||
*/
|
||||
distributions {
|
||||
main {
|
||||
baseName = 'hibernate-release'
|
||||
distributionBaseName = 'hibernate-release'
|
||||
contents {
|
||||
from rootProject.file( 'lgpl.txt' )
|
||||
from rootProject.file( 'changelog.txt' )
|
||||
|
|
|
@ -12,7 +12,7 @@ plugins {
|
|||
|
||||
rootProject.name = 'hibernate-orm'
|
||||
|
||||
includeBuild('database-service-plugin')
|
||||
includeBuild('hibernate-orm-build')
|
||||
|
||||
apply from: file( 'gradle/gradle-enterprise.gradle' )
|
||||
|
||||
|
|
Loading…
Reference in New Issue