-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle
96 lines (84 loc) · 2.63 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
import groovy.json.*
// For those who want the bleeding edge
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
version = "2.1.1"
if (System.getenv().BUILD_NUMBER != null) version += "." + System.getenv().BUILD_NUMBER
targetCompatibility = sourceCompatibility = 1.8
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
group= "net.dries007.holoinventory"
archivesBaseName = "HoloInventory"
minecraft {
version = "1.12.2-14.23.0.2491"
runDir = "run"
mappings = "snapshot_20171017"
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
processResources
{
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
doLast {
def updateFile = new File('update.json')
if (updateFile.exists())
{
def outStream = new ByteArrayOutputStream()
def result = exec {
executable = 'git'
args = [ 'log', '-n', '1', "--format='%B'"]
standardOutput = outStream
}
def fullLog = outStream.toString().replaceAll("^\\s*'\\s*|\\s*'\\s*\$", "")
def json = new JsonSlurper().parseText(updateFile.getText())
json['promos'][project.minecraft.version + '-latest'] = project.version
json['promos'][project.minecraft.version + '-recomended'] = project.version
if (!json.containsKey(project.minecraft.version)) json.put(project.minecraft.version, new HashMap<>())
def version = json[project.minecraft.version]
version.put(project.version, fullLog)
updateFile.write JsonOutput.prettyPrint(JsonOutput.toJson(json))
}
}
}
task deobfJar(type: Jar, dependsOn: 'jar') {
from "LICENSE.txt"
from sourceSets.main.output
classifier "dev"
appendix = project.minecraft.version
}
sourceJar {
from "LICENSE.txt"
exclude("com/**")
classifier "src"
appendix = project.minecraft.version
}
jar {
from "LICENSE.txt"
exclude("com/**")
appendix = project.minecraft.version
}
artifacts {
archives deobfJar
}