Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add csharp code-gen time property #702

Merged
merged 1 commit into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion csharp/sbe-dll/sbe-dll.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<RepositoryUrl>https://github.com/real-logic/simple-binary-encoding</RepositoryUrl>
<PackageTags>SBE;Marshaling;Low;Latency;Simple;Binary;Encoding</PackageTags>
<PackageId>sbe-dll</PackageId>
<PackageVersion>0.1.12.1-beta-2</PackageVersion>
<PackageVersion>0.1.12.1-beta-3</PackageVersion>
<Title>Simple Binary Encoding for .NET</Title>
<Description>This package contains all you need to define SBE messages and generate C# encoders and decoders. See https://github.com/real-logic/simple-binary-encoding for more detailed instructions</Description>
<RepositoryType>git</RepositoryType>
Expand Down
8 changes: 8 additions & 0 deletions sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
* <li>
* <b>sbe.java.generate.group-order.annotation</b>: Should the GroupOrder annotation be added to generated stubs.
* </li>
* <li><b>sbe.csharp.generate.namespace.dir</b>: Should a directory be created for the namespace under
* the output directory? Defaults to true</li>
* <li><b>sbe.keyword.append.token</b>: Token to be appended to keywords.</li>
* <li><b>sbe.decode.unknown.enum.values</b>: Support unknown decoded enum values.</li>
* <li><b>sbe.xinclude.aware</b>: Is XInclude supported for the schema. Defaults to false.</li>
Expand Down Expand Up @@ -163,6 +165,12 @@ public class SbeTool
*/
public static final String JAVA_GROUP_ORDER_ANNOTATION = "sbe.java.generate.group-order.annotation";

/**
* Boolean system property to turn on or off generation of namespace directories during csharp code generation.
* Defaults to true
*/
public static final String CSHARP_GENERATE_NAMESPACE_DIR = "sbe.csharp.generate.namespace.dir";

/**
* Specifies token that should be appended to keywords to avoid compilation errors.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.nio.file.Files;

import static java.io.File.separatorChar;
import static uk.co.real_logic.sbe.SbeTool.CSHARP_GENERATE_NAMESPACE_DIR;

/**
* {@link OutputManager} for managing the creation of C# source files
Expand All @@ -48,7 +49,13 @@ public CSharpNamespaceOutputManager(final String baseDirName, final String packa
Verify.notNull(packageName, "packageName");

final String dirName = baseDirName.endsWith("" + separatorChar) ? baseDirName : baseDirName + separatorChar;
final String packageDirName = dirName + packageName.replace('.', '_');

final String packageComponment =
Boolean.parseBoolean(System.getProperty(CSHARP_GENERATE_NAMESPACE_DIR, "true")) ?
packageName.replace('.', '_') :
"";

final String packageDirName = dirName + packageComponment;

outputDir = new File(packageDirName);
if (!outputDir.exists() && !outputDir.mkdirs())
Expand Down