Package org.eclipse.tycho.compiler.jdt
Class JDTCompiler
- java.lang.Object
-
- org.codehaus.plexus.compiler.AbstractCompiler
-
- org.eclipse.tycho.compiler.jdt.JDTCompiler
-
- All Implemented Interfaces:
org.codehaus.plexus.compiler.Compiler
@Component(role=org.codehaus.plexus.compiler.Compiler.class, hint="jdt") public class JDTCompiler extends org.codehaus.plexus.compiler.AbstractCompilerSee http://help.eclipse.org/ganymede/topic/org.eclipse.jdt.doc.isv/guide/jdt_api_options.htm
-
-
Field Summary
Fields Modifier and Type Field Description private static char[]ADAPTER_ACCESSprivate static char[]ADAPTER_ENCODINGprivate static char[]ADAPTER_PREFIXprivate JdkLibraryInfoProviderjdkLibInfoProvider(package private) static java.util.regex.PatternLINE_PATTERNprivate static java.lang.StringSEPARATORprivate static char[]SEPARATOR_CHARS
-
Constructor Summary
Constructors Constructor Description JDTCompiler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddExternalJavaHomeArgs(java.util.List<java.lang.String> jdtCompilerArgs, java.lang.String javaHome)private static voidaddMessageIfFound(java.util.List<org.codehaus.plexus.compiler.CompilerMessage> messages, java.lang.String type, java.lang.String file, int line, java.lang.String message)private voidaddToCompilerArgumentsIfNotSet(java.lang.String argument, java.lang.String value, java.util.List<java.lang.String> compilerArguments)java.lang.String[]buildCompilerArguments(org.codehaus.plexus.compiler.CompilerConfiguration config, CustomCompilerConfiguration custom, java.lang.String[] sourceFiles)private voidcheckCompilerArgs(java.util.Collection<java.util.Map.Entry<java.lang.String,java.lang.String>> argEntries, CustomCompilerConfiguration custom)check the compiler arguments.(package private) org.codehaus.plexus.compiler.CompilerResultcompileInProcess(java.lang.String[] args, CustomCompilerConfiguration custom)Compile the java sources in the current JVM, without calling an external executable, usingcom.sun.tools.javac.Mainclass(package private) org.codehaus.plexus.compiler.CompilerResultcompileOutOfProcess(java.io.File workingDirectory, java.lang.String executable, java.lang.String[] args)Compile the java sources in a external process, calling an external executable, like javac.private java.lang.StringcreateClasspathArgument(java.util.List<java.lang.String> classpath, CustomCompilerConfiguration custom)Copy the classpath to the command line with access rules included.java.lang.String[]createCommandLine(org.codehaus.plexus.compiler.CompilerConfiguration config)java.lang.StringgetCompilerId()protected static java.util.List<org.codehaus.plexus.compiler.CompilerMessage>parseModernStream(java.io.BufferedReader input)Parse the output from the compiler into a list of CompilerMessage objectsorg.codehaus.plexus.compiler.CompilerResultperformCompile(org.codehaus.plexus.compiler.CompilerConfiguration config)private static booleansuppressEncoding(org.codehaus.plexus.compiler.CompilerConfiguration config)private static booleansuppressSource(org.codehaus.plexus.compiler.CompilerConfiguration config)-
Methods inherited from class org.codehaus.plexus.compiler.AbstractCompiler
canUpdateTarget, getCompilerOutputStyle, getInputFileEnding, getLog, getLogger, getOutputFile, getOutputFileEnding, getPathString, getSourceFiles, getSourceFilesForSourceRoot, logCompiling, makeClassName
-
-
-
-
Field Detail
-
SEPARATOR
private static final java.lang.String SEPARATOR
- See Also:
- Constant Field Values
-
SEPARATOR_CHARS
private static final char[] SEPARATOR_CHARS
-
ADAPTER_PREFIX
private static final char[] ADAPTER_PREFIX
-
ADAPTER_ENCODING
private static final char[] ADAPTER_ENCODING
-
ADAPTER_ACCESS
private static final char[] ADAPTER_ACCESS
-
LINE_PATTERN
static final java.util.regex.Pattern LINE_PATTERN
-
jdkLibInfoProvider
@Requirement private JdkLibraryInfoProvider jdkLibInfoProvider
-
-
Method Detail
-
performCompile
public org.codehaus.plexus.compiler.CompilerResult performCompile(org.codehaus.plexus.compiler.CompilerConfiguration config) throws org.codehaus.plexus.compiler.CompilerException- Specified by:
performCompilein interfaceorg.codehaus.plexus.compiler.Compiler- Overrides:
performCompilein classorg.codehaus.plexus.compiler.AbstractCompiler- Throws:
org.codehaus.plexus.compiler.CompilerException
-
createCommandLine
public java.lang.String[] createCommandLine(org.codehaus.plexus.compiler.CompilerConfiguration config) throws org.codehaus.plexus.compiler.CompilerException- Throws:
org.codehaus.plexus.compiler.CompilerException
-
buildCompilerArguments
public java.lang.String[] buildCompilerArguments(org.codehaus.plexus.compiler.CompilerConfiguration config, CustomCompilerConfiguration custom, java.lang.String[] sourceFiles)
-
suppressSource
private static boolean suppressSource(org.codehaus.plexus.compiler.CompilerConfiguration config)
-
suppressEncoding
private static boolean suppressEncoding(org.codehaus.plexus.compiler.CompilerConfiguration config)
-
compileOutOfProcess
org.codehaus.plexus.compiler.CompilerResult compileOutOfProcess(java.io.File workingDirectory, java.lang.String executable, java.lang.String[] args) throws org.codehaus.plexus.compiler.CompilerExceptionCompile the java sources in a external process, calling an external executable, like javac.- Parameters:
workingDirectory- base directory where the process will be launchedexecutable- name of the executable to launchargs- arguments for the executable launched- Returns:
- CompilerResult with the errors and warnings encountered.
- Throws:
org.codehaus.plexus.compiler.CompilerException
-
compileInProcess
org.codehaus.plexus.compiler.CompilerResult compileInProcess(java.lang.String[] args, CustomCompilerConfiguration custom) throws org.codehaus.plexus.compiler.CompilerExceptionCompile the java sources in the current JVM, without calling an external executable, usingcom.sun.tools.javac.Mainclass- Parameters:
args- arguments for the compiler as they would be used in the command line javac- Returns:
- CompilerResult with the errors and warnings encountered.
- Throws:
org.codehaus.plexus.compiler.CompilerException
-
addExternalJavaHomeArgs
private void addExternalJavaHomeArgs(java.util.List<java.lang.String> jdtCompilerArgs, java.lang.String javaHome)
-
addToCompilerArgumentsIfNotSet
private void addToCompilerArgumentsIfNotSet(java.lang.String argument, java.lang.String value, java.util.List<java.lang.String> compilerArguments)
-
parseModernStream
protected static java.util.List<org.codehaus.plexus.compiler.CompilerMessage> parseModernStream(java.io.BufferedReader input) throws java.io.IOExceptionParse the output from the compiler into a list of CompilerMessage objects- Parameters:
input- The output of the compiler- Returns:
- List of CompilerMessage objects
- Throws:
java.io.IOException
-
addMessageIfFound
private static void addMessageIfFound(java.util.List<org.codehaus.plexus.compiler.CompilerMessage> messages, java.lang.String type, java.lang.String file, int line, java.lang.String message)
-
createClasspathArgument
private java.lang.String createClasspathArgument(java.util.List<java.lang.String> classpath, CustomCompilerConfiguration custom)Copy the classpath to the command line with access rules included.- Parameters:
cmd- the given command lineclasspath- the given classpath entry
-
checkCompilerArgs
private void checkCompilerArgs(java.util.Collection<java.util.Map.Entry<java.lang.String,java.lang.String>> argEntries, CustomCompilerConfiguration custom)check the compiler arguments. Extract from files specified using @, lines marked withADAPTER_PREFIX. These lines specify information that needs to be interpreted by us.- Parameters:
args- compiler arguments to process
-
getCompilerId
public java.lang.String getCompilerId()
- Specified by:
getCompilerIdin classorg.codehaus.plexus.compiler.AbstractCompiler
-
-