xpybuild.utils.java

Support classes for the Java targets in xpybuild.targets.java.

create_manifest

xpybuild.utils.java.create_manifest(path, properties, options)[source]

Create a manifest file in path from the map properties.

Parameters
  • path – The absolute path in which to create a manifest file. If None is specified, no file is written but a byte string containing the file contents is returned.

  • properties – A map of manifest keys to values (unicode character strings). Must follow java jar file format specification, e.g. headers cannot contain spaces.

  • options – The options to use for creating the manifest (prefix: jar.manifest)

javac

xpybuild.utils.java.javac(output, inputs, classpath, options, logbasename, targetname, workDir)[source]

Compile some java files to class files.

Will raise BuildException if compilation fails.

Parameters
  • output – path to a directory in which to put the class files (will be created)

  • inputs – list of paths (.java files) to be compiled

  • classpath – classpath to compile with, as a string

  • options – options map. javac.options is a list of additional arguments, javac.source is the source version, javac.target is the target version

  • logbasename – absolute, expanded, path to a directory and filename prefix to use for files such as .err, .out, etc files

  • targetname – to log appropriate error messages

  • workDir – where temporary files are stored.

jar

xpybuild.utils.java.jar(path, manifest, sourcedir, options, preserveManifestFormatting=False, update=False, outputHandler=None)[source]

Create a jar file containing a manifest and some other files

Parameters
  • path – jar file to create. Typically this file does not already exist, but if it does then the specified files or manifest will be merged into it.

  • manifest – path to the manifest.mf file (or None to disable manifest entirely)

  • sourcedir – the directory to pack everything from (this method may add extra files to this dir)

  • options – options map. jar.options is a list of additional arguments

  • preserveManifestFormatting – an advanced option that prevents that jar executable from reformatting the specified manifest file to comply with Java conventions (also prevents manifest merging if jar already exists)

signjar

xpybuild.utils.java.signjar(path, keystore, options, alias=None, storepass=None, outputHandler=None)[source]

Signs an existing jar.

Parameters
  • path – Jar file to sign

  • keystore – The keystore with which to sign it

  • options – The current set of options to be used

  • alias – An alias for the key (optional)

  • storepass – The password for the keystore (optional)

  • outputHandler – the output handler (optional)

javadoc

xpybuild.utils.java.javadoc(path, sources, classpath, options, workDir, outputHandler)[source]

Create javadoc from sources and a set of options

Parameters
  • path – The directory under which to create the javadoc

  • sources – a list of source files

  • classpath – a list of jars for the classpath

  • options – the current set of options to use

  • workDir – where temporary files are stored

  • outputHandler – the output handler (optional)