-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
85 lines (73 loc) · 2.03 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
plugins {
id 'java'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
}
group = 'io.github.steelwoolmc'
version = version + '+' + minecraft_version
java {
withSourcesJar()
}
minecraft {
mappings channel: 'official', version: minecraft_version
}
configurations {
shadedImplementation { transitive = false }
implementation.extendsFrom(shadedImplementation)
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
shadedImplementation "net.fabricmc:sponge-mixin:${mixin_version}"
}
jar {
archiveClassifier = "slim"
}
shadowJar {
from("licenses") {
into "META-INF/"
}
from("LICENSE.txt") {
into "META-INF/"
}
// Exclude dependency licenses since we include them ourselves
exclude "**/LICENSE*"
exclude "**/NOTICE*"
// Relocate mixin packages
relocate "org.spongepowered", "io.github.steelwoolmc.shadow.spongepowered"
relocate "shadowignore.org.spongepowered", "org.spongepowered"
// Relocate service files
mergeServiceFiles {
// Remove mixin's transformation service
exclude "META-INF/services/cpw.mods.modlauncher.api.ITransformationService"
}
// Remove mixin's launch plugin service
exclude "META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService"
archiveClassifier = ""
configurations = [project.configurations.shadedImplementation]
}
assemble.dependsOn shadowJar
// Replace published jar artifact with shadowJar
configurations {
[runtimeElements, apiElements].each {
it.outgoing {
artifacts.clear()
artifact(shadowJar)
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
// Remove forge dependency from pom, disable gradle module metadata
fg.component it
}
}
}