Skip to content

Commit

Permalink
feat shadow jar
Browse files Browse the repository at this point in the history
  • Loading branch information
a3510377 committed Nov 8, 2023
1 parent 84650fa commit 920dafe
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'

id 'fabric-loom' version '1.4-SNAPSHOT'
id 'maven-publish'
}
Expand Down Expand Up @@ -32,13 +34,10 @@ dependencies {
implementation "io.prometheus:prometheus-metrics-core:${project.prometheus_version}"
implementation "io.prometheus:prometheus-metrics-instrumentation-jvm:${project.prometheus_version}"
implementation "io.prometheus:prometheus-metrics-exporter-httpserver:${project.prometheus_version}"
implementation "io.prometheus:prometheus-metrics-model:${project.prometheus_version}"
implementation "io.prometheus:prometheus-metrics-config:${project.prometheus_version}"
include "io.prometheus:prometheus-metrics-core:${project.prometheus_version}"
include "io.prometheus:prometheus-metrics-instrumentation-jvm:${project.prometheus_version}"
include "io.prometheus:prometheus-metrics-exporter-httpserver:${project.prometheus_version}"
include "io.prometheus:prometheus-metrics-model:${project.prometheus_version}"
include "io.prometheus:prometheus-metrics-config:${project.prometheus_version}"

shadow "io.prometheus:prometheus-metrics-core:${project.prometheus_version}"
shadow "io.prometheus:prometheus-metrics-instrumentation-jvm:${project.prometheus_version}"
shadow "io.prometheus:prometheus-metrics-exporter-httpserver:${project.prometheus_version}"

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
Expand All @@ -54,10 +53,23 @@ processResources {
}
}

shadowJar {
configurations = [project.configurations.shadow]
exclude("META-INF")
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}

remapJar {
// wait until the shadowJar is done
dependsOn(shadowJar)
mustRunAfter(shadowJar)
// Set the input jar for the task. Here use the shadow Jar that include the .class of the transitive dependency
inputFile = file(shadowJar.archivePath)
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
Expand Down

0 comments on commit 920dafe

Please sign in to comment.