Skip to content

Commit

Permalink
Including language in generated source path
Browse files Browse the repository at this point in the history
  • Loading branch information
Devon Stewart committed Feb 20, 2021
1 parent 471e9c0 commit 2ff6c93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ guardrail {
!result.output.contains("Error")

[
file('functionalTest/build/guardrail-petstoreClient'),
file('functionalTest/build/guardrail-petstoreServer')
file('functionalTest/build/guardrail-sources/scala/com/foobar/generated/petstore/client/pets'),
file('functionalTest/build/guardrail-sources/java/com/foobar/generated/petstore/server/pet')
].each {
it.exists()
it.directorySize() > 0
Expand Down
9 changes: 8 additions & 1 deletion src/main/groovy/com/twilio/guardrail/GuardrailGen.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class GuardrailGen extends DefaultTask {

@OutputDirectory
File outputDir
private File defaultOutputDir = null

@Input
@Optional
Expand Down Expand Up @@ -55,6 +56,7 @@ class GuardrailGen extends DefaultTask {

GuardrailGen() {
outputDir = new File(project.buildDir, 'guardrail-sources')
defaultOutputDir = outputDir
}

@TaskAction
Expand All @@ -67,7 +69,12 @@ class GuardrailGen extends DefaultTask {

args << "--$kind"
args << '--specPath' << inputFile.path
args << '--outputPath' << outputDir.path
// Why do builds need to be able to override this?
if (outputDir != defaultOutputDir) {
args << '--outputPath' << outputDir.path
} else {
args << '--outputPath' << new File(outputDir, language).path
}
args << '--packageName' << packageName

if (tracing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class GuardrailGradlePlugin implements Plugin<Project> {
guardrail.gen = createGuardrailGen(project, guardrail.name)

project.tasks.guardrail.dependsOn(guardrail.gen)

guardrail.gen.outputDir = new File(project.buildDir, "guardrail-${guardrail.name}")
}
}

Expand Down

0 comments on commit 2ff6c93

Please sign in to comment.