diff --git a/README.md b/README.md index 0cac3155..3a110050 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ +Jetbrains runtime PSA: The jetbrains runtime is known to cause test failures while compiling slbrachyura. +Either use a different JDK for compilation or use `build.bash` and then +`./offline-build.bash` for compilation. However the Jetbrains runtime will NOT be able to run +brachyura for most minecraft-related projects, will work fine with galimulator however due to +starplane using sl-deobf for remapping and thus it does not use Tiny-Remapper where the error +occurs. + # Starloader's Brachyura Brachyura is a WIP build tool with a strong focus on minecraft mods. Buildscripts are written in java. diff --git a/brachyura/src/main/java/io/github/coolcrabs/brachyura/fabric/SimpleFabricProject.java b/brachyura/src/main/java/io/github/coolcrabs/brachyura/fabric/SimpleFabricProject.java index 9d444fa2..169f9a38 100644 --- a/brachyura/src/main/java/io/github/coolcrabs/brachyura/fabric/SimpleFabricProject.java +++ b/brachyura/src/main/java/io/github/coolcrabs/brachyura/fabric/SimpleFabricProject.java @@ -225,13 +225,13 @@ public Path getModuleRoot() { } @Override - public void getTasks(@NotNull Consumer p) { - super.getTasks(p); - p.accept(Task.of("build", (ThrowingRunnable) this::build)); - getPublishTasks(p); + public void getTasks(@NotNull Consumer<@NotNull Task> sink) { + super.getTasks(sink); + sink.accept(Task.of("build", (ThrowingRunnable) this::build)); + getPublishTasks(sink); } - public void getPublishTasks(Consumer p) { + public void getPublishTasks(@NotNull Consumer<@NotNull Task> p) { p.accept(Task.of("publishToMavenLocal", (ThrowingRunnable) () -> { MavenPublisher publisher = new MavenPublisher().addRepository(new LocalMavenRepository(MavenResolver.MAVEN_LOCAL)); List mavendeps = new ArrayList<>(); diff --git a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/BuildscriptProject.java b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/BuildscriptProject.java index 64fc34e3..170213d9 100644 --- a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/BuildscriptProject.java +++ b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/BuildscriptProject.java @@ -43,7 +43,7 @@ public Path getProjectDir() { } @Override - public void getRunConfigTasks(Consumer p) { + public void getRunConfigTasks(@NotNull Consumer<@NotNull Task> p) { //noop } diff --git a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Project.java b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Project.java index 8a3f6abf..d46079df 100644 --- a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Project.java +++ b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Project.java @@ -12,7 +12,7 @@ public class Project { BaseJavaProject buildscriptIdeProject; - public void getTasks(@NotNull Consumer p) { + public void getTasks(@NotNull Consumer<@NotNull Task> p) { // no default tasks } diff --git a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Task.java b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Task.java index 570e18fe..60bd1f23 100644 --- a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Task.java +++ b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Task.java @@ -16,18 +16,22 @@ public abstract class Task { this.name = name; } + @NotNull public static Task of(@NotNull String name, BooleanSupplier run) { return new FailableNoArgTask(name, run); } + @NotNull public static Task of(@NotNull String name, Runnable run) { return new NoArgTask(name, run); } + @NotNull public static Task of(@NotNull String name, ThrowingRunnable run) { return new NoArgTask(name, run); } + @NotNull public static Task of(@NotNull String name, Consumer run) { return new TaskWithArgs(name, run); } diff --git a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Tasks.java b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Tasks.java index 35293a82..740af5a9 100644 --- a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Tasks.java +++ b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/Tasks.java @@ -9,13 +9,13 @@ import io.github.coolcrabs.brachyura.exception.TaskFailedException; -class Tasks implements Consumer { +class Tasks implements Consumer<@NotNull Task> { @NotNull private final Map tasks = new HashMap<>(); @Override - public void accept(Task task) { + public void accept(@NotNull Task task) { if (tasks.putIfAbsent(task.name, task) != null) { throw new TaskFailedException("Duplicate task for " + task.name); } diff --git a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/java/BaseJavaProject.java b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/java/BaseJavaProject.java index 849ab642..f377c13a 100644 --- a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/java/BaseJavaProject.java +++ b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/java/BaseJavaProject.java @@ -33,13 +33,13 @@ public abstract class BaseJavaProject extends Project { public abstract IdeModule[] getIdeModules(); @Override - public void getTasks(@NotNull Consumer p) { + public void getTasks(@NotNull Consumer<@NotNull Task> p) { super.getTasks(p); getIdeTasks(p); getRunConfigTasks(p); } - public void getIdeTasks(Consumer p) { + public void getIdeTasks(@NotNull Consumer<@NotNull Task> p) { for (Ide ide : Ide.getIdes()) { p.accept(Task.of(ide.ideName(), (Runnable) () -> { BaseJavaProject buildscriptProject = getBuildscriptProject(); @@ -52,7 +52,7 @@ public void getIdeTasks(Consumer p) { } } - public void getRunConfigTasks(Consumer p) { + public void getRunConfigTasks(@NotNull Consumer<@NotNull Task> p) { IdeModule[] ms = getIdeModules(); for (IdeModule m : ms) { for (IdeModule.RunConfig rc : m.runConfigs) { diff --git a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/java/SimpleJavaProject.java b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/java/SimpleJavaProject.java index 205972a0..6880975c 100644 --- a/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/java/SimpleJavaProject.java +++ b/brachyura/src/main/java/io/github/coolcrabs/brachyura/project/java/SimpleJavaProject.java @@ -104,13 +104,13 @@ public String getJarBaseName() { } @Override - public void getTasks(@NotNull Consumer p) { + public void getTasks(@NotNull Consumer<@NotNull Task> p) { super.getTasks(p); p.accept(Task.of("build", (ThrowingRunnable) this::build)); getPublishTasks(p); } - public void getPublishTasks(Consumer p) { + public void getPublishTasks(@NotNull Consumer<@NotNull Task> p) { p.accept(Task.of("publishToMavenLocal", (ThrowingRunnable) () -> { MavenPublisher publisher = new MavenPublisher().addRepository(new LocalMavenRepository(MavenResolver.MAVEN_LOCAL)); publisher.publishJar(build(), projectModule.get().dependencies.get()); diff --git a/brachyura/src/test/java/io/github/coolcrabs/brachyura/fabric/FabricProjectTest.java b/brachyura/src/test/java/io/github/coolcrabs/brachyura/fabric/FabricProjectTest.java index 9378415f..b55f77d7 100644 --- a/brachyura/src/test/java/io/github/coolcrabs/brachyura/fabric/FabricProjectTest.java +++ b/brachyura/src/test/java/io/github/coolcrabs/brachyura/fabric/FabricProjectTest.java @@ -81,10 +81,11 @@ void testProject() { @Test void ide() { //Todo better api for this? - fabricProject.getTasks(p -> { - if (p.name.equals("netbeans")) p.doTask(new String[]{}); - if (p.name.equals("idea")) p.doTask(new String[]{}); - if (p.name.equals("jdt")) p.doTask(new String[]{}); + fabricProject.getTasks(task -> { + // Slbrachyura: improved style + if (task.name.equals("netbeans") || task.name.equals("idea") || task.name.equals("jdt")) { + task.doTask(new String[] {}); + } }); }