diff --git a/build.gradle b/build.gradle index 82b07d78..1fd2498b 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,7 @@ plugins { id 'java-library' id 'antlr' id 'maven-publish' + id 'signing' // https://plugins.gradle.org/plugin/com.palantir.revapi id 'com.palantir.revapi' version '1.7.0' // https://plugins.gradle.org/plugin/org.fulib.fulibGradle @@ -44,56 +45,55 @@ repositories { mavenCentral() } -nexusPublishing { - repositories { - sonatype() - } +nexusPublishing.repositories.sonatype() + +java { + withJavadocJar() + withSourcesJar() } -publishing { - publications { - mavenJava(MavenPublication) { - from(components.java) - pom { - name = project.name - description = project.description - url = 'https://github.com/fujaba/fulib' - inceptionYear = '2018' - - scm { - url = 'https://github.com/fujaba/fulib' - } - - licenses { - license { - name = 'MIT License' - url = 'https://www.opensource.org/licenses/mit-license.php' - } - } - - developers { - developer { - id = 'zuendorf' - name = 'Albert Zuendorf' - } - developer { - id = 'digitalhoax' - name = 'Tobias George' - } - developer { - id = 'eicke123' - name = 'Christoph Eickhoff' - } - developer { - id = 'Clashsoft' - name = 'Adrian Kunz' - } - } +publishing.publications.create('mavenJava', MavenPublication) { + it.from(components.java) + it.pom { + name = project.name + description = project.description + url = 'https://github.com/fujaba/fulib' + inceptionYear = '2018' + + scm { + url = 'https://github.com/fujaba/fulib' + } + + licenses { + license { + name = 'MIT License' + url = 'https://www.opensource.org/licenses/mit-license.php' + } + } + + developers { + developer { + id = 'zuendorf' + name = 'Albert Zuendorf' + } + developer { + id = 'digitalhoax' + name = 'Tobias George' + } + developer { + id = 'eicke123' + name = 'Christoph Eickhoff' + } + developer { + id = 'Clashsoft' + name = 'Adrian Kunz' } } } } +signing.sign publishing.publications.mavenJava + dependencies { // https://mvnrepository.com/artifact/org.fulib/fulibScenarios fulibScenarios group: 'org.fulib', name: 'fulibScenarios', version: '1.7.0' diff --git a/docs/sdmlib-migration.md b/docs/sdmlib-migration.md new file mode 100644 index 00000000..4e2a41b0 --- /dev/null +++ b/docs/sdmlib-migration.md @@ -0,0 +1,19 @@ +# Migrating from SDMLib + +SDMLib syntax can be migrated to fulib decorator syntax with a few regular expressions: + +> The examples assume a `ClassModelManager model` parameter. + +```regexp +(\w+).(with|create)Attribute\( +model.haveAttribute($1, + +(\w+).(with|create)UniDirectional\((\w+), "(\w+)", (ONE|MANY)\) +model.associate($1, "$3", $4, $2, null, 0) + +(\w+).(with|create)Bidirectional\((\w+), "(\w+)", (ONE|MANY), "(\w+)", (ONE|MANY)\) +model.associate($1, "$3", $4, $2, "$5", $6) + +\)\.withSuperClazz\( +, +``` diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102e..2e6e5897 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/org/fulib/util/AbstractGenerator4ClassFile.java b/src/main/java/org/fulib/util/AbstractGenerator4ClassFile.java index 31311252..2cfb24fd 100644 --- a/src/main/java/org/fulib/util/AbstractGenerator4ClassFile.java +++ b/src/main/java/org/fulib/util/AbstractGenerator4ClassFile.java @@ -115,16 +115,12 @@ public STGroup getSTGroup(String origFileName) private STGroup loadSTGroup(String origFileName) { - STGroup group; - try + STGroup group = new STGroupFile(origFileName); + if (this.customTemplatesFile != null) { - group = new STGroupFile(this.customTemplatesFile); - STGroup origGroup = new STGroupFile(origFileName); - group.importTemplates(origGroup); - } - catch (Exception e) - { - group = new STGroupFile(origFileName); + final STGroup custom = new STGroupFile(this.customTemplatesFile); + custom.importTemplates(group); + group = custom; } group.registerRenderer(String.class, new FulibStringRenderer()); return group;