Class Protoc.Builder
- java.lang.Object
-
- org.xolstice.maven.plugin.protobuf.Protoc.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
cppOutputDirectory
A directory into which C++ source files will be generated.private java.io.File
csharpOutputDirectory
A directory into which C# source files will be generated.private java.io.File
customOutputDirectory
A directory into which a custom protoc plugin will generate files.private java.io.File
descriptorSetFile
private java.lang.String
executable
Path to theprotoc
executable.private boolean
includeImportsInDescriptorSet
private boolean
includeSourceInfoInDescriptorSet
private java.io.File
javaNanoOutputDirectory
A directory into which Java Nano source files will be generated.private java.io.File
javaOutputDirectory
A directory into which Java source files will be generated.private java.io.File
javaScriptOutputDirectory
A directory into which JavaScript source files will be generated.private java.lang.String
nativePluginExecutable
private java.lang.String
nativePluginId
private java.lang.String
nativePluginParameter
private java.io.File
pluginDirectory
private java.util.List<ProtocPlugin>
plugins
private java.util.List<java.io.File>
protoFiles
private java.util.LinkedHashSet<java.io.File>
protopathElements
private java.io.File
pythonOutputDirectory
A directory into which Python source files will be generated.private java.io.File
tempDirectory
private boolean
useArgumentFile
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String executable)
Constructs a new builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Protoc.Builder
addPlugin(ProtocPlugin plugin)
Adds a protoc plugin definition for custom code generation.Protoc.Builder
addProtoFile(java.io.File protoFile)
Adds a proto file to be compiled.Protoc.Builder
addProtoFiles(java.lang.Iterable<java.io.File> protoFiles)
Adds a collection of proto files to be compiled.Protoc.Builder
addProtoPathElement(java.io.File protopathElement)
Adds theprotopathElement
to the protopath.Protoc.Builder
addProtoPathElements(java.lang.Iterable<java.io.File> protopathElements)
Adds a number of elements to the protopath.Protoc
build()
Builds and returns a fully configured instance ofProtoc
wrapper.private void
checkProtoFileIsInProtopath(java.io.File protoFile)
private boolean
checkProtoFileIsInProtopathHelper(java.io.File directory)
Protoc.Builder
setCppOutputDirectory(java.io.File cppOutputDirectory)
Sets the directory into which C++ source files will be generated.Protoc.Builder
setCsharpOutputDirectory(java.io.File csharpOutputDirectory)
Sets the directory into which C# source files will be generated.Protoc.Builder
setCustomOutputDirectory(java.io.File customOutputDirectory)
Sets the directory into which a custom protoc plugin will generate files.Protoc.Builder
setJavaNanoOutputDirectory(java.io.File javaNanoOutputDirectory)
Sets the directory into which JavaNano source files will be generated.Protoc.Builder
setJavaOutputDirectory(java.io.File javaOutputDirectory)
Sets the directory into which Java source files will be generated.Protoc.Builder
setJavaScriptOutputDirectory(java.io.File javaScriptOutputDirectory)
Sets the directory into which JavaScript source files will be generated.Protoc.Builder
setNativePluginExecutable(java.lang.String nativePluginExecutable)
Protoc.Builder
setNativePluginId(java.lang.String nativePluginId)
Protoc.Builder
setNativePluginParameter(java.lang.String nativePluginParameter)
Protoc.Builder
setPluginDirectory(java.io.File pluginDirectory)
Protoc.Builder
setPythonOutputDirectory(java.io.File pythonOutputDirectory)
Sets the directory into which Python source files will be generated.Protoc.Builder
setTempDirectory(java.io.File tempDirectory)
Protoc.Builder
useArgumentFile(boolean useArgumentFile)
private void
validateState()
Validates the internal state for consistency and completeness.Protoc.Builder
withDescriptorSetFile(java.io.File descriptorSetFile, boolean includeImports, boolean includeSourceInfoInDescriptorSet)
-
-
-
Field Detail
-
executable
private final java.lang.String executable
Path to theprotoc
executable.
-
protopathElements
private final java.util.LinkedHashSet<java.io.File> protopathElements
-
protoFiles
private final java.util.List<java.io.File> protoFiles
-
plugins
private final java.util.List<ProtocPlugin> plugins
-
tempDirectory
private java.io.File tempDirectory
-
pluginDirectory
private java.io.File pluginDirectory
-
nativePluginId
private java.lang.String nativePluginId
-
nativePluginExecutable
private java.lang.String nativePluginExecutable
-
nativePluginParameter
private java.lang.String nativePluginParameter
-
javaOutputDirectory
private java.io.File javaOutputDirectory
A directory into which Java source files will be generated.
-
javaNanoOutputDirectory
private java.io.File javaNanoOutputDirectory
A directory into which Java Nano source files will be generated.
-
cppOutputDirectory
private java.io.File cppOutputDirectory
A directory into which C++ source files will be generated.
-
pythonOutputDirectory
private java.io.File pythonOutputDirectory
A directory into which Python source files will be generated.
-
csharpOutputDirectory
private java.io.File csharpOutputDirectory
A directory into which C# source files will be generated.
-
javaScriptOutputDirectory
private java.io.File javaScriptOutputDirectory
A directory into which JavaScript source files will be generated.
-
customOutputDirectory
private java.io.File customOutputDirectory
A directory into which a custom protoc plugin will generate files.
-
descriptorSetFile
private java.io.File descriptorSetFile
-
includeImportsInDescriptorSet
private boolean includeImportsInDescriptorSet
-
includeSourceInfoInDescriptorSet
private boolean includeSourceInfoInDescriptorSet
-
useArgumentFile
private boolean useArgumentFile
-
-
Method Detail
-
setTempDirectory
public Protoc.Builder setTempDirectory(java.io.File tempDirectory)
-
setJavaOutputDirectory
public Protoc.Builder setJavaOutputDirectory(java.io.File javaOutputDirectory)
Sets the directory into which Java source files will be generated.- Parameters:
javaOutputDirectory
- a directory into which Java source files will be generated.- Returns:
- this builder instance.
-
setJavaNanoOutputDirectory
public Protoc.Builder setJavaNanoOutputDirectory(java.io.File javaNanoOutputDirectory)
Sets the directory into which JavaNano source files will be generated.- Parameters:
javaNanoOutputDirectory
- a directory into which Java source files will be generated.- Returns:
- this builder instance.
-
setCppOutputDirectory
public Protoc.Builder setCppOutputDirectory(java.io.File cppOutputDirectory)
Sets the directory into which C++ source files will be generated.- Parameters:
cppOutputDirectory
- a directory into which C++ source files will be generated.- Returns:
- this builder instance.
-
setPythonOutputDirectory
public Protoc.Builder setPythonOutputDirectory(java.io.File pythonOutputDirectory)
Sets the directory into which Python source files will be generated.- Parameters:
pythonOutputDirectory
- a directory into which Python source files will be generated.- Returns:
- this builder instance.
-
setCsharpOutputDirectory
public Protoc.Builder setCsharpOutputDirectory(java.io.File csharpOutputDirectory)
Sets the directory into which C# source files will be generated.- Parameters:
csharpOutputDirectory
- a directory into which C# source files will be generated.- Returns:
- this builder instance.
-
setJavaScriptOutputDirectory
public Protoc.Builder setJavaScriptOutputDirectory(java.io.File javaScriptOutputDirectory)
Sets the directory into which JavaScript source files will be generated.- Parameters:
javaScriptOutputDirectory
- a directory into which JavaScript source files will be generated.- Returns:
- this builder instance.
-
setCustomOutputDirectory
public Protoc.Builder setCustomOutputDirectory(java.io.File customOutputDirectory)
Sets the directory into which a custom protoc plugin will generate files.- Parameters:
customOutputDirectory
- a directory into which a custom protoc plugin will generate files.- Returns:
- this builder instance.
-
addProtoFile
public Protoc.Builder addProtoFile(java.io.File protoFile)
Adds a proto file to be compiled. Proto files must be on the protopath and this method will fail if a proto file is added without first adding a parent directory to the protopath.- Parameters:
protoFile
- source protobuf definitions file.- Returns:
- The builder.
-
addPlugin
public Protoc.Builder addPlugin(ProtocPlugin plugin)
Adds a protoc plugin definition for custom code generation.- Parameters:
plugin
- plugin definition- Returns:
- this builder instance.
-
setPluginDirectory
public Protoc.Builder setPluginDirectory(java.io.File pluginDirectory)
-
setNativePluginId
public Protoc.Builder setNativePluginId(java.lang.String nativePluginId)
-
setNativePluginExecutable
public Protoc.Builder setNativePluginExecutable(java.lang.String nativePluginExecutable)
-
setNativePluginParameter
public Protoc.Builder setNativePluginParameter(java.lang.String nativePluginParameter)
-
withDescriptorSetFile
public Protoc.Builder withDescriptorSetFile(java.io.File descriptorSetFile, boolean includeImports, boolean includeSourceInfoInDescriptorSet)
-
useArgumentFile
public Protoc.Builder useArgumentFile(boolean useArgumentFile)
-
checkProtoFileIsInProtopath
private void checkProtoFileIsInProtopath(java.io.File protoFile)
-
checkProtoFileIsInProtopathHelper
private boolean checkProtoFileIsInProtopathHelper(java.io.File directory)
-
addProtoFiles
public Protoc.Builder addProtoFiles(java.lang.Iterable<java.io.File> protoFiles)
Adds a collection of proto files to be compiled.- Parameters:
protoFiles
- a collection of source protobuf definition files.- Returns:
- this builder instance.
- See Also:
addProtoFile(File)
-
addProtoPathElement
public Protoc.Builder addProtoPathElement(java.io.File protopathElement)
Adds theprotopathElement
to the protopath.- Parameters:
protopathElement
- A directory to be searched for imported protocol buffer definitions.- Returns:
- The builder.
-
addProtoPathElements
public Protoc.Builder addProtoPathElements(java.lang.Iterable<java.io.File> protopathElements)
Adds a number of elements to the protopath.- Parameters:
protopathElements
- directories to be searched for imported protocol buffer definitions.- Returns:
- this builder instance.
- See Also:
addProtoPathElement(File)
-
validateState
private void validateState()
Validates the internal state for consistency and completeness.
-
-