Skip to content

Commit

Permalink
Merge pull request #129 from marytts/refactor_component
Browse files Browse the repository at this point in the history
Refactor to link with the component plugin and remove dependency to marytts-builder
  • Loading branch information
seblemaguer authored Jul 14, 2020
2 parents b27d52f + fa20f43 commit 9f641d5
Show file tree
Hide file tree
Showing 18 changed files with 1,170 additions and 322 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Gradle MaryTTS voicebuilding plugin

### Changed

- Refactor to depends to gradle-marytts-component-plugin v0.2.2
- Refactor to replace the dependency on the defunct marytts-builder by a dependecy on marytts-runtime
- Build with Gradle v6.3
- Upgrade test dependencies
- Drop testing on Oracle JDK
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ pluginBundle {

repositories {
jcenter()
gradlePluginPortal()
}

dependencies {
implementation localGroovy()
implementation group: 'de.dfki.mary', name: 'marytts-builder', version: maryttsVersion, {
implementation group: 'de.dfki.mary', name: 'marytts-runtime', version: maryttsVersion, {
exclude group: '*', module: 'groovy-all'
exclude group: '*', module: 'mwdumper'
exclude group: '*', module: 'sgt'
}
implementation group: 'de.dfki.mary', name: 'gradle-marytts-component-plugin', version: '0.2.2'
implementation group: 'org.m2ci.msp', name: 'gradle-praat-wrapper-plugin', version: '0.6'
implementation group: 'org.m2ci.msp', name: 'jtgt', version: '0.6.1'
testImplementation group: 'org.testng', name: 'testng', version: '7.0.0'
Expand Down
21 changes: 0 additions & 21 deletions src/main/groovy/de/dfki/mary/MaryttsExtension.groovy

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.gradle.api.provider.Property

class VoiceExtension {

Project project
Property<String> name
Property<String> gender
Property<String> domain
Expand All @@ -24,6 +25,7 @@ class VoiceExtension {
this.type = project.objects.property(String)
this.description = project.objects.property(String)
this.samplingRate = project.objects.property(Integer)
this.project = project
}

String getName() {
Expand All @@ -32,6 +34,8 @@ class VoiceExtension {

void setName(String name) {
this.name.set(name)
this.project.marytts.component.name = this.nameCamelCase
this.project.marytts.component.packageName = "marytts.voice.${this.nameCamelCase}"
}

String getNameCamelCase() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package de.dfki.mary.voicebuilding

import de.dfki.mary.MaryttsExtension
import de.dfki.mary.voicebuilding.tasks.GenerateServiceLoader
import de.dfki.mary.voicebuilding.tasks.GenerateSource
import de.dfki.mary.ComponentPlugin

import de.dfki.mary.voicebuilding.tasks.GenerateVoiceSource
import de.dfki.mary.voicebuilding.tasks.GenerateVoiceConfig
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand All @@ -21,35 +21,21 @@ class VoicebuildingBasePlugin implements Plugin<Project> {
project.plugins.apply JavaLibraryPlugin
project.plugins.apply GroovyPlugin
project.plugins.apply MavenPublishPlugin
project.plugins.apply ComponentPlugin

project.sourceCompatibility = '1.8'

project.extensions.create 'marytts', MaryttsExtension, project
project.marytts {
version = this.getClass().getResource('/maryttsVersion.txt')?.text
}

project.marytts.extensions.create 'voice', VoiceExtension, project
project.marytts.voice.extensions.create 'license', VoiceLicenseExtension, project

project.repositories {
jcenter()
}

project.sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
project.marytts {
component {
name = project.marytts.voice.nameCamelCase
packageName = "marytts.voice.${project.marytts.component.name}"
configBaseClass = "VoiceConfig"
}
}

project.configurations {
integrationTestCompile.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntimeOnly
}

project.dependencies {
api group: 'de.dfki.mary', name: 'marytts-runtime', version: project.marytts.version, {
exclude group: '*', module: 'groovy-all'
Expand All @@ -67,24 +53,36 @@ class VoicebuildingBasePlugin implements Plugin<Project> {
}
}

project.task('generateSource', type: GenerateSource) {
destDir = project.layout.buildDirectory.dir('generatedSrc')
project.sourceSets.main.java.srcDirs += "${destDir.get().asFile}/main/java"
project.sourceSets.test.java.srcDirs += "${destDir.get().asFile}/test/java"
project.sourceSets.integrationTest.groovy.srcDirs += "${destDir.get().asFile}/integrationTest/groovy"
project.compileJava.dependsOn it
project.compileTestJava.dependsOn it
project.compileIntegrationTestGroovy.dependsOn it

project.tasks.register 'generateVoiceConfig', GenerateVoiceConfig, {

}

project.task('generateVoiceConfig', type: GenerateVoiceConfig) {
destFile = project.layout.buildDirectory.file('voice.config')
project.tasks.register 'generateVoiceSource', GenerateVoiceSource, {
dependsOn "generateSource", "generateConfig"
testDirectory = project.file("$project.buildDir/generatedSrc/test/groovy/voice")
integrationTestDirectory = project.file("$project.buildDir/generatedSrc/integrationTest/groovy/voice")

}

project.task('generateServiceLoader', type: GenerateServiceLoader) {
destFile = project.layout.buildDirectory.file('serviceLoader.txt')
project.generateConfig {
dependsOn project.tasks.named("generateVoiceConfig")
}

project.sourceSets {
test {
groovy {
srcDirs += project.generateVoiceSource.testDirectory.get()
}
}
integrationTest {
groovy {
srcDirs += project.generateVoiceSource.integrationTestDirectory.get()
}
}
}


project.publishing {
publications {
mavenJava(MavenPublication) {
Expand Down Expand Up @@ -115,12 +113,6 @@ class VoicebuildingBasePlugin implements Plugin<Project> {
}

project.processResources {
from project.generateVoiceConfig, {
rename { "marytts/voice/$project.marytts.voice.nameCamelCase/voice.config" }
}
from project.generateServiceLoader, {
rename { 'META-INF/services/marytts.config.MaryConfig' }
}
from project.generatePomProperties, {
rename { "META-INF/maven/$project.group/voice-$project.marytts.voice.name/pom.xml" }
}
Expand All @@ -129,18 +121,6 @@ class VoicebuildingBasePlugin implements Plugin<Project> {
}
}

project.task('integrationTest', type: Test) {
useTestNG()
workingDir = project.buildDir
testClassesDirs = project.sourceSets.integrationTest.output.classesDirs
classpath = project.sourceSets.integrationTest.runtimeClasspath
systemProperty 'log4j.logger.marytts', 'INFO,stderr'
testLogging.showStandardStreams = true
reports.html.destination = project.file("$project.reporting.baseDir/$name")
project.check.dependsOn it
mustRunAfter project.test
}

project.task('run', type: JavaExec) {
classpath = project.configurations.runtimeClasspath + project.sourceSets.main.output
main = 'marytts.server.Mary'
Expand Down
Loading

0 comments on commit 9f641d5

Please sign in to comment.