This repository has been archived by the owner on Apr 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
114 lines (98 loc) · 4.14 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
import java.nio.file.Files
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
def mcVersion = "1.12.2"
def forgeVersion = "14.23.1"
def forgeBuild = "2562"
def mappingsVersion = "20171003"
def pl3xVersion = "106"
def build = System.getenv()['BUILD_NUMBER'] ?: "SNAPSHOT"
version = mcVersion + "-b" + build
group = "net.pl3x.forge"
archivesBaseName = "Pl3x"
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = mcVersion + "-" + forgeVersion + ".0"
runDir = "run"
replace "@DEV_BUILD@", project.version
replaceIn "Pl3x.java"
mappings = "snapshot_" + mappingsVersion
makeObfSourceJar = false
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
dependencies {
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
compile group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.4.7.v20170914'
compile group: 'io.prometheus', name: 'simpleclient_common', version: '0.1.0'
compile files('./libs/discord-rpc-1.3-all.jar')
provided project(":stairs")
}
shadowJar {
relocate "javax.servlet", "deps.javax.servlet-api"
relocate "org.eclipse.jetty", "deps.org.eclipse.jetty"
relocate "io.prometheus", "deps.io.prometheus"
relocate "club.minnced", "deps.club.minnced"
}
assemble.dependsOn(shadowJar)
reobf { shadowJar { mappingType = "SEARGE" } }
tasks.reobfShadowJar.mustRunAfter shadowJar
task setupPl3xForge {
group = "forgegradle"
description = "Download the Pl3xForge userdev file for ForgeGradle"
doFirst {
println "Checking directory structures..."
def pl3xDir = new File(System.getProperty("user.home"), ".gradle" + File.separator + "pl3x")
if (!pl3xDir.exists()) {
println "Missing pl3x directory. Creating..."
pl3xDir.mkdirs()
}
def userdevDir = new File(System.getProperty("user.home"), ".gradle" + File.separator + "caches" + File.separator + "minecraft" +
File.separator + "net" + File.separator + "minecraftforge" + File.separator + "forge" + File.separator +
mcVersion + "-" + forgeVersion + ".0" + File.separator + "snapshot" + File.separator + mappingsVersion)
if (!userdevDir.exists()) {
println "Missing userdev directory. Creating..."
userdevDir.mkdirs()
}
println "Checking userdev files..."
def userdevFile = new File(userdevDir, "forge-" + (String) project.minecraft.version + "-" + forgeVersion + ".0-userdev.jar")
def tmpFile = new File(pl3xDir, "forge-" + mcVersion + "-" + forgeVersion + "." + forgeBuild + "." + pl3xVersion + "-userdev.jar")
if (!tmpFile.exists() || !userdevFile.exists()) {
println "Downloading missing Pl3xForge userdev jar (build " + pl3xVersion + ")..."
new URL("http://pl3x.net/jenkins/job/MinecraftForge/" + pl3xVersion +
"/artifact/build/distributions/forge-" + mcVersion + "-" + forgeVersion + "." + forgeBuild + "." + pl3xVersion + "-userdev.jar")
.withInputStream { i -> tmpFile.withOutputStream { it << i } }
println "Preparing Pl3xForge jar (build " + pl3xVersion + ")..."
for (File f : userdevDir.listFiles()) {
f.delete()
}
Files.copy(tmpFile.toPath(), userdevFile.toPath())
}
println "Everything up to date!"
println ""
println "Please run setupDecompWorkspace task now."
}
}