Skip to content

Commit 561c309

Browse files
authored
Fix running in dev (#505)
* Relocate ANTLR in a subproject to avoid conflicts with Forge * Do not shadow the whole ANTLR library
1 parent 610e637 commit 561c309

File tree

4 files changed

+64
-6
lines changed

4 files changed

+64
-6
lines changed

build.gradle

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ sourceSets {
6161
}
6262
}
6363

64+
loom {
65+
runs {
66+
client {
67+
mods {
68+
oculus {
69+
sourceSet sourceSets.main
70+
sourceSet sourceSets.vendored
71+
sourceSet sourceSets.sodiumCompatibility
72+
}
73+
}
74+
}
75+
}
76+
}
77+
6478
repositories {
6579
maven {
6680
name = "Modrinth"
@@ -83,9 +97,10 @@ dependencies {
8397
modCompileOnly "org.embeddedt:embeddium-${minecraft_version}:${embeddium_version}"
8498
compileOnly "maven.modrinth:distanthorizons:2.0.1-a-1.20.1"
8599

86-
implementation shadow("io.github.douira:glsl-transformer:2.0.0")
87-
implementation shadow("org.antlr:antlr4-runtime:4.11.1")
88-
implementation include("org.anarres:jcpp:1.4.14")
100+
forgeRuntimeLibrary(implementation(shadow(project(path: ":glsl-relocated", configuration: "bundledJar")))) {
101+
transitive = false
102+
}
103+
forgeRuntimeLibrary(implementation(include("org.anarres:jcpp:1.4.14")))
89104
}
90105

91106
processResources {
@@ -102,7 +117,6 @@ shadowJar {
102117
from jar.archiveFile
103118

104119
relocate 'org.apache.commons.collections4', 'oculus.org.apache.commons.collections4'
105-
relocate 'org.antlr', 'oculus.org.antlr'
106120

107121
archiveClassifier.set "shadow"
108122
}

glsl-relocated/build.gradle

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
plugins {
2+
id 'java-library'
3+
id 'com.github.johnrengelman.shadow' version '8.1.1'
4+
}
5+
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
dependencies {
11+
implementation(shadow("io.github.douira:glsl-transformer:2.0.0")) {
12+
exclude module: "antlr4" // we only want to shadow the runtime module
13+
}
14+
implementation shadow("org.antlr:antlr4-runtime:4.11.1")
15+
}
16+
17+
shadowJar {
18+
configurations = [project.configurations.shadow]
19+
20+
from jar.archiveFile
21+
22+
relocate 'org.antlr', 'oculus.org.antlr'
23+
24+
archiveClassifier.set "shadow"
25+
}
26+
27+
28+
29+
configurations {
30+
bundledJar {
31+
canBeConsumed = true
32+
canBeResolved = false
33+
// If you want this configuration to share the same dependencies, otherwise omit this line
34+
extendsFrom implementation, runtimeOnly
35+
}
36+
}
37+
38+
39+
40+
artifacts {
41+
bundledJar(shadowJar)
42+
}

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ pluginManagement {
1010
gradlePluginPortal()
1111
}
1212
}
13+
14+
include("glsl-relocated")

src/main/java/net/coderbot/iris/pipeline/transform/TransformPatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import java.util.regex.Pattern;
88

99
import net.coderbot.iris.gl.shader.ShaderCompileException;
10-
import org.antlr.v4.runtime.Token;
11-
import org.antlr.v4.runtime.misc.ParseCancellationException;
10+
import oculus.org.antlr.v4.runtime.Token;
11+
import oculus.org.antlr.v4.runtime.misc.ParseCancellationException;
1212
import org.apache.logging.log4j.LogManager;
1313
import org.apache.logging.log4j.Logger;
1414

0 commit comments

Comments
 (0)