forked from FabricMC/fabric-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
168 lines (143 loc) · 4.25 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
import com.google.gson.Gson
import com.google.gson.JsonElement
import com.google.gson.JsonObject
plugins {
id 'java'
id 'maven-publish'
id 'idea'
id 'eclipse'
id("fabric-loom") version "0.2.6-SNAPSHOT"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "fabric-loader"
// Fetch build number from Jenkins
def ENV = System.getenv()
version = version + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local")
repositories {
mavenCentral()
jcenter()
maven {
name = 'Fabric'
url = 'http://maven.modmuss50.me/'
}
maven {
name = 'SpongePowered'
url = 'http://repo.spongepowered.org/maven'
}
maven {
name = 'mojang'
url = 'https://libraries.minecraft.net/'
}
}
dependencies {
minecraft "com.mojang:minecraft:1.14.4"
mappings "net.fabricmc:yarn:1.14.4+build.1"
// Minecraft's JAR uses these annotations
compile 'com.google.code.findbugs:jsr305:3.0.2'
// fabric-loader dependencies
compile 'org.ow2.asm:asm:8.0'
compile 'org.ow2.asm:asm-analysis:8.0'
compile 'org.ow2.asm:asm-commons:8.0'
compile 'org.ow2.asm:asm-tree:8.0'
compile 'org.ow2.asm:asm-util:8.0'
compile('net.fabricmc:sponge-mixin:0.8+build.18') {
exclude module: 'launchwrapper'
exclude module: 'guava'
}
compile 'net.fabricmc:tiny-mappings-parser:0.2.2.14'
compile 'net.fabricmc:tiny-remapper:0.2.2.64'
compile 'com.google.jimfs:jimfs:1.1'
compile 'net.fabricmc:fabric-loader-sat4j:2.3.5.4'
// launchwrapper + dependencies
compile ('net.minecraft:launchwrapper:1.12') {
transitive = false
}
compile 'net.sf.jopt-simple:jopt-simple:5.0.3'
}
processResources {
inputs.property "version", version
from(sourceSets.main.resources.srcDirs) {
include 'fabric.mod.json'
expand 'version':version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'fabric.mod.json'
}
}
jar {
manifest {
attributes (
'Main-Class': 'net.fabricmc.loader.launch.server.FabricServerLauncher'
)
}
}
task copyJson(type: Copy, dependsOn: ["remapJar"]) {
from('src/main/resources/fabric-installer.json') {
rename { "${archivesBaseName}-${version}.json" }
}
into 'build/libs'
}
task copyJsonLw(type: Copy, dependsOn: ["remapJar"]) {
from('src/main/resources/fabric-installer.launchwrapper.json') {
rename { "${archivesBaseName}-${version}.launchwrapper.json" }
}
into 'build/libs'
}
tasks.build.dependsOn "copyJson"
tasks.build.dependsOn "copyJsonLw"
String getClasspathEntries(){
String classPath = ""
File installerFile = file("src/main/resources/fabric-installer.json")
JsonObject object = Gson.newInstance().fromJson(new InputStreamReader(new FileInputStream(installerFile)), JsonObject.class)
["common", "server"].forEach { l ->
for (JsonElement element : object.getAsJsonObject("libraries").getAsJsonArray(l)) {
String dep = element.getAsJsonObject().get("name").getAsString()
String[] depSplit = dep.split(":")
if (depSplit.length != 3) throw new RuntimeException("Invalid dependency " + dep);
classPath = classPath + " libs/" + depSplit[1] + "-" + depSplit[2] + ".jar"
}
}
return classPath;
}
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}.jar")) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
artifact(file('src/main/resources/fabric-installer.json')) {
builtBy remapJar
}
artifact(file('src/main/resources/fabric-installer.launchwrapper.json')) {
builtBy remapJar
classifier = "launchwrapper"
}
}
}
// select the repositories you want to publish to
repositories {
if (project.hasProperty('mavenPass')) {
maven {
url = "http://mavenupload.modmuss50.me/"
credentials {
username = "buildslave"
password = project.getProperty('mavenPass')
}
}
}
}
}
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.gradle'
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/ideconfig.gradle'