public class Compiler extends Thread
CompilerConfig
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Compiler.CmdlinePackagerListener
Used to handle the packager messages in the command-line mode.
|
private class |
Compiler.Edge
This class is used for the classification of the edges
|
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected String |
basedir
The base directory.
|
private boolean |
compileFailed
Error code, set to true if compilation succeeded.
|
static String |
IZPACK_HOME
The IzPack home directory.
|
static String |
IZPACK_VERSION
The IzPack version.
|
protected String |
kind
The installer kind.
|
protected String |
output
The output jar filename.
|
private Packager |
packager
Collects and packs files into installation jars, as told.
|
private Properties |
properties
Key/values which are substituted at compile time in the install data
|
private VariableSubstitutor |
propertySubstitutor
Replaces the properties in the install.xml file prior to compiling
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
Compiler(String basedir,
String kind,
String output)
The constructor.
|
Compiler(String basedir,
String kind,
String output,
String compr_format)
The constructor.
|
Compiler(String basedir,
String kind,
String output,
String compr_format,
int compr_level)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomJar(CustomData ca,
URL url)
Add a custom jar to the installation.
|
void |
addCustomListener(int type,
String className,
String jarPath,
List constraints)
This method parses install.xml for defined listeners and put them in the right position.
|
void |
addJarContent(URL content)
Add jar content to the installation.
|
void |
addJarContent(URL content,
List files)
Add jar content to the installation.
|
void |
addLangPack(String iso3,
URL iso3xmlURL,
URL iso3FlagURL)
Add a lang pack to the installation.
|
void |
addNativeLibrary(String name,
URL url)
Add a native library to the installation.
|
void |
addNativeUninstallerLibrary(CustomData data)
Add an unistaller library.
|
void |
addPack(PackInfo pack)
Add a pack to the installation.
|
void |
addPanelJar(Panel panel,
URL url)
Add a panel jar to the installation.
|
boolean |
addProperty(String name,
String value)
Add a name value pair to the project property set.
|
protected void |
addRecursively(File file,
String targetdir,
List osList,
int override,
PackInfo pack,
Map additionals)
Recursive method to add files in a pack.
|
void |
addResource(String name,
URL url)
Add a resource to the installation.
|
private int |
checkBackEdges(Map edges)
This function checks for the existence of back edges.
|
void |
checkDependencies()
Checks whether the dependencies stated in the configuration file are correct.
|
void |
checkDependencies(List packs)
Checks whether the dependencies among the given Packs.
|
void |
compile()
Compiles.
|
void |
createInstaller()
Compiles the installation.
|
private int |
dfs(List packs,
Map names)
We use the dfs graph search algorithm to check whether the graph is acyclic as described in:
Thomas H.
|
private int |
dfsVisit(PackInfo u,
Map names,
Map edges) |
URL |
findIzPackResource(String path,
String desc)
Look for an IzPack resource either in the compiler jar, or within IZPACK_HOME.
|
private List |
getContainedFilePaths(URL url)
Returns a list which contains the pathes of all files which are included in the given url.
|
private String |
getFullClassName(URL url,
String className)
Returns the qualified class name for the given class.
|
String |
getKind()
Access the installation kind.
|
Packager |
getPackager()
Get the install packager.
|
PackagerListener |
getPackagerListener()
Retrieves the packager listener
|
Properties |
getProperties()
Get the properties currently known to the compileer.
|
String |
getProperty(String name)
Get the value of a property currerntly known to izpack.
|
Properties |
getVariables()
Get the packager variables.
|
static void |
main(String[] args)
The main method if the compiler is invoked by a command-line call.
|
void |
parseError(String message)
Create parse error with consistent messages.
|
void |
parseError(String message,
Throwable how) |
String |
replaceProperties(String value) |
void |
run()
The run() method.
|
void |
setGUIPrefs(GUIPrefs prefs) |
void |
setInfo(Info info) |
static void |
setIzpackHome(String izHome)
Set the IzPack home directory
|
void |
setPackagerListener(PackagerListener listener)
Sets the packager listener.
|
boolean |
setProperty(String name,
String value)
Add a name value pair to the project property set.
|
boolean |
wasSuccessful() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static final String IZPACK_VERSION
public static String IZPACK_HOME
private boolean compileFailed
private Properties properties
private VariableSubstitutor propertySubstitutor
public Compiler(String basedir, String kind, String output) throws CompilerException
basedir
- The base directory.kind
- The installer kind.output
- The installer filename.CompilerException
public Compiler(String basedir, String kind, String output, String compr_format) throws CompilerException
basedir
- The base directory.kind
- The installer kind.output
- The installer filename.compr_format
- The format which should be used for the packs.CompilerException
public Compiler(String basedir, String kind, String output, String compr_format, int compr_level) throws CompilerException
basedir
- The base directory.kind
- The installer kind.output
- The installer filename.compr_format
- The format which should be used for the packs.compr_level
- Compression level to be used if supported.CompilerException
public static void setIzpackHome(String izHome)
izHome
- - the izpack home directorypublic PackagerListener getPackagerListener()
public void setPackagerListener(PackagerListener listener)
listener
- The listener.public Properties getVariables()
public void compile()
public void run()
public void createInstaller() throws Exception
Exception
- Description of the Exceptionpublic boolean wasSuccessful()
public String replaceProperties(String value) throws CompilerException
CompilerException
public void setGUIPrefs(GUIPrefs prefs)
public Packager getPackager()
public Properties getProperties()
public String getProperty(String name)
name
- the name of the propertypublic boolean setProperty(String name, String value)
name
- the name of the propertyvalue
- the value to setpublic boolean addProperty(String name, String value)
name
- the name of the propertyvalue
- the value to setpublic void addJarContent(URL content)
content
- public void addJarContent(URL content, List files)
content
- public void addCustomJar(CustomData ca, URL url)
ca
- url
- public void addLangPack(String iso3, URL iso3xmlURL, URL iso3FlagURL)
iso3
- iso3xmlURL
- iso3FlagURL
- public void addNativeLibrary(String name, URL url) throws Exception
name
- url
- Exception
public void addNativeUninstallerLibrary(CustomData data)
data
- public void addPanelJar(Panel panel, URL url)
panel
- url
- public void addResource(String name, URL url)
name
- url
- public void checkDependencies() throws CompilerException
CompilerException
public void checkDependencies(List packs) throws CompilerException
packs
- - ListCompilerException
private int dfs(List packs, Map names)
packs
- The graphnames
- The name mapprivate int checkBackEdges(Map edges)
protected void addRecursively(File file, String targetdir, List osList, int override, PackInfo pack, Map additionals) throws IOException
file
- The file to add.targetdir
- The relative path to the parent.osList
- The target OS constraints.override
- Overriding behaviour.pack
- Pack to be packed intoadditionals
- Map which contains additional dataFileNotFoundException
- if the file does not existIOException
public URL findIzPackResource(String path, String desc) throws CompilerException
path
- the relative path (using '/' as separator) to the resource.desc
- the description of the resource used to report errorsCompilerException
public void parseError(String message) throws CompilerException
message
- Brief message explaining errorCompilerException
public void parseError(String message, Throwable how) throws CompilerException
CompilerException
public static void main(String[] args)
args
- The arguments passed on the command-line.public void addCustomListener(int type, String className, String jarPath, List constraints) throws Exception
type
- The listener type.className
- The class name.jarPath
- The jar path.constraints
- The list of constraints.Exception
- Thrown in case an error occurs.private List getContainedFilePaths(URL url) throws Exception
url
- url of the jar fileException
private String getFullClassName(URL url, String className) throws Exception
url
- url of the jar file which contains the classclassName
- short name of the class for which the full name should be resolvedException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses