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 classScalaCompilerSupport.LastCompilationInfo
-
Field Summary
Fields Modifier and Type Field Description private long_lastCompileAtprivate java.lang.StringaddZincArgsAdditional 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.StringALLprivate booleancompileErrorsKeeps track of if we get compile errors in incremental modeprivate java.lang.StringcompileOrderCompile order for Scala and Java sources for sbt incremental compile.private SbtIncrementalCompilerincrementalstatic java.lang.StringINCREMENTALstatic java.lang.StringMODIFIED_ONLYprivate booleannotifyCompilationnotifyCompilation if true then print a message "path: compiling" for each root directory or files that will be compiled.protected java.lang.StringrecompileModeRecompile 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 booleanuseZincServerUse zinc server for incremental recompilation.private java.lang.StringzincHostZinc server host, if running with incremental zinc server mode.private intzincPortZinc 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 voidclearCompileErrors()protected intcompile(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.FiledefaultAnalysisCacheFile(org.apache.maven.project.MavenProject p)protected java.io.FiledefaultAnalysisDirectory(org.apache.maven.project.MavenProject p)protected java.io.FiledefaultTestAnalysisCacheFile(org.apache.maven.project.MavenProject p)protected voiddoExecute()protected abstract java.io.FilegetAnalysisCacheFile()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.FilegetOutputDir()protected booleanhasCompileErrors()Returns true if the previous compile failedprotected intincrementalCompile(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 voidnotifyCompilation(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 recompileModeRecompile 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 notifyCompilationnotifyCompilation 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 compileOrderCompile order for Scala and Java sources for sbt incremental compile. Can be Mixed, JavaThenScala, or ScalaThenJava.
-
useZincServer
@Parameter(property="useZincServer", defaultValue="false") private boolean useZincServerUse zinc server for incremental recompilation.
-
zincPort
@Parameter(property="zincPort", defaultValue="3030") private int zincPortZinc server port, if running with incremental zinc server mode.
-
zincHost
@Parameter(property="zincHost", defaultValue="127.0.0.1") private java.lang.String zincHostZinc 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.ExceptionAnalysis cache file for incremental recompilation.- Throws:
java.lang.Exception
-
doExecute
protected void doExecute() throws java.lang.Exception- Specified by:
doExecutein 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.Exceptionjava.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.Exceptionjava.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)
-
-