Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

Commit

Permalink
Perhaps this will magically fix the build failure
Browse files Browse the repository at this point in the history
If it does we have an issue on our hands, but I have no idea
why it errors
  • Loading branch information
Geolykt committed Jun 5, 2022
1 parent 26b7e9f commit b9499a2
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 18 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ public Path getModuleRoot() {
}

@Override
public void getTasks(@NotNull Consumer<Task> 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<Task> 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<MavenDependency> mavendeps = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Path getProjectDir() {
}

@Override
public void getRunConfigTasks(Consumer<Task> p) {
public void getRunConfigTasks(@NotNull Consumer<@NotNull Task> p) {
//noop
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class Project {
BaseJavaProject buildscriptIdeProject;

public void getTasks(@NotNull Consumer<Task> p) {
public void getTasks(@NotNull Consumer<@NotNull Task> p) {
// no default tasks
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String[]> run) {
return new TaskWithArgs(name, run);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

import io.github.coolcrabs.brachyura.exception.TaskFailedException;

class Tasks implements Consumer<Task> {
class Tasks implements Consumer<@NotNull Task> {

@NotNull
private final Map<String, Task> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public abstract class BaseJavaProject extends Project {
public abstract IdeModule[] getIdeModules();

@Override
public void getTasks(@NotNull Consumer<Task> p) {
public void getTasks(@NotNull Consumer<@NotNull Task> p) {
super.getTasks(p);
getIdeTasks(p);
getRunConfigTasks(p);
}

public void getIdeTasks(Consumer<Task> p) {
public void getIdeTasks(@NotNull Consumer<@NotNull Task> p) {
for (Ide ide : Ide.getIdes()) {
p.accept(Task.of(ide.ideName(), (Runnable) () -> {
BaseJavaProject buildscriptProject = getBuildscriptProject();
Expand All @@ -52,7 +52,7 @@ public void getIdeTasks(Consumer<Task> p) {
}
}

public void getRunConfigTasks(Consumer<Task> p) {
public void getRunConfigTasks(@NotNull Consumer<@NotNull Task> p) {
IdeModule[] ms = getIdeModules();
for (IdeModule m : ms) {
for (IdeModule.RunConfig rc : m.runConfigs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ public String getJarBaseName() {
}

@Override
public void getTasks(@NotNull Consumer<Task> 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<Task> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {});
}
});
}

Expand Down

0 comments on commit b9499a2

Please sign in to comment.