JythoncAntTask (Jython API documentation)
Date: 2022-09-10

org.python.util

## Class JythoncAntTask

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.Task
    - - org.apache.tools.ant.taskdefs.MatchingTask
      - - org.python.util.JythoncAntTask

- All Implemented Interfaces:
    java.lang.Cloneable, org.apache.tools.ant.types.selectors.SelectorContainer

      public class JythoncAntTask
      extends org.apache.tools.ant.taskdefs.MatchingTask

  Jythonc is a Python compiler into Java Bytecode. So you can call your python code from Java, and call you java code from Python, create bean, servlet...

  The task is a directory based task, so attributes like includes="*.py" and excludes="broken.py" can be used to control the files pulled in. By default, all *.py files from the project folder down are included in the command.

  Version:
    1.0
  Author:
    Cyrille Morvan - cmorvan@ingenosya.com - Ingenosya France

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JythoncAntTask()` constructor set up the search pattern

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.tools.ant.types.Path` | `createClasspath()` Add a classpath.
    `void` | `execute()` Exectute the compiler.
    `java.lang.String` | `getCompilerOptions()` get the compiler option, null if none.
    `java.io.File` | `getJythoncPY()` Get the path to the jython compiler file (in python).
    `java.io.File` | `getPythonHome()` Get the path to the jython home (or python home)
    `void` | `setAddpackages(java.lang.String aValue)` Include Java dependencies from this list of packages.
    `void` | `setAll(boolean aValue)` Include all of the Jython libraries (everything in core + compiler and parser).
    `void` | `setArgs(java.lang.String aValue)` sets some additional args to send to jythonc.
    `void` | `setBean(java.io.File aJarFileBean)` Compile into jarfile, including the correct manifest for the bean.
    `void` | `setClasspath(org.apache.tools.ant.types.Path aClasspath)` Sets the classpath field.
    `void` | `setCompiler(java.lang.String aCompiler)` Set the compiler.
    `void` | `setCompileropts(java.lang.String aValue)` Options passed directly to the Java compiler.
    `void` | `setCore(boolean aValue)` Include the core Jython libraries (about 130K).
    `void` | `setDeep(boolean aValue)` Compile all Python dependencies of the module.
    `void` | `setDestdir(java.io.File aFile)` Home for the destination (build).
    `void` | `setFalsenames(java.lang.String aValue)` A comma-separated list of names that are always false.
    `void` | `setHome(java.io.File aFile)` Jython home directory.
    `void` | `setJar(java.io.File aJarFile)` Specifies a .jar file to create and put the results of the freeze into.
    `void` | `setJythoncpy(java.io.File aValue)` Change the default Python compiler.
    `void` | `setPackage(java.lang.String aString)` Put all compiled code into the named Java package.
    `void` | `setSkip(java.lang.String aValue)` Don't include any of these modules in compilation.
    `void` | `setSrcdir(java.io.File aFile)` Home for the source.
    `void` | `setWorkdir(java.io.File aValue)` Specify the working directory where the generated Java source code is placed.

    - ### Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask

      `add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems`

    - ### Methods inherited from class org.apache.tools.ant.Task

      `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, init, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

    - ### Methods inherited from class org.apache.tools.ant.ProjectComponent

      `clone, getDescription, getLocation, getProject, setDescription, setLocation`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JythoncAntTask

          public JythoncAntTask()

      constructor set up the search pattern

  - ### Method Detail

    - #### createClasspath

          public org.apache.tools.ant.types.Path createClasspath()

      Add a classpath. Used to handle the nested classpath element.
      Returns:
        A Path object representing the classpath to be used.

    - #### setClasspath

          public void setClasspath(org.apache.tools.ant.types.Path aClasspath)

      Sets the classpath field.
      Parameters:
        `aClasspath` - A Path object representing the "classpath" attribute.

    - #### setPackage

          public void setPackage(java.lang.String aString)

      Put all compiled code into the named Java package.
      Parameters:
        `aString` - the packake name.

    - #### setJar

          public void setJar(java.io.File aJarFile)

      Specifies a .jar file to create and put the results of the freeze into. Set the deep option to true.

    - #### setCore

          public void setCore(boolean aValue)

      Include the core Jython libraries (about 130K). Needed for applets since Netscape doesn't yet support multiple archives. Set the deep option to true.

    - #### setAll

          public void setAll(boolean aValue)

      Include all of the Jython libraries (everything in core + compiler and parser). Set the deep option to true.

    - #### setBean

          public void setBean(java.io.File aJarFileBean)

      Compile into jarfile, including the correct manifest for the bean.

    - #### setSkip

          public void setSkip(java.lang.String aValue)

      Don't include any of these modules in compilation. This is a comma-separated list of modules.

    - #### setDeep

          public void setDeep(boolean aValue)

      Compile all Python dependencies of the module. This is used for creating applets.

    - #### setAddpackages

          public void setAddpackages(java.lang.String aValue)

      Include Java dependencies from this list of packages. Default is org.python.modules and org.apache.oro.text.regex.

    - #### setWorkdir

          public void setWorkdir(java.io.File aValue)

      Specify the working directory where the generated Java source code is placed. Default is "./jpywork"

    - #### setCompiler

          public void setCompiler(java.lang.String aCompiler)

      Set the compiler.

    - #### setCompileropts

          public void setCompileropts(java.lang.String aValue)

      Options passed directly to the Java compiler. Alternatively, you can set the property python.jythonc.compileropts in the registry.

    - #### setFalsenames

          public void setFalsenames(java.lang.String aValue)

      A comma-separated list of names that are always false. Can be used to short-circuit if clauses.

    - #### setHome

          public void setHome(java.io.File aFile)

      Jython home directory.

    - #### setSrcdir

          public void setSrcdir(java.io.File aFile)

      Home for the source.

    - #### setDestdir

          public void setDestdir(java.io.File aFile)

      Home for the destination (build).

    - #### setJythoncpy

          public void setJythoncpy(java.io.File aValue)

      Change the default Python compiler.

    - #### setArgs

          public void setArgs(java.lang.String aValue)

      sets some additional args to send to jythonc.

    - #### getCompilerOptions

          public java.lang.String getCompilerOptions()

      get the compiler option, null if none.

    - #### getPythonHome

          public java.io.File getPythonHome()

      Get the path to the jython home (or python home)

    - #### getJythoncPY

          public java.io.File getJythoncPY()

      Get the path to the jython compiler file (in python).

    - #### execute

          public void execute()

      Exectute the compiler.
      Overrides:
        `execute` in class `org.apache.tools.ant.Task`

Jython homepage