Package com.carrotsearch.hppc.generator
Class TemplateProcessorMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.carrotsearch.hppc.generator.TemplateProcessorMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="template-processor", defaultPhase=GENERATE_SOURCES, threadSafe=true, requiresProject=true) public class TemplateProcessorMojo extends org.apache.maven.plugin.AbstractMojo
Maven mojo applying preprocessor templates.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
attachSources
boolean
incremental
private java.util.HashMap<java.lang.String,IntrinsicMethod>
intrinsics
java.io.File
outputDir
private java.nio.file.Path
outputPath
private org.apache.maven.project.MavenProject
project
java.io.File
templatesDir
private java.nio.file.Path
templatesPath
private com.google.common.base.Stopwatch
timeComments
private com.google.common.base.Stopwatch
timeIntrinsics
private com.google.common.base.Stopwatch
timeTypeClassRefs
private com.google.common.base.Stopwatch
timeVelocity
private org.apache.velocity.runtime.RuntimeInstance
velocity
boolean
verbose
-
Constructor Summary
Constructors Constructor Description TemplateProcessorMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.List<TemplateFile>
collectTemplateFiles(java.nio.file.Path dir)
Collect all template files from this and subdirectories.void
execute()
private void
execute0()
private java.lang.String
filterComments(java.lang.String input)
private java.lang.String
filterIntrinsics(java.lang.String input, TemplateOptions templateOptions)
private java.lang.String
filterStaticTokens(java.lang.String template, TemplateOptions templateOptions)
private java.lang.String
filterTypeClassRefs(java.lang.String input, TemplateOptions options)
private java.lang.String
filterVelocity(TemplateFile f, java.lang.String template, TemplateOptions options)
Apply velocity to the input.private void
generate(TemplateFile input, java.util.List<OutputFile> outputs, TemplateOptions templateOptions)
Apply templates.private java.util.List<OutputFile>
processTemplates(java.util.List<TemplateFile> inputs)
Apply templates to.ktype
files (single-argument).private java.util.List<java.nio.file.Path>
removeOtherFiles(java.nio.file.Path outputPath, java.util.List<OutputFile> keep)
private java.util.List<java.nio.file.Path>
scanFilesMatching(java.nio.file.Path dir, java.lang.String matchPattern)
private java.lang.String
targetFileName(java.lang.String relativePath, TemplateOptions templateOptions)
private void
verboseLog(java.lang.String message)
-
-
-
Field Detail
-
intrinsics
private final java.util.HashMap<java.lang.String,IntrinsicMethod> intrinsics
-
project
@Parameter(property="project", readonly=true, required=true) private org.apache.maven.project.MavenProject project
-
verbose
@Parameter(defaultValue="false") public boolean verbose
-
incremental
@Parameter(property="template.processor.incremental", defaultValue="true") public boolean incremental
-
attachSources
@Parameter(required=true) public java.lang.String attachSources
-
templatesDir
@Parameter(required=true) public java.io.File templatesDir
-
outputDir
@Parameter(required=true) public java.io.File outputDir
-
velocity
private org.apache.velocity.runtime.RuntimeInstance velocity
-
templatesPath
private java.nio.file.Path templatesPath
-
outputPath
private java.nio.file.Path outputPath
-
timeVelocity
private com.google.common.base.Stopwatch timeVelocity
-
timeIntrinsics
private com.google.common.base.Stopwatch timeIntrinsics
-
timeTypeClassRefs
private com.google.common.base.Stopwatch timeTypeClassRefs
-
timeComments
private com.google.common.base.Stopwatch timeComments
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
execute0
private void execute0() throws java.io.IOException, org.apache.maven.plugin.MojoExecutionException
- Throws:
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
-
removeOtherFiles
private java.util.List<java.nio.file.Path> removeOtherFiles(java.nio.file.Path outputPath, java.util.List<OutputFile> keep) throws java.io.IOException
- Throws:
java.io.IOException
-
verboseLog
private void verboseLog(java.lang.String message)
-
processTemplates
private java.util.List<OutputFile> processTemplates(java.util.List<TemplateFile> inputs) throws java.io.IOException
Apply templates to.ktype
files (single-argument).- Throws:
java.io.IOException
-
generate
private void generate(TemplateFile input, java.util.List<OutputFile> outputs, TemplateOptions templateOptions) throws java.io.IOException
Apply templates.- Throws:
java.io.IOException
-
filterStaticTokens
private java.lang.String filterStaticTokens(java.lang.String template, TemplateOptions templateOptions)
-
filterIntrinsics
private java.lang.String filterIntrinsics(java.lang.String input, TemplateOptions templateOptions)
-
filterComments
private java.lang.String filterComments(java.lang.String input)
-
filterTypeClassRefs
private java.lang.String filterTypeClassRefs(java.lang.String input, TemplateOptions options)
-
filterVelocity
private java.lang.String filterVelocity(TemplateFile f, java.lang.String template, TemplateOptions options)
Apply velocity to the input.
-
targetFileName
private java.lang.String targetFileName(java.lang.String relativePath, TemplateOptions templateOptions)
-
scanFilesMatching
private java.util.List<java.nio.file.Path> scanFilesMatching(java.nio.file.Path dir, java.lang.String matchPattern) throws java.io.IOException
- Throws:
java.io.IOException
-
collectTemplateFiles
private java.util.List<TemplateFile> collectTemplateFiles(java.nio.file.Path dir) throws java.io.IOException
Collect all template files from this and subdirectories.- Throws:
java.io.IOException
-
-