2
0
Fork 0
mirror of https://github.com/ethauvin/rife2-hello.git synced 2025-04-29 08:58:12 -07:00

Compare commits

..

No commits in common. "c33235a1accacffc37b00f6b5c4745b55ce040cc" and "d954e75cf595c8a0615217896c315a107d729f88" have entirely different histories.

2 changed files with 10 additions and 7 deletions

View file

@ -40,11 +40,13 @@ import java.util.Locale;
@SuppressWarnings({"ALL", "unused"}) @SuppressWarnings({"ALL", "unused"})
public class Rife2Plugin implements Plugin<Project> { 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 RIFE2_GROUP = "rife2";
public static final String WEBAPP_SRCDIR = "src/main/webapp"; public static final String WEBAPP_SRCDIR = "src/main/webapp";
public static final String RIFE2_GROUP = "rife2";
@Override @Override
public void apply(Project project) { public void apply(Project project) {
var plugins = project.getPlugins(); var plugins = project.getPlugins();
@ -125,8 +127,6 @@ public class Rife2Plugin implements Plugin<Project> {
TaskContainer tasks, TaskContainer tasks,
TaskProvider<PrecompileTemplates> precompileTemplatesTask) { TaskProvider<PrecompileTemplates> precompileTemplatesTask) {
return tasks.register("uberJar", Jar.class, jar -> { return tasks.register("uberJar", Jar.class, jar -> {
jar.setGroup(RIFE2_GROUP);
jar.setDescription("Assembles the web application and all dependencies into a single jar archive.");
var base = project.getExtensions().getByType(BasePluginExtension.class); var base = project.getExtensions().getByType(BasePluginExtension.class);
jar.getArchiveBaseName().convention(project.provider(() -> base.getArchivesName().get() + "-uber")); jar.getArchiveBaseName().convention(project.provider(() -> base.getArchivesName().get() + "-uber"));
jar.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE); jar.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE);
@ -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-compiles the templates."); task.setDescription("Pre-compile 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 a web application."); task.setDescription("Runs this project as an 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,6 +23,7 @@ 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
@ -48,7 +49,9 @@ 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());
run.args(List.of("-javaagent:" + getAgentClassPath().get())); List<String> args = new ArrayList<>();
args.add("-javaagent:" + getAgentClassPath().get());
run.args(args);
}); });
} }
} }