Skip to content

Commit e82b9c6

Browse files
committed
Issue aeron-io#642. Handle XInclude for CSharp and Golang by manipulating working and output directories.
1 parent 43b2598 commit e82b9c6

File tree

1 file changed

+40
-30
lines changed

1 file changed

+40
-30
lines changed

build.gradle

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ task generateRustCodecs {
582582
* validate those.
583583
* *) Some of the test files need an additional output directory setting
584584
* as they generate into the same directory and golang won't allow that.
585+
* *) Some examples need to fiddle with WorkingDir to deal with XInclude
585586
*/
586587
task generateGolangCodecTestComposite(type: JavaExec) {
587588
main = 'uk.co.real_logic.sbe.SbeTool'
@@ -619,7 +620,20 @@ task generateGolangCodecTestVarData(type: JavaExec) {
619620
args = ['sbe-tool/src/test/resources/basic-variable-length-schema.xml']
620621
}
621622

622-
task generateGolangCodecsWithXsd(type: JavaExec) {
623+
task generateGolangCodecsWithXIncludes(type: JavaExec) {
624+
workingDir = 'sbe-samples/src/main/resources'
625+
main = 'uk.co.real_logic.sbe.SbeTool'
626+
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
627+
systemProperties(
628+
'sbe.output.dir': '../../../../gocode/src',
629+
'sbe.target.language': 'golang',
630+
'sbe.xinclude.aware': 'true',
631+
'sbe.validation.xsd': validationXsdPath)
632+
args = ['example-schema.xml',
633+
'example-extension-schema.xml']
634+
}
635+
636+
task generateGolangCodecsWithXSD(type: JavaExec) {
623637
main = 'uk.co.real_logic.sbe.SbeTool'
624638
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
625639
systemProperties(
@@ -642,29 +656,34 @@ task generateGolangCodecsWithXsd(type: JavaExec) {
642656
'gocode/resources/simple.xml']
643657
}
644658

645-
task generateGolangCodecsWithXsdAndIncludes(type: JavaExec) {
646-
main = 'uk.co.real_logic.sbe.SbeTool'
647-
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
648-
workingDir = 'sbe-samples/src/main/resources'
649-
systemProperties(
650-
'sbe.output.dir': '../../../../gocode/src',
651-
'sbe.target.language': 'golang',
652-
'sbe.xinclude.aware': 'true',
653-
'sbe.validation.xsd': validationXsdPath)
654-
args = ['example-schema.xml', 'example-extension-schema.xml']
655-
}
656-
657659
task generateGolangCodecs {
658660
description = 'Generate golang test codecs'
659661
dependsOn 'generateGolangCodecTestVarData',
660662
'generateGolangCodecTestGroup',
661663
'generateGolangCodecTestBasic',
662664
'generateGolangCodecTestComposite',
663-
'generateGolangCodecsWithXsd',
664-
'generateGolangCodecsWithXsdAndIncludes'
665+
'generateGolangCodecsWithXIncludes',
666+
'generateGolangCodecsWithXSD'
667+
}
668+
669+
/*
670+
* CSharp codec targets used for testing, benchmarking etc. We have
671+
* multiple targets as XInclude forces us to change working dir
672+
*/
673+
task generateCSharpCodecsWithXIncludes(type: JavaExec) {
674+
workingDir = 'sbe-samples/src/main/resources'
675+
main = 'uk.co.real_logic.sbe.SbeTool'
676+
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
677+
systemProperties(
678+
'sbe.output.dir': '../../../../csharp/sbe-generated',
679+
'sbe.target.language': 'uk.co.real_logic.sbe.generation.csharp.CSharp',
680+
'sbe.xinclude.aware': 'true',
681+
'sbe.validation.xsd': validationXsdPath)
682+
args = ['example-schema.xml',
683+
'example-extension-schema.xml']
665684
}
666685

667-
task generateCSharpCodecsBase(type: JavaExec) {
686+
task generateCSharpCodecsTests(type: JavaExec) {
668687
main = 'uk.co.real_logic.sbe.SbeTool'
669688
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
670689
systemProperties(
@@ -681,23 +700,14 @@ task generateCSharpCodecsBase(type: JavaExec) {
681700
'sbe-benchmarks/src/main/resources/fix-message-samples.xml']
682701
}
683702

684-
task generateCSharpCodecsWithIncludes(type: JavaExec) {
685-
main = 'uk.co.real_logic.sbe.SbeTool'
686-
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
687-
workingDir = 'sbe-samples/src/main/resources'
688-
systemProperties(
689-
'sbe.output.dir': '../../../../csharp/sbe-generated',
690-
'sbe.target.language': 'uk.co.real_logic.sbe.generation.csharp.CSharp',
691-
'sbe.xinclude.aware': 'true',
692-
'sbe.validation.xsd': validationXsdPath)
693-
args = ['example-schema.xml', 'example-extension-schema.xml']
694-
}
695-
696703
task generateCSharpCodecs {
697-
description = 'Generate CSharp test codecs'
698-
dependsOn 'generateCSharpCodecsBase', 'generateCSharpCodecsWithIncludes'
704+
description = 'Generate csharp codecs'
705+
dependsOn 'generateCSharpCodecsTests',
706+
'generateCSharpCodecsWithXIncludes'
699707
}
700708

709+
710+
701711
task generateJavaIrCodecs(type: JavaExec) {
702712
main = 'uk.co.real_logic.sbe.SbeTool'
703713
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath

0 commit comments

Comments
 (0)