com.theoryinpractise.frege.FregeTestCompileMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of frege-maven-plugin Show documentation
Show all versions of frege-maven-plugin Show documentation
Apache Maven Compiler Mojo for the Frege Language
The newest version!
package com.theoryinpractise.frege;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@Mojo(
name = "test-compile",
defaultPhase = LifecyclePhase.TEST_COMPILE,
requiresDependencyResolution = ResolutionScope.TEST
)
public class FregeTestCompileMojo extends AbstractFregeCompileMojo {
@Parameter(defaultValue = "src/test/frege")
protected File testSourceDirectory;
@Parameter(required = true, defaultValue = "${project.build.directory}/generated-test-sources")
protected File generatedTestSourcesDirectory;
@Parameter(
required = true,
defaultValue = "${project.build.directory}/generated-test-sources/frege"
)
protected File testOutputDirectory;
@Parameter(required = true, readonly = true, property = "project.testClasspathElements")
protected List testClasspathElements;
public File getOutputDirectory() {
return testOutputDirectory;
}
public List getClassPathElements() {
return testClasspathElements;
}
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
project.addTestCompileSourceRoot(testOutputDirectory.getAbsolutePath());
super.execute();
}
@Override
public List getAllSourceDirectories() {
List sourceDirectories = new ArrayList<>();
for (File file : generatedTestSourcesDirectory.listFiles()) {
if (file.isDirectory()) {
sourceDirectories.add(file);
}
}
if (testSourceDirectory.exists()) {
sourceDirectories.add(testSourceDirectory);
}
return sourceDirectories;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy