Package org.eclipse.tycho.compiler.jdt
Class JDTCompiler
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.codehaus.plexus.compiler.AbstractCompiler
-
- org.eclipse.tycho.compiler.jdt.JDTCompiler
-
- All Implemented Interfaces:
org.codehaus.plexus.compiler.Compiler
,org.codehaus.plexus.logging.LogEnabled
@Component(role=org.codehaus.plexus.compiler.Compiler.class, hint="jdt") public class JDTCompiler extends org.codehaus.plexus.compiler.AbstractCompiler
See https://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_ACCESS
private static char[]
ADAPTER_ENCODING
private static char[]
ADAPTER_PREFIX
private JdkLibraryInfoProvider
jdkLibInfoProvider
(package private) static java.util.regex.Pattern
LINE_PATTERN
private static java.lang.String
SEPARATOR
private 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 void
addExternalJavaHomeArgs(java.util.List<java.lang.String> jdtCompilerArgs, java.lang.String javaHome)
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)
private void
addToCompilerArgumentsIfNotSet(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 void
checkCompilerArgs(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.CompilerResult
compileInProcess(java.lang.String[] args, org.codehaus.plexus.compiler.CompilerConfiguration config, CustomCompilerConfiguration custom)
Compile the java sources in the current JVM, without calling an external executable, usingcom.sun.tools.javac.Main
class(package private) org.codehaus.plexus.compiler.CompilerResult
compileOutOfProcess(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.String
createClasspathArgument(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)
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.CompilerResult
performCompile(org.codehaus.plexus.compiler.CompilerConfiguration config)
private static boolean
suppressEncoding(org.codehaus.plexus.compiler.CompilerConfiguration config)
private static boolean
suppressSource(org.codehaus.plexus.compiler.CompilerConfiguration config)
-
Methods inherited from class org.codehaus.plexus.compiler.AbstractCompiler
canUpdateTarget, compile, getCompilerOutputStyle, getInputFileEnding, getOutputFile, getOutputFileEnding, getPathString, getSourceFiles, getSourceFilesForSourceRoot, makeClassName, toStringArray
-
-
-
-
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:
performCompile
in interfaceorg.codehaus.plexus.compiler.Compiler
- Overrides:
performCompile
in 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.CompilerException
Compile 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, org.codehaus.plexus.compiler.CompilerConfiguration config, CustomCompilerConfiguration custom) throws org.codehaus.plexus.compiler.CompilerException
Compile the java sources in the current JVM, without calling an external executable, usingcom.sun.tools.javac.Main
class- 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.IOException
Parse 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
-
-