2
0
Fork 0
mirror of https://github.com/ethauvin/rife2-hello.git synced 2025-04-28 16:38:12 -07:00

Compare commits

...

2 commits

Author SHA1 Message Date
c33235a1ac Added description and group for the uberJar task. 2023-02-27 19:14:36 -08:00
269971663b Minor cleanup 2023-02-27 18:48:12 -08:00
2 changed files with 7 additions and 10 deletions

View file

@ -40,12 +40,10 @@ import java.util.Locale;
@SuppressWarnings({"ALL", "unused"})
public class Rife2Plugin implements Plugin<Project> {
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 WEBAPP_SRCDIR = "src/main/webapp";
public static final String RIFE2_GROUP = "rife2";
public static final String WEBAPP_SRCDIR = "src/main/webapp";
@Override
public void apply(Project project) {
@ -127,6 +125,8 @@ public class Rife2Plugin implements Plugin<Project> {
TaskContainer tasks,
TaskProvider<PrecompileTemplates> precompileTemplatesTask) {
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);
jar.getArchiveBaseName().convention(project.provider(() -> base.getArchivesName().get() + "-uber"));
jar.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE);
@ -201,7 +201,7 @@ public class Rife2Plugin implements Plugin<Project> {
Configuration rife2CompilerClasspath) {
return project.getTasks().register("precompileTemplates", PrecompileTemplates.class, task -> {
task.setGroup(RIFE2_GROUP);
task.setDescription("Pre-compile the templates.");
task.setDescription("Pre-compiles the templates.");
task.getVerbose().convention(true);
task.getClasspath().from(rife2CompilerClasspath);
task.getType().convention("html");
@ -214,7 +214,7 @@ public class Rife2Plugin implements Plugin<Project> {
Configuration rife2CompilerClasspath) {
project.getTasks().register("run", RunTask.class, task -> {
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.getClasspath().from(project.getExtensions().getByType(SourceSetContainer.class)
.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath());

View file

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