2
0
Fork 0
mirror of https://github.com/ethauvin/rife2-hello.git synced 2025-04-26 07:47:13 -07:00

Minor cleanup

This commit is contained in:
Erik C. Thauvin 2023-02-27 18:48:12 -08:00
parent d954e75cf5
commit 269971663b
2 changed files with 6 additions and 9 deletions

View file

@ -43,10 +43,10 @@ public class Rife2Plugin implements Plugin<Project> {
public static final String DEFAULT_TEMPLATES_DIR = "src/main/templates"; public static final String DEFAULT_TEMPLATES_DIR = "src/main/templates";
public static final String DEFAULT_GENERATED_RIFE2_CLASSES_DIR = "generated/classes/rife2"; public static final String DEFAULT_GENERATED_RIFE2_CLASSES_DIR = "generated/classes/rife2";
public static final String WEBAPP_SRCDIR = "src/main/webapp";
public static final String RIFE2_GROUP = "rife2"; public static final String RIFE2_GROUP = "rife2";
public static final String WEBAPP_SRCDIR = "src/main/webapp";
@Override @Override
public void apply(Project project) { public void apply(Project project) {
var plugins = project.getPlugins(); var plugins = project.getPlugins();
@ -201,7 +201,7 @@ public class Rife2Plugin implements Plugin<Project> {
Configuration rife2CompilerClasspath) { Configuration rife2CompilerClasspath) {
return project.getTasks().register("precompileTemplates", PrecompileTemplates.class, task -> { return project.getTasks().register("precompileTemplates", PrecompileTemplates.class, task -> {
task.setGroup(RIFE2_GROUP); task.setGroup(RIFE2_GROUP);
task.setDescription("Pre-compile the templates."); task.setDescription("Pre-compiles the templates.");
task.getVerbose().convention(true); task.getVerbose().convention(true);
task.getClasspath().from(rife2CompilerClasspath); task.getClasspath().from(rife2CompilerClasspath);
task.getType().convention("html"); task.getType().convention("html");
@ -214,7 +214,7 @@ public class Rife2Plugin implements Plugin<Project> {
Configuration rife2CompilerClasspath) { Configuration rife2CompilerClasspath) {
project.getTasks().register("run", RunTask.class, task -> { project.getTasks().register("run", RunTask.class, task -> {
task.setGroup(RIFE2_GROUP); task.setGroup(RIFE2_GROUP);
task.setDescription("Runs this project as an application."); task.setDescription("Runs this project as a web application.");
task.getAgentClassPath().set(rife2CompilerClasspath.getAsPath()); task.getAgentClassPath().set(rife2CompilerClasspath.getAsPath());
task.getClasspath().from(project.getExtensions().getByType(SourceSetContainer.class) task.getClasspath().from(project.getExtensions().getByType(SourceSetContainer.class)
.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath()); .getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath());

View file

@ -23,7 +23,6 @@ import org.gradle.api.tasks.*;
import org.gradle.process.ExecOperations; import org.gradle.process.ExecOperations;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@CacheableTask @CacheableTask
@ -49,9 +48,7 @@ public abstract class RunTask extends DefaultTask {
getExecOperations().javaexec(run -> { getExecOperations().javaexec(run -> {
run.setClasspath(getProject().getObjects().fileCollection().from(getTemplatesDirectory()).plus(getClasspath())); run.setClasspath(getProject().getObjects().fileCollection().from(getTemplatesDirectory()).plus(getClasspath()));
run.getMainClass().set(getMainClass()); run.getMainClass().set(getMainClass());
List<String> args = new ArrayList<>(); run.args(List.of("-javaagent:" + getAgentClassPath().get()));
args.add("-javaagent:" + getAgentClassPath().get());
run.args(args);
}); });
} }
} }