Package scala_maven
Class ScalaCompilerSupport
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- scala_maven.ScalaMojoSupport
-
- scala_maven.ScalaSourceMojoSupport
-
- scala_maven.ScalaCompilerSupport
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
ScalaCompileMojo
,ScalaContinuousCompileMojo
,ScalaTestCompileMojo
public abstract class ScalaCompilerSupport extends ScalaSourceMojoSupport
Abstract parent of all Scala Mojo who run compilation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ScalaCompilerSupport.LastCompilationInfo
-
Field Summary
Fields Modifier and Type Field Description private long
_lastCompileAt
private java.lang.String
addZincArgs
Additional parameter to use to call zinc server It is a pipe '|' separated list of arguments, so it can be used from command line ("-DaddZincArgs=arg1|arg2|arg3|...").static java.lang.String
ALL
private boolean
compileErrors
Keeps track of if we get compile errors in incremental modeprivate java.lang.String
compileOrder
Compile order for Scala and Java sources for sbt incremental compile.private SbtIncrementalCompiler
incremental
static java.lang.String
INCREMENTAL
static java.lang.String
MODIFIED_ONLY
private boolean
notifyCompilation
notifyCompilation if true then print a message "path: compiling" for each root directory or files that will be compiled.protected java.lang.String
recompileMode
Recompile mode to use when sources were previously compiled and there is at least one change: "modified-only" => only modified sources are recompiled (pre 2.13 behavior), "all" => all sources are recompiled, "incremental" => incrementally recompile modified sources and other affected sources.private boolean
useZincServer
Use zinc server for incremental recompilation.private java.lang.String
zincHost
Zinc server host, if running with incremental zinc server mode.private int
zincPort
Zinc server port, if running with incremental zinc server mode.-
Fields inherited from class scala_maven.ScalaSourceMojoSupport
excludes, includes, sendJavaToScalac
-
Fields inherited from class scala_maven.ScalaMojoSupport
addJavacArgs, addScalacArgs, args, checkMultipleScalaVersions, compilerPlugins, dependencies, displayCmd, encoding, factory, failOnMultipleScalaVersions, forceUseArgFile, fork, JAR, javacArgs, javacGenerateDebugSymbols, jvmArgs, localRepo, mavenProjectBuilder, POM, project, reactorProjects, remoteRepos, resolver, SCALA_COMPILER_ARTIFACTID, SCALA_LIBRARY_ARTIFACTID, scalaClassName, session, source, target, toolchainManager, useCanonicalPath
-
-
Constructor Summary
Constructors Constructor Description ScalaCompilerSupport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
clearCompileErrors()
protected int
compile(java.util.List<java.io.File> sourceRootDirs, java.io.File outputDir, java.io.File analysisCacheFile, java.util.List<java.lang.String> classpathElements, boolean compileInLoop)
protected java.io.File
defaultAnalysisCacheFile(org.apache.maven.project.MavenProject p)
protected java.io.File
defaultAnalysisDirectory(org.apache.maven.project.MavenProject p)
protected java.io.File
defaultTestAnalysisCacheFile(org.apache.maven.project.MavenProject p)
protected void
doExecute()
protected abstract java.io.File
getAnalysisCacheFile()
Analysis cache file for incremental recompilation.protected java.util.Map<java.io.File,java.io.File>
getAnalysisCacheMap()
protected abstract java.util.List<java.lang.String>
getClasspathElements()
protected java.util.List<java.io.File>
getFilesToCompile(java.util.List<java.io.File> sourceRootDirs, long lastSuccessfullCompileTime)
protected abstract java.io.File
getOutputDir()
protected boolean
hasCompileErrors()
Returns true if the previous compile failedprotected int
incrementalCompile(java.util.List<java.lang.String> classpathElements, java.util.List<java.io.File> sourceRootDirs, java.io.File outputDir, java.io.File cacheFile, boolean compileInLoop)
private void
notifyCompilation(java.util.List<java.io.File> files)
-
Methods inherited from class scala_maven.ScalaSourceMojoSupport
findSourceWithFilters, findSourceWithFilters, getSourceDirectories, initFilters, normalize
-
Methods inherited from class scala_maven.ScalaMojoSupport
addCompilerPluginOptions, addCompilerToClasspath, addLibraryToClasspath, addToClasspath, addToClasspath, addToClasspath, addToClasspath, checkScalaVersion, execute, findScalaVersion, findVersionFromDependencies, findVersionFromPluginArtifacts, getAllDependencies, getArtifactJar, getArtifactJar, getCompilerDependencies, getCompilerJar, getCompilerPluginOptions, getDependencies, getEmptyScalaCommand, getEmptyScalaCommand, getJavacOptions, getLibraryJar, getPluginArtifactJar, getPluginArtifactJar, getScalaCommand, getScalaCommand, getScalaOptions, getScalaOrganization, isJavaSupportedByCompiler, resolveArtifactDependencies, resolveDependencyArtifacts, resolveDependencyArtifacts, scalaCompilerArtifact
-
-
-
-
Field Detail
-
ALL
public static final java.lang.String ALL
- See Also:
- Constant Field Values
-
MODIFIED_ONLY
public static final java.lang.String MODIFIED_ONLY
- See Also:
- Constant Field Values
-
INCREMENTAL
public static final java.lang.String INCREMENTAL
- See Also:
- Constant Field Values
-
compileErrors
private boolean compileErrors
Keeps track of if we get compile errors in incremental mode
-
recompileMode
@Parameter(property="recompileMode", defaultValue="all") protected java.lang.String recompileMode
Recompile mode to use when sources were previously compiled and there is at least one change: "modified-only" => only modified sources are recompiled (pre 2.13 behavior), "all" => all sources are recompiled, "incremental" => incrementally recompile modified sources and other affected sources.
-
notifyCompilation
@Parameter(property="notifyCompilation", defaultValue="true") private boolean notifyCompilation
notifyCompilation if true then print a message "path: compiling" for each root directory or files that will be compiled. Useful for debug, and for integration with Editor/IDE to reset markers only for compiled files.
-
_lastCompileAt
private long _lastCompileAt
-
incremental
private SbtIncrementalCompiler incremental
-
compileOrder
@Parameter(property="compileOrder", defaultValue="mixed") private java.lang.String compileOrder
Compile order for Scala and Java sources for sbt incremental compile. Can be Mixed, JavaThenScala, or ScalaThenJava.
-
useZincServer
@Parameter(property="useZincServer", defaultValue="false") private boolean useZincServer
Use zinc server for incremental recompilation.
-
zincPort
@Parameter(property="zincPort", defaultValue="3030") private int zincPort
Zinc server port, if running with incremental zinc server mode.
-
zincHost
@Parameter(property="zincHost", defaultValue="127.0.0.1") private java.lang.String zincHost
Zinc server host, if running with incremental zinc server mode. Defaults to 127.0.0.1.
-
addZincArgs
@Parameter(property="addZincArgs") private java.lang.String addZincArgs
Additional parameter to use to call zinc server It is a pipe '|' separated list of arguments, so it can be used from command line ("-DaddZincArgs=arg1|arg2|arg3|...").
-
-
Method Detail
-
getOutputDir
protected abstract java.io.File getOutputDir() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getClasspathElements
protected abstract java.util.List<java.lang.String> getClasspathElements() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getAnalysisCacheFile
protected abstract java.io.File getAnalysisCacheFile() throws java.lang.Exception
Analysis cache file for incremental recompilation.- Throws:
java.lang.Exception
-
doExecute
protected void doExecute() throws java.lang.Exception
- Specified by:
doExecute
in classScalaMojoSupport
- Throws:
java.lang.Exception
-
compile
protected int compile(java.util.List<java.io.File> sourceRootDirs, java.io.File outputDir, java.io.File analysisCacheFile, java.util.List<java.lang.String> classpathElements, boolean compileInLoop) throws java.lang.Exception, java.lang.InterruptedException
- Throws:
java.lang.Exception
java.lang.InterruptedException
-
hasCompileErrors
protected boolean hasCompileErrors()
Returns true if the previous compile failed
-
clearCompileErrors
protected void clearCompileErrors()
-
getFilesToCompile
protected java.util.List<java.io.File> getFilesToCompile(java.util.List<java.io.File> sourceRootDirs, long lastSuccessfullCompileTime) throws java.lang.Exception
- Throws:
java.lang.Exception
-
notifyCompilation
private void notifyCompilation(java.util.List<java.io.File> files) throws java.lang.Exception
- Throws:
java.lang.Exception
-
incrementalCompile
protected int incrementalCompile(java.util.List<java.lang.String> classpathElements, java.util.List<java.io.File> sourceRootDirs, java.io.File outputDir, java.io.File cacheFile, boolean compileInLoop) throws java.lang.Exception, java.lang.InterruptedException
- Throws:
java.lang.Exception
java.lang.InterruptedException
-
getAnalysisCacheMap
protected java.util.Map<java.io.File,java.io.File> getAnalysisCacheMap()
-
defaultAnalysisDirectory
protected java.io.File defaultAnalysisDirectory(org.apache.maven.project.MavenProject p)
-
defaultAnalysisCacheFile
protected java.io.File defaultAnalysisCacheFile(org.apache.maven.project.MavenProject p)
-
defaultTestAnalysisCacheFile
protected java.io.File defaultTestAnalysisCacheFile(org.apache.maven.project.MavenProject p)
-
-