Class Protoc.Builder
- java.lang.Object
-
- org.xolstice.maven.plugin.protobuf.Protoc.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.FilecppOutputDirectoryA directory into which C++ source files will be generated.private java.io.FilecsharpOutputDirectoryA directory into which C# source files will be generated.private java.io.FilecustomOutputDirectoryA directory into which a custom protoc plugin will generate files.private java.io.FiledescriptorSetFileprivate java.lang.StringexecutablePath to theprotocexecutable.private booleanincludeImportsInDescriptorSetprivate booleanincludeSourceInfoInDescriptorSetprivate java.io.FilejavaNanoOutputDirectoryA directory into which Java Nano source files will be generated.private java.io.FilejavaOutputDirectoryA directory into which Java source files will be generated.private java.io.FilejavaScriptOutputDirectoryA directory into which JavaScript source files will be generated.private java.lang.StringnativePluginExecutableprivate java.lang.StringnativePluginIdprivate java.lang.StringnativePluginParameterprivate java.io.FilepluginDirectoryprivate java.util.List<ProtocPlugin>pluginsprivate java.util.List<java.io.File>protoFilesprivate java.util.LinkedHashSet<java.io.File>protopathElementsprivate java.io.FilepythonOutputDirectoryA directory into which Python source files will be generated.private java.io.FiletempDirectoryprivate booleanuseArgumentFile
-
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.BuilderaddPlugin(ProtocPlugin plugin)Adds a protoc plugin definition for custom code generation.Protoc.BuilderaddProtoFile(java.io.File protoFile)Adds a proto file to be compiled.Protoc.BuilderaddProtoFiles(java.lang.Iterable<java.io.File> protoFiles)Adds a collection of proto files to be compiled.Protoc.BuilderaddProtoPathElement(java.io.File protopathElement)Adds theprotopathElementto the protopath.Protoc.BuilderaddProtoPathElements(java.lang.Iterable<java.io.File> protopathElements)Adds a number of elements to the protopath.Protocbuild()Builds and returns a fully configured instance ofProtocwrapper.private voidcheckProtoFileIsInProtopath(java.io.File protoFile)private booleancheckProtoFileIsInProtopathHelper(java.io.File directory)Protoc.BuildersetCppOutputDirectory(java.io.File cppOutputDirectory)Sets the directory into which C++ source files will be generated.Protoc.BuildersetCsharpOutputDirectory(java.io.File csharpOutputDirectory)Sets the directory into which C# source files will be generated.Protoc.BuildersetCustomOutputDirectory(java.io.File customOutputDirectory)Sets the directory into which a custom protoc plugin will generate files.Protoc.BuildersetJavaNanoOutputDirectory(java.io.File javaNanoOutputDirectory)Sets the directory into which JavaNano source files will be generated.Protoc.BuildersetJavaOutputDirectory(java.io.File javaOutputDirectory)Sets the directory into which Java source files will be generated.Protoc.BuildersetJavaScriptOutputDirectory(java.io.File javaScriptOutputDirectory)Sets the directory into which JavaScript source files will be generated.Protoc.BuildersetNativePluginExecutable(java.lang.String nativePluginExecutable)Protoc.BuildersetNativePluginId(java.lang.String nativePluginId)Protoc.BuildersetNativePluginParameter(java.lang.String nativePluginParameter)Protoc.BuildersetPluginDirectory(java.io.File pluginDirectory)Protoc.BuildersetPythonOutputDirectory(java.io.File pythonOutputDirectory)Sets the directory into which Python source files will be generated.Protoc.BuildersetTempDirectory(java.io.File tempDirectory)Protoc.BuilderuseArgumentFile(boolean useArgumentFile)private voidvalidateState()Validates the internal state for consistency and completeness.Protoc.BuilderwithDescriptorSetFile(java.io.File descriptorSetFile, boolean includeImports, boolean includeSourceInfoInDescriptorSet)
-
-
-
Field Detail
-
executable
private final java.lang.String executable
Path to theprotocexecutable.
-
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 theprotopathElementto 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.
-
-