-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.gradle
175 lines (147 loc) · 5.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
plugins {
id 'java'
id 'idea'
id 'com.github.johnrengelman.shadow' version '8.1.+'
id 'com.google.osdetector' version '1.7.+'
id "me.modmuss50.mod-publish-plugin" version "0.8.3"
}
def MT_TOKEN = System.getenv("MODRINTH_TOKEN")
def CF_TOKEN = System.getenv("CURSEFORGE_TOKEN")
base {
archivesName = id
libsDirectory = new File("builtJars/")
}
test {
useJUnitPlatform()
}
java {
withSourcesJar()
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
}
sourcesJar {
exclude("videolan/**.zip")
exclude("videolan/**.7z")
}
println("Gradle Java: ${JavaVersion.current()}")
println("Building project: ${properties.simplename}")
println("Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}, Encoding: ${System.getProperty "file.encoding"}")
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url "https://repo.spongepowered.org/maven" }
}
configurations {
shadow.extendsFrom(implementation)
library
}
sourceSets {
// SHADOW
test.compileClasspath += configurations.shadow
test.runtimeClasspath += configurations.shadow
// LIBRARY
main.compileClasspath += configurations.library
test.compileClasspath += configurations.library
test.runtimeClasspath += configurations.library
}
dependencies {
// MODLOADERS
compileOnly "com.github.WaterMediaTeam:modloaders:$modloaders_version"
compileOnly "net.fabricmc:fabric-loader:$fabric_version"
// DEPENDENCIES
shadow "com.github.WaterMediaTeam:videolan-natives:$vlcj_natives_version"
shadow "com.github.WaterMediaTeam:ytdl-java:$jyd_version"
shadow "com.github.WaterMediaTeam:vlcj-submodule:0.0.1"
// DEPENDENCIES INCLUDED IN MINECRAFT
library "net.java.dev.jna:jna:$jna_version"
library "net.java.dev.jna:platform:$jnaplatform_version"
library "org.apache.logging.log4j:log4j-api:$log4j_version"
library "org.apache.logging.log4j:log4j-core:$log4jcore_version"
library "com.google.code.gson:gson:$gson_version"
library "org.lwjgl:lwjgl-opengl:$opengl_version"
library "org.lwjgl:lwjgl-glfw:$opengl_version"
library "org.lwjgl:lwjgl-openal:$openal_version"
// TEST DEPENDENCIES
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testRuntimeOnly "org.lwjgl:lwjgl:$opengl_version:natives-$osdetector.os"
testRuntimeOnly "org.lwjgl:lwjgl-opengl:$opengl_version:natives-$osdetector.os"
testRuntimeOnly "org.lwjgl:lwjgl-glfw:$opengl_version:natives-$osdetector.os"
}
// Process target resources with mod info
processResources {
outputs.upToDateWhen { false }
filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json', "watermedia/version.cfg"]) {
expand(project.properties)
}
}
// ShadowJar task (run this task to make a built JAR.
shadowJar {
dependsOn jar
configurations = [project.configurations.shadow]
// Add relocation rules for each dependency
relocate 'com.github', 'org.watermedia.shaded'
relocate 'com.alibaba', 'org.watermedia.shaded'
exclude "META-INF/versions/**"
exclude "META-INF/proguard/**"
exclude "META-INF/maven/**"
exclude "META-INF/LICENSE.*"
exclude "META-INF/LICENSE"
exclude "META-INF/NOTICE.**"
exclude "META-INF/NOTICE"
mergeServiceFiles()
archiveClassifier = ""
}
jar {
duplicatesStrategy = DuplicatesStrategy.WARN
manifest {
attributes "Specification-Title" : id
attributes "Specification-Vendor" : authors
attributes "Specification-Version" : version
attributes "Implementation-Title" : brandname
attributes "Implementation-Version" : version
attributes "Implementation-Vendor" : authors
attributes "Implementation-Timestamp" : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
attributes "Main-Class": "me.srrapero720.watermedia.Main"
}
finalizedBy shadowJar
}
publishMods {
file = shadowJar.archiveFile
changelog = getChangelogText()
type = STABLE
displayName = "WM/${project.properties.version}"
modLoaders.add("forge")
modLoaders.add("neoforge")
modLoaders.add("fabric")
additionalFiles.from(sourcesJar.archiveFile)
maxRetries = 2
dryRun = false
curseforge {
accessToken = CF_TOKEN
projectId = curseforgeid
minecraftVersions.addAll("1.16.5", "1.18.2", "1.19.2", "1.20.1", "1.21.1", "1.21.4")
javaVersions.addAll(JavaVersion.VERSION_21, JavaVersion.VERSION_17, JavaVersion.VERSION_11, JavaVersion.VERSION_1_8)
clientRequired = true
serverRequired = false
projectSlug = id
incompatible("fancyvideo-api")
additionalFile(sourcesJar) {
name = "WM-sources/${project.properties.version}"
}
}
modrinth {
accessToken = MT_TOKEN
projectId = modrinthid
minecraftVersions.addAll("1.16.5", "1.18.2", "1.19.2", "1.20.1", "1.21.1", "1.21.4")
incompatible("vlcvideoapi-pol")
}
}
def getChangelogText() {
def result = ""
for (String line: file('CHANGELOG.md').readLines('UTF-8')) {
if (line.isEmpty()) return result
result += line + '\n'
}
return result
}