forked from BTW-Community/BTW-gradle-fabric-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
175 lines (145 loc) · 4.48 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
import net.fabricmc.loom.task.RunClientTask
import net.fabricmc.loom.task.RunServerTask
buildscript {
dependencies {
classpath fileTree(dir: "libs", include: "fabric-loom-0.7.local.jar")
}
}
plugins {
id 'maven-publish'
id 'fabric-loom' version "0.7-SNAPSHOT"
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
repositories {
maven {
name = 'legacy-fabric'
url = 'https://maven.legacyfabric.net'
}
maven {
url 'https://jitpack.io'
}
maven {
name 'HalfOf2'
url 'https://storage.googleapis.com/devan-maven/'
}
}
sourceSets {
btw {
java {
srcDirs = ['src/btw/java']
}
resources {
srcDirs = ['src/btw/resources']
}
}
}
def lwjglVersion = System.getProperty("os.name").toLowerCase().contains("mac") ? "2.9.1" : "2.9.0"
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
implementation 'org.apache.logging.log4j:log4j-core:2.17.0'
implementation 'org.apache.logging.log4j:log4j-api:2.17.0'
implementation "org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}"
implementation "org.lwjgl.lwjgl:lwjgl:${lwjglVersion}"
implementation "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}"
implementation fileTree(dir: "libs", include: "**.zip")
compileOnly fileTree(dir: "$projectDir/BTW_dev", include: "*.zip")
compileOnly fileTree(dir: "$buildDir/BTW_dev", include: "**.jar")
runtimeClasspath fileTree(dir: "$buildDir/dev_run", include: "dev.jar")
mappings fileTree(dir: "custom_mappings", include: "**.zip")
modImplementation("io.github.minecraft-cursed-legacy:cursed-fabric-loader:${loader_version}") {
transitive false
}
}
configurations {
btwCompileClasspath.extendsFrom implementation, modImplementation
}
configurations.all {
resolutionStrategy {
dependencySubstitution {
substitute module('org.lwjgl.lwjgl:lwjgl_util:2.9.1-nightly-20130708-debug3') with module("org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}")
substitute module('org.lwjgl.lwjgl:lwjgl:2.9.1-nightly-20130708-debug3') with module("org.lwjgl.lwjgl:lwjgl:${lwjglVersion}")
}
force "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}"
}
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) it.options.release = 8
}
java {
withSourcesJar()
}
compileJava {
dependsOn('btwJar')
}
task devPackMod(type:Copy) {
dependsOn('jar')
from sourceSets.main.output.classesDirs
into file("$buildDir/classes/java/btw")
}
task devPackBTW(type:Copy) {
dependsOn('devPackMod')
dependsOn('btwJar')
}
task devPackRun(type:Jar) {
dependsOn('devPackBTW')
from fileTree("$buildDir/classes/java/btw")
from fileTree("$projectDir/BTW_dev/")
from sourceSets.btw.output.resourcesDir
destinationDirectory = file("$buildDir/dev_run")
archiveFileName = "dev.jar"
}
jar {
from sourceSets.main.output.resourcesDir
from sourceSets.main.output.classesDirs
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
task btwJar(type:Jar) {
from fileTree("$projectDir/BTW_dev/")
from sourceSets.btw.output.resourcesDir
from sourceSets.btw.output.classesDirs
destinationDirectory = file("$buildDir/BTW_dev")
archiveFileName = "BTW_dev.jar"
}
remapJar {
dependsOn(jar)
input.set jar.archiveFile.get()
destinationDirectory = file("$rootDir/release")
}
reobfuscateJar {
dependsOn(jar)
input.set jar.archiveFile.get()
destinationDirectory = file("$rootDir/reobfuscated")
}
task safeRunClient(type:RunClientTask) {
mustRunAfter('clean')
dependsOn('clean')
dependsOn('devPackRun')
}
task safeRunServer(type:RunServerTask) {
mustRunAfter('clean')
dependsOn('clean')
dependsOn('devPackRun')
}
runClient {
dependsOn('devPackRun')
}
runServer {
dependsOn('devPackRun')
}
clean.doFirst {
delete "$buildDir/dev_run"
delete "$buildDir/BTW_dev"
}