forked from SteelwoolMC/MixinTransmogrifier
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
105 lines (92 loc) · 2.36 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
plugins {
id 'java'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
group = 'io.github.steelwoolmc'
version = version + '+' + minecraft_version
java {
withSourcesJar()
}
minecraft {
mappings channel: 'official', version: minecraft_version
}
configurations {
shadedImplementation { transitive = false }
fabricMixin { transitive = false }
implementation.extendsFrom(shadedImplementation, fabricMixin)
}
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Sinytra'
url = 'https://maven.su5ed.dev/releases/'
}
mavenLocal()
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
fabricMixin "org.sinytra: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*"
exclude "META-INF/maven/**"
exclude "META-INF/versions/**"
archiveClassifier = "shadow"
configurations = [project.configurations.shadedImplementation]
}
tasks.register("fullJar", org.gradle.jvm.tasks.Jar) {
dependsOn(shadowJar)
manifest.from(jar.manifest)
from(zipTree(shadowJar.archiveFile))
from(provider { configurations.fabricMixin.singleFile }) {
rename { "fabric-mixin.jar" }
}
archiveClassifier = ""
}
assemble.dependsOn fullJar
// Replace published jar artifact with shadowJar
configurations {
[runtimeElements, apiElements].each {
it.outgoing {
artifacts.clear()
artifact(fullJar)
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
// Remove forge dependency from pom, disable gradle module metadata
fg.component it
}
}
def ENV = System.getenv()
if (ENV.MAVEN_URL) {
repositories.maven {
url ENV.MAVEN_URL
if (ENV.MAVEN_USERNAME) {
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}