Skip to content

Commit

Permalink
Fix running in dev (#505)
Browse files Browse the repository at this point in the history
* Relocate ANTLR in a subproject to avoid conflicts with Forge

* Do not shadow the whole ANTLR library
  • Loading branch information
embeddedt authored Dec 10, 2023
1 parent 610e637 commit 561c309
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 6 deletions.
22 changes: 18 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ sourceSets {
}
}

loom {
runs {
client {
mods {
oculus {
sourceSet sourceSets.main
sourceSet sourceSets.vendored
sourceSet sourceSets.sodiumCompatibility
}
}
}
}
}

repositories {
maven {
name = "Modrinth"
Expand All @@ -83,9 +97,10 @@ dependencies {
modCompileOnly "org.embeddedt:embeddium-${minecraft_version}:${embeddium_version}"
compileOnly "maven.modrinth:distanthorizons:2.0.1-a-1.20.1"

implementation shadow("io.github.douira:glsl-transformer:2.0.0")
implementation shadow("org.antlr:antlr4-runtime:4.11.1")
implementation include("org.anarres:jcpp:1.4.14")
forgeRuntimeLibrary(implementation(shadow(project(path: ":glsl-relocated", configuration: "bundledJar")))) {
transitive = false
}
forgeRuntimeLibrary(implementation(include("org.anarres:jcpp:1.4.14")))
}

processResources {
Expand All @@ -102,7 +117,6 @@ shadowJar {
from jar.archiveFile

relocate 'org.apache.commons.collections4', 'oculus.org.apache.commons.collections4'
relocate 'org.antlr', 'oculus.org.antlr'

archiveClassifier.set "shadow"
}
Expand Down
42 changes: 42 additions & 0 deletions glsl-relocated/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

repositories {
mavenCentral()
}

dependencies {
implementation(shadow("io.github.douira:glsl-transformer:2.0.0")) {
exclude module: "antlr4" // we only want to shadow the runtime module
}
implementation shadow("org.antlr:antlr4-runtime:4.11.1")
}

shadowJar {
configurations = [project.configurations.shadow]

from jar.archiveFile

relocate 'org.antlr', 'oculus.org.antlr'

archiveClassifier.set "shadow"
}



configurations {
bundledJar {
canBeConsumed = true
canBeResolved = false
// If you want this configuration to share the same dependencies, otherwise omit this line
extendsFrom implementation, runtimeOnly
}
}



artifacts {
bundledJar(shadowJar)
}
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ pluginManagement {
gradlePluginPortal()
}
}

include("glsl-relocated")
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.util.regex.Pattern;

import net.coderbot.iris.gl.shader.ShaderCompileException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.misc.ParseCancellationException;
import oculus.org.antlr.v4.runtime.Token;
import oculus.org.antlr.v4.runtime.misc.ParseCancellationException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down

0 comments on commit 561c309

Please sign in to comment.