common utilities for code generation needs
buildscript{
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "com.satori:satori-libs-gradle-codegen:0.5.81-SNAPSHOT"
}
}
apply plugin: "com.satori.codegen"
Task to execute specified gradle project with provided args
- forProject(project): specify project to execute
task generateGtfsSchema(type: ProjectExec) {
forProject ":codegen-pbuf2jschema"
inputs.files pbufSchema
outputs.files jsonSchema
args '-schema', pbufSchema
args '-out', jsonSchema
doFirst {
println "generating gtfs json schema..."
}
}
Extension to execute specified gradle project with provided args
task generateGtfsSchema {
group "codegen"
inputs.files pbufSchema
outputs.files jsonSchema
projectExec (":codegen-pbuf2jschema") {
args '-schema', pbufSchema
args '-out', jsonSchema
println "generating gtfs json schema..."
}
}
Task to execute specified sourceSet with provided args
- forSourceSet(sourceSet): specify sourceSet to execute
task generateGraphqlClasses(type: SourceSetExec) {
forSourceSet("codegen")
inputs.file(schema)
outputs.dir(out)
sourceSets.main.java.srcDir out
main = "com.satori.libs.gradle.codegen.App"
args "-schema", schema
args "-pckg", pckg
args "-out", out
doFirst {
delete out
println "generating code...."
}
clean.doFirst {
delete out
}
}
Extension to execute specified sourceSet with provided args
task generateGraphqlClasses {
group "codegen"
inputs.file(schema)
outputs.dir(out)
sourceSets.main.java.srcDir out
sourceSetExec("codegen"){
main = "com.satori.libs.gradle.codegen.App"
args "-schema", schema
args "-pckg", pckg
args "-out", out
}
}
provides various code formatting methods, see ICodeFormatter
codeFormatter.camel(project.name)
<repository>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<dependency>
<groupId>com.satori</groupId>
<artifactId>satori-libs-gradle-codegen</artifactId>
<version>0.5.81-SNAPSHOT</version>
</dependency>