Class Builder

java.lang.Object
org.bytedeco.javacpp.tools.Builder

public class Builder extends Object
The Builder is responsible for coordinating efforts between the Parser, the Generator, and the native compiler. It contains the main() method, and basically takes care of the tasks one would expect from a command line build tool, but can also be used programmatically by setting its properties and calling build().
Author:
Samuel Audet
  • Constructor Details

    • Builder

      public Builder()
      Default constructor that simply initializes everything.
    • Builder

      public Builder(Logger logger)
      Constructor that simply initializes everything.
      Parameters:
      logger - where to send messages
  • Method Details

    • classPaths

      public Builder classPaths(String classPaths)
      Splits argument with File.pathSeparator and appends result to paths of the classScanner.
    • classPaths

      public Builder classPaths(String... classPaths)
      Appends argument to the paths of the classScanner.
    • encoding

      public Builder encoding(String encoding)
      Sets the encoding field to the argument.
    • outputDirectory

      public Builder outputDirectory(String outputDirectory)
      Sets the outputDirectory field to the argument.
    • outputDirectory

      public Builder outputDirectory(File outputDirectory)
      Sets the outputDirectory field to the argument.
    • clean

      public Builder clean(boolean clean)
      Sets the clean field to the argument.
    • generate

      public Builder generate(boolean generate)
      Sets the generate field to the argument.
    • compile

      public Builder compile(boolean compile)
      Sets the compile field to the argument.
    • deleteJniFiles

      public Builder deleteJniFiles(boolean deleteJniFiles)
      Sets the deleteJniFiles field to the argument.
    • header

      public Builder header(boolean header)
      Sets the header field to the argument.
    • copyLibs

      public Builder copyLibs(boolean copyLibs)
      Sets the copyLibs field to the argument.
    • copyResources

      public Builder copyResources(boolean copyResources)
      Sets the copyResources field to the argument.
    • outputName

      public Builder outputName(String outputName)
      Sets the outputName field to the argument.
    • configDirectory

      public Builder configDirectory(String configDirectory)
      Sets the configDirectory field to the argument.
    • configDirectory

      public Builder configDirectory(File configDirectory)
      Sets the configDirectory field to the argument.
    • jarPrefix

      public Builder jarPrefix(String jarPrefix)
      Sets the jarPrefix field to the argument.
    • properties

      public Builder properties(String platform)
      Sets the properties field to the ones loaded from resources for the specified platform.
    • properties

      public Builder properties(Properties properties)
      Adds all the properties of the argument to the properties field.
    • propertyFile

      public Builder propertyFile(String filename) throws IOException
      Sets the properties field to the ones loaded from the specified file.
      Throws:
      IOException
    • propertyFile

      public Builder propertyFile(File propertyFile) throws IOException
      Sets the properties field to the ones loaded from the specified file.
      Throws:
      IOException
    • property

      public Builder property(String keyValue)
      Sets a property of the properties field, in either "key=value" or "key:value" format.
    • property

      public Builder property(String key, String value)
      Sets a key/value pair property of the properties field.
    • getProperties

      public Properties getProperties()
      Returns properties.
    • getProperty

      public String getProperty(String key)
      Returns properties.getProperty(key).
    • addProperty

      public Builder addProperty(String key, String... values)
      Adds values to a given property key, seperating them with "platform.path.separator".
    • classesOrPackages

      public Builder classesOrPackages(String... classesOrPackages) throws IOException, ClassNotFoundException, NoClassDefFoundError
      Requests the classScanner to add a class or all classes from a package. A null argument indicates the unnamed package.
      Throws:
      IOException
      ClassNotFoundException
      NoClassDefFoundError
    • buildCommand

      public Builder buildCommand(String[] buildCommand)
      Sets the buildCommand field to the argument.
    • workingDirectory

      public Builder workingDirectory(String workingDirectory)
      Sets the workingDirectory field to the argument.
    • workingDirectory

      public Builder workingDirectory(File workingDirectory)
      Sets the workingDirectory field to the argument.
    • environmentVariables

      public Builder environmentVariables(Map<String,String> environmentVariables)
      Sets the environmentVariables field to the argument.
    • compilerOptions

      public Builder compilerOptions(String... options)
      Appends arguments to the compilerOptions field.
    • commandExecutor

      public Builder commandExecutor(CommandExecutor commandExecutor)
      Sets the commandExecutor field to the argument.
    • build

      Starts the build process and returns an array of File produced.
      Returns:
      the array of File produced
      Throws:
      IOException
      InterruptedException
      ParserException
    • printHelp

      public static void printHelp()
      Simply prints out to the display the command line usage.
    • main

      public static void main(String[] args) throws Exception
      The terminal shell interface to the Builder.
      Parameters:
      args - an array of arguments as described by printHelp()
      Throws:
      Exception