Class Protoc.Builder
java.lang.Object
org.xolstice.maven.plugin.protobuf.Protoc.Builder
- Enclosing class:
Protoc
This class builds
Protoc
instances.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate File
A directory into which C++ source files will be generated.private File
A directory into which C# source files will be generated.private File
A directory into which a custom protoc plugin will generate files.private File
private final String
Path to theprotoc
executable.private boolean
private boolean
private File
A directory into which Java Nano source files will be generated.private File
A directory into which Java source files will be generated.private File
A directory into which JavaScript source files will be generated.private String
private String
private String
private File
private final List
<ProtocPlugin> private final LinkedHashSet
<File> private File
A directory into which Python source files will be generated.private File
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPlugin
(ProtocPlugin plugin) Adds a protoc plugin definition for custom code generation.addProtoFile
(File protoFile) Adds a proto file to be compiled.addProtoFiles
(Iterable<File> protoFiles) Adds a collection of proto files to be compiled.addProtoPathElement
(File protopathElement) Adds theprotopathElement
to the protopath.addProtoPathElements
(Iterable<File> protopathElements) Adds a number of elements to the protopath.build()
Builds and returns a fully configured instance ofProtoc
wrapper.private void
checkProtoFileIsInProtopath
(File protoFile) private boolean
checkProtoFileIsInProtopathHelper
(File directory) setCppOutputDirectory
(File cppOutputDirectory) Sets the directory into which C++ source files will be generated.setCsharpOutputDirectory
(File csharpOutputDirectory) Sets the directory into which C# source files will be generated.setCustomOutputDirectory
(File customOutputDirectory) Sets the directory into which a custom protoc plugin will generate files.setJavaNanoOutputDirectory
(File javaNanoOutputDirectory) Sets the directory into which JavaNano source files will be generated.setJavaOutputDirectory
(File javaOutputDirectory) Sets the directory into which Java source files will be generated.setJavaScriptOutputDirectory
(File javaScriptOutputDirectory) Sets the directory into which JavaScript source files will be generated.setNativePluginExecutable
(String nativePluginExecutable) setNativePluginId
(String nativePluginId) setNativePluginParameter
(String nativePluginParameter) setPluginDirectory
(File pluginDirectory) setPythonOutputDirectory
(File pythonOutputDirectory) Sets the directory into which Python source files will be generated.setTempDirectory
(File tempDirectory) useArgumentFile
(boolean useArgumentFile) private void
Validates the internal state for consistency and completeness.withDescriptorSetFile
(File descriptorSetFile, boolean includeImports, boolean includeSourceInfoInDescriptorSet)
-
Field Details
-
executable
Path to theprotoc
executable. -
protopathElements
-
protoFiles
-
plugins
-
tempDirectory
-
pluginDirectory
-
nativePluginId
-
nativePluginExecutable
-
nativePluginParameter
-
javaOutputDirectory
A directory into which Java source files will be generated. -
javaNanoOutputDirectory
A directory into which Java Nano source files will be generated. -
cppOutputDirectory
A directory into which C++ source files will be generated. -
pythonOutputDirectory
A directory into which Python source files will be generated. -
csharpOutputDirectory
A directory into which C# source files will be generated. -
javaScriptOutputDirectory
A directory into which JavaScript source files will be generated. -
customOutputDirectory
A directory into which a custom protoc plugin will generate files. -
descriptorSetFile
-
includeImportsInDescriptorSet
private boolean includeImportsInDescriptorSet -
includeSourceInfoInDescriptorSet
private boolean includeSourceInfoInDescriptorSet -
useArgumentFile
private boolean useArgumentFile
-
-
Constructor Details
-
Builder
Builder(String executable) Constructs a new builder.- Parameters:
executable
- The path to theprotoc
executable.
-
-
Method Details
-
setTempDirectory
-
setJavaOutputDirectory
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
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
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
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
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
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
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
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
Adds a protoc plugin definition for custom code generation.- Parameters:
plugin
- plugin definition- Returns:
- this builder instance.
-
setPluginDirectory
-
setNativePluginId
-
setNativePluginExecutable
-
setNativePluginParameter
-
withDescriptorSetFile
public Protoc.Builder withDescriptorSetFile(File descriptorSetFile, boolean includeImports, boolean includeSourceInfoInDescriptorSet) -
useArgumentFile
-
checkProtoFileIsInProtopath
-
checkProtoFileIsInProtopathHelper
-
addProtoFiles
Adds a collection of proto files to be compiled.- Parameters:
protoFiles
- a collection of source protobuf definition files.- Returns:
- this builder instance.
- See Also:
-
addProtoPathElement
Adds theprotopathElement
to the protopath.- Parameters:
protopathElement
- A directory to be searched for imported protocol buffer definitions.- Returns:
- The builder.
-
addProtoPathElements
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:
-
validateState
private void validateState()Validates the internal state for consistency and completeness. -
build
Builds and returns a fully configured instance ofProtoc
wrapper.- Returns:
- a configured
Protoc
instance.
-