Package com.theoryinpractise.clojure
Class AbstractClojureCompilerMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.theoryinpractise.clojure.AbstractClojureCompilerMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
ClojureAddSourceMojo,ClojureAddTestSourceMojo,ClojureAutodocMojo,ClojureCompilerMojo,ClojureGenDocMojo,ClojureMarginaliaMojo,ClojureNailgunMojo,ClojureNReplMojo,ClojureReplMojo,ClojureRunMojo,ClojureRunTestWithJUnitMojo,ClojureSwankMojo,TestClojureCompilerMojo
public abstract class AbstractClojureCompilerMojo extends org.apache.maven.plugin.AbstractMojo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractClojureCompilerMojo.SourceDirectory
-
Field Summary
Fields Modifier and Type Field Description protected java.io.FilebaseDirectoryprotected java.io.FilebaseTestSourceDirectoryLocation of the source files.protected java.lang.StringcharsetSource file encodingprotected java.util.List<java.lang.String>classpathElementsprivate java.lang.StringclojureOptionsClojure/Java command-line optionsprotected booleancompileDeclaredNamespaceOnlyShould we compile all namespaces or only those defined?protected java.lang.String[]copiedNamespacesA list of namespaces whose source files will be copied to the output.private booleancopyAllCompiledNamespacesShould the source files of all compiled namespaces be copied to the output? This overrides copiedNamespaces and copyDeclaredNamespaceOnly.protected booleancopyDeclaredNamespaceOnlyShould we copy the source of all namespaces or only those defined?protected java.lang.BooleandirectLinkingA list of namespaces to compile clojure.compiler.direct-linkingprotected java.io.FilegeneratedSourceDirectoryLocation of the generated source files.private booleanincludePluginDependenciesInclude plugin dependencies in classpath?protected java.lang.String[]namespacesA list of namespaces to compileprotected java.io.FileoutputDirectoryprivate java.util.List<org.apache.maven.artifact.Artifact>pluginArtifactsprivate java.util.List<java.lang.String>prependClassesClasses to put onto the command line before the main classprotected org.apache.maven.project.MavenProjectprojectprivate booleanrunWithTestsRun with test-classpath or compile-classpath?private org.apache.maven.execution.MavenSessionsessionprotected java.lang.String[]sourceDirectoriesLocation of the source files.private booleanspawnInteractiveConsoleOnWindowsSpawn a new console window for interactive clojure sessions on Windowsprotected java.util.List<java.lang.String>testClasspathElementsprotected booleantestDeclaredNamespaceOnlyShould we test all namespaces or only those defined?protected java.lang.String[]testNamespacesA list of test namespaces to compileprotected java.io.FiletestOutputDirectoryprotected java.lang.String[]testSourceDirectoriesLocation of the source files.private org.apache.maven.toolchain.ToolchainManagertoolchainManagerprivate java.lang.StringvmargsSpecify additional vmargs to use when running clojure or swank.private booleanwarnOnReflectionShould reflective invocations in Clojure source emit warnings? Corresponds with the *warn-on-reflection* var and the clojure.compile.warn-on-reflection system property.private java.lang.StringwindowsConsoleWhich Windows command to use when starting the REPLprotected java.io.FileworkingDirectoryWorking directory for forked java clojure process.
-
Constructor Summary
Constructors Constructor Description AbstractClojureCompilerMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcallClojureWith(ExecutionMode executionMode, java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, NamespaceInFile[] namespaceArgs)protected voidcallClojureWith(ExecutionMode executionMode, java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, java.lang.String[] clojureArgs)protected voidcallClojureWith(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, NamespaceInFile[] namespaceArgs)protected voidcallClojureWith(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, java.lang.String[] clojureArgs)protected voidcopyNamespaceSourceFilesToOutput(java.io.File outputDirectory, NamespaceInFile[] discoveredNamespaces)private java.io.FilecreateJar(java.lang.String cp, java.lang.String mainClass)protected java.io.FilecreateTemporaryDirectory(java.lang.String name)protected NamespaceInFile[]discoverNamespaces()protected NamespaceInFile[]discoverNamespacesToCopy()protected java.lang.StringescapeFilePath(java.io.File file)Escapes the given file path so that it's safe for inclusion in a Clojure string literal.protected java.lang.StringescapeFilePath(java.lang.String directory, java.lang.String file)Escapes the given file path so that it's safe for inclusion in a Clojure string literal.static java.lang.StringgetDefaultJavaHomeExecutable(java.util.Map<java.lang.String,java.lang.String> env)private java.lang.StringgetJavaExecutable()private java.lang.StringgetPath(java.io.File[] sourceDirectory)java.util.List<java.lang.String>getRunWithClasspathElements()java.io.File[]getSourceDirectories(AbstractClojureCompilerMojo.SourceDirectory... sourceDirectoryTypes)protected java.io.FilegetWorkingDirectory()protected booleanisClasspathResource(java.lang.String path)protected booleanisExistingTestScriptFile(java.lang.String path)private java.lang.StringmanifestClasspath(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements)private java.io.File[]translatePaths(java.lang.String[] paths)-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
project
@Parameter(required=true, readonly=true, property="project") protected org.apache.maven.project.MavenProject project
-
toolchainManager
@Component private org.apache.maven.toolchain.ToolchainManager toolchainManager
-
session
@Parameter(required=true, readonly=true, property="session") private org.apache.maven.execution.MavenSession session
-
baseDirectory
@Parameter(required=true, readonly=true, property="basedir") protected java.io.File baseDirectory
-
classpathElements
@Parameter(required=true, readonly=true, property="project.compileClasspathElements") protected java.util.List<java.lang.String> classpathElements
-
testClasspathElements
@Parameter(required=true, readonly=true, property="project.testClasspathElements") protected java.util.List<java.lang.String> testClasspathElements
-
pluginArtifacts
@Parameter(required=true, property="plugin.artifacts") private java.util.List<org.apache.maven.artifact.Artifact> pluginArtifacts
-
outputDirectory
@Parameter(required=true, defaultValue="${project.build.outputDirectory}") protected java.io.File outputDirectory
-
testOutputDirectory
@Parameter(required=true, defaultValue="${project.build.testOutputDirectory}") protected java.io.File testOutputDirectory
-
sourceDirectories
@Parameter protected java.lang.String[] sourceDirectories
Location of the source files.
-
testSourceDirectories
@Parameter protected java.lang.String[] testSourceDirectories
Location of the source files.
-
baseTestSourceDirectory
@Parameter(required=true, defaultValue="${project.build.testSourceDirectory}") protected java.io.File baseTestSourceDirectoryLocation of the source files.
-
generatedSourceDirectory
@Parameter(required=true, defaultValue="${project.build.outputDirectory}/../generated-sources") protected java.io.File generatedSourceDirectoryLocation of the generated source files.
-
workingDirectory
@Parameter protected java.io.File workingDirectory
Working directory for forked java clojure process.
-
compileDeclaredNamespaceOnly
@Parameter(defaultValue="false") protected boolean compileDeclaredNamespaceOnly
Should we compile all namespaces or only those defined?
-
namespaces
@Parameter protected java.lang.String[] namespaces
A list of namespaces to compile
-
directLinking
@Parameter(required=true, defaultValue="false") protected java.lang.Boolean directLinkingA list of namespaces to compile clojure.compiler.direct-linking
-
testDeclaredNamespaceOnly
@Parameter(defaultValue="false") protected boolean testDeclaredNamespaceOnly
Should we test all namespaces or only those defined?
-
testNamespaces
@Parameter protected java.lang.String[] testNamespaces
A list of test namespaces to compile
-
prependClasses
@Parameter private java.util.List<java.lang.String> prependClasses
Classes to put onto the command line before the main class
-
clojureOptions
@Parameter(property="clojure.options") private java.lang.String clojureOptions
Clojure/Java command-line options
-
runWithTests
@Parameter(property="clojure.runwith.test", defaultValue="true") private boolean runWithTestsRun with test-classpath or compile-classpath?
-
includePluginDependencies
@Parameter(defaultValue="false") private boolean includePluginDependencies
Include plugin dependencies in classpath?
-
copiedNamespaces
@Parameter protected java.lang.String[] copiedNamespaces
A list of namespaces whose source files will be copied to the output.
-
copyDeclaredNamespaceOnly
@Parameter(defaultValue="false") protected boolean copyDeclaredNamespaceOnly
Should we copy the source of all namespaces or only those defined?
-
charset
@Parameter(defaultValue="${project.build.sourceEncoding}") protected java.lang.String charsetSource file encoding
-
copyAllCompiledNamespaces
@Parameter(defaultValue="false") private boolean copyAllCompiledNamespaces
Should the source files of all compiled namespaces be copied to the output? This overrides copiedNamespaces and copyDeclaredNamespaceOnly.
-
warnOnReflection
@Parameter(defaultValue="false") private boolean warnOnReflection
Should reflective invocations in Clojure source emit warnings? Corresponds with the *warn-on-reflection* var and the clojure.compile.warn-on-reflection system property.
-
vmargs
@Parameter(property="clojure.vmargs") private java.lang.String vmargs
Specify additional vmargs to use when running clojure or swank.
-
spawnInteractiveConsoleOnWindows
@Parameter(defaultValue="true") private boolean spawnInteractiveConsoleOnWindows
Spawn a new console window for interactive clojure sessions on Windows
-
windowsConsole
@Parameter(defaultValue="cmd /c start") private java.lang.String windowsConsole
Which Windows command to use when starting the REPL
-
-
Method Detail
-
escapeFilePath
protected java.lang.String escapeFilePath(java.lang.String directory, java.lang.String file)Escapes the given file path so that it's safe for inclusion in a Clojure string literal.- Parameters:
directory- directory pathfile- file name- Returns:
- escaped file path, ready for inclusion in a string literal
-
escapeFilePath
protected java.lang.String escapeFilePath(java.io.File file)
Escapes the given file path so that it's safe for inclusion in a Clojure string literal.- Parameters:
file- The file whose path we want to escape- Returns:
- escaped file path, ready for inclusion in a string literal
-
getJavaExecutable
private java.lang.String getJavaExecutable() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDefaultJavaHomeExecutable
public static java.lang.String getDefaultJavaHomeExecutable(java.util.Map<java.lang.String,java.lang.String> env)
-
getWorkingDirectory
protected java.io.File getWorkingDirectory() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createTemporaryDirectory
protected java.io.File createTemporaryDirectory(java.lang.String name) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
translatePaths
private java.io.File[] translatePaths(java.lang.String[] paths)
-
discoverNamespaces
protected NamespaceInFile[] discoverNamespaces() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
discoverNamespacesToCopy
protected NamespaceInFile[] discoverNamespacesToCopy() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getSourceDirectories
public java.io.File[] getSourceDirectories(AbstractClojureCompilerMojo.SourceDirectory... sourceDirectoryTypes)
-
getRunWithClasspathElements
public java.util.List<java.lang.String> getRunWithClasspathElements()
-
copyNamespaceSourceFilesToOutput
protected void copyNamespaceSourceFilesToOutput(java.io.File outputDirectory, NamespaceInFile[] discoveredNamespaces) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
callClojureWith
protected void callClojureWith(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, NamespaceInFile[] namespaceArgs) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
callClojureWith
protected void callClojureWith(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, java.lang.String[] clojureArgs) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
callClojureWith
protected void callClojureWith(ExecutionMode executionMode, java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, NamespaceInFile[] namespaceArgs) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
callClojureWith
protected void callClojureWith(ExecutionMode executionMode, java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, java.lang.String[] clojureArgs) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
manifestClasspath
private java.lang.String manifestClasspath(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements)
-
getPath
private java.lang.String getPath(java.io.File[] sourceDirectory)
-
createJar
private java.io.File createJar(java.lang.String cp, java.lang.String mainClass)
-
isExistingTestScriptFile
protected boolean isExistingTestScriptFile(java.lang.String path)
-
isClasspathResource
protected boolean isClasspathResource(java.lang.String path)
-
-