Skip to content

Commit

Permalink
GraalVM TODO: forge-cli is not included in resources
Browse files Browse the repository at this point in the history
  • Loading branch information
3arthqu4ke committed Jan 22, 2025
1 parent 281e961 commit 61e4cd4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions headlessmc-launcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ shadowJar {
dependsOn shadowBugWorkaround
from shadowBugWorkaround

// TODO: fix this, since it breaks graalvm, because the resource is not available!!!
// ignore the forge-cli jar from processResources as it will get expanded
// that the runtime and lwjgl jars get expanded isnt problematic
processResources.exclude('forgecli*.jar')
Expand All @@ -125,6 +126,7 @@ graalvmNative {
main {
sharedLibrary = false
buildArgs.add('--enable-url-protocols=https')
buildArgs.add('-Ob')
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,39 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import me.earth.headlessmc.launcher.util.JsonUtil;
import org.jetbrains.annotations.Nullable;

import java.net.URL;

@Data
@RequiredArgsConstructor
public class Logging {
private final String argument;
private final String type;
private final File file;

@Deprecated
@SuppressWarnings("unused") // used by graalvm
private Logging() {
this(null, null, null);
}

@Data
@RequiredArgsConstructor
public static class File {
private final String id;
private final String sha1;
private final Long size;
private final URL url;

@Deprecated
@SuppressWarnings("unused") // used by graalvm
private File() {
this(null, null, 0L, null);
}
}

public static Logging fromJson(JsonElement element) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package me.earth.headlessmc.launcher.command.forge;

import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.io.InputStream;

import static org.junit.jupiter.api.Assertions.assertNotNull;

public class ForgeCliTest {
// just a test to tell GraalVM that we need this resource!
@Test
public void testForgeCliResourceForGraalVM() {
try (InputStream is = ForgeCliTest.class.getClassLoader().getResourceAsStream("headlessmc/forge-cli.jar")) {
assertNotNull(is);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

}

0 comments on commit 61e4cd4

Please sign in to comment.