Skip to content

Commit

Permalink
Remove dedicated subprojects for shading third party dependencies and…
Browse files Browse the repository at this point in the history
… use the shadow plugin on the root project instead.
  • Loading branch information
shartte committed Dec 3, 2022
1 parent f4a811c commit b5d8724
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 62 deletions.
40 changes: 32 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,31 @@ plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "1.2.1"
id 'io.github.juuxel.loom-quiltflower' version '1.7.1'
id "com.github.johnrengelman.shadow" version "7.0.0"
}

configurations {
includeInJar
shaded {
transitive = false
}
portaforgyImplementation.extendsFrom(compileClasspath)
implementation.extendsFrom(includeInJar)
}

dependencies {
includeInJar project(path: ':libs:markdown', configuration: "archives")
includeInJar project(path: ':libs:shaded-snakeyaml', configuration: "shadow")
includeInJar project(path: ':libs:shaded-directory-watcher', configuration: "shadow")
// To be copied into the jar file
shaded project(path: ':libs:markdown', configuration: "archives")
shaded "io.methvin:directory-watcher:${directory_watcher_version}"
shaded "org.yaml:snakeyaml:${snakeyaml_version}"

implementation project(':libs:markdown')
// Do not inherit any transitive dependencies here since we rely on those dependencies being
// present in Minecrafts own dependencies already.
implementation("io.methvin:directory-watcher:${directory_watcher_version}") {
transitive = false
}
implementation("org.yaml:snakeyaml:${snakeyaml_version}") {
transitive = false
}

// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
Expand Down Expand Up @@ -307,14 +320,14 @@ processResources {
}
}

jar {
jar.enabled = false // Replaced by "shadowJar"

shadowJar {
finalizedBy 'remapJar'

from sourceSets.main.output.classesDirs
from sourceSets.main.output.resourcesDir

from configurations.includeInJar.collect { zipTree it }

from('guidebook') {
into 'assets/ae2/ae2guide'
}
Expand All @@ -330,6 +343,17 @@ jar {
"MixinConfigs" : "ae2.mixins.json"
])
}

relocate "io.methvin", "appeng.shaded.methvin"
relocate "org.yaml.snakeyaml", "appeng.shaded.snakeyaml"

configurations = [project.configurations.shaded]
archiveClassifier = jar.archiveClassifier
destinationDirectory = jar.destinationDirectory
}

remapJar {
inputFile = shadowJar.archiveFile
}

def publicApiIncludePatterns = {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
23 changes: 0 additions & 23 deletions libs/shaded-directory-watcher/build.gradle

This file was deleted.

21 changes: 0 additions & 21 deletions libs/shaded-snakeyaml/build.gradle

This file was deleted.

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

include 'libs:markdown'
include 'libs:shaded-snakeyaml'
include 'libs:shaded-directory-watcher'
7 changes: 4 additions & 3 deletions src/main/java/appeng/client/guidebook/GuideSourceWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.methvin.watcher.DirectoryChangeEvent;
import io.methvin.watcher.DirectoryChangeListener;
import io.methvin.watcher.DirectoryWatcher;

import net.minecraft.resources.ResourceLocation;

import appeng.client.guidebook.compiler.PageCompiler;
import appeng.client.guidebook.compiler.ParsedGuidePage;
import appeng.core.AppEng;
import appeng.shaded.directorywatcher.watcher.DirectoryChangeEvent;
import appeng.shaded.directorywatcher.watcher.DirectoryChangeListener;
import appeng.shaded.directorywatcher.watcher.DirectoryWatcher;

class GuideSourceWatcher {
private static final Logger LOGGER = LoggerFactory.getLogger(GuideSourceWatcher.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
import java.util.Map;

import org.jetbrains.annotations.Nullable;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;

import appeng.shaded.snakeyaml.LoaderOptions;
import appeng.shaded.snakeyaml.Yaml;
import appeng.shaded.snakeyaml.constructor.SafeConstructor;

public record Frontmatter(
FrontmatterNavigation navigationEntry,
Map<String, Object> additionalProperties) {
Expand Down

0 comments on commit b5d8724

Please sign in to comment.