forked from SilentChaos512/SilentGems
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
153 lines (136 loc) · 4.08 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
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
version = "2.4.2"
def silentlib_version = "2.2.6"
def buildNum = 0
group = "net.silentchaos512.gems"
archivesBaseName = "SilentsGems-1.12"
sourceCompatibility = 1.8
targetCompatibility = 1.8
def versionFile = file('version.properties')
minecraft {
version = "1.12-14.21.1.2413"
runDir = "eclipse"
if (versionFile.canRead()) {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionFile))
buildNum = versionProps['BUILD_NUM'].toInteger()
} else {
throw new GradleException("Could not read version.properties!")
}
println("build: " + buildNum)
replace "@VERSION@", project.version
replace "SL_VERSION", silentlib_version
replace "BUILD_NUM = 0", "BUILD_NUM = " + buildNum
replaceIn "SilentGems.java"
mappings = "snapshot_20170624"
}
task incrementBuild {
doFirst {
if (versionFile.canRead()) {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionFile))
buildNum = versionProps['BUILD_NUM'].toInteger() + 1
println("incrementing BuildNumber to: " + buildNum)
versionProps['BUILD_NUM'] = buildNum.toString()
versionProps.store(versionFile.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
}
build.dependsOn incrementBuild
repositories {
maven {
name = "DVS1 Maven FS"
url "http://dvs1.progwml6.com/files/maven"
}
}
jar {
mustRunAfter incrementBuild
doFirst {
classifier = buildNum
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
mustRunAfter incrementBuild
from sourceSets.main.allSource
doFirst {
classifier = buildNum + '-sources'
}
}
task deobfJar(type: Jar) {
mustRunAfter incrementBuild
from sourceSets.main.output
doFirst {
classifier = buildNum + "-deobf"
}
}
artifacts {
archives sourcesJar
archives deobfJar
}
dependencies {
deobfCompile "mezz.jei:jei_1.12:4.7.1.69"
compileOnly project(path: ":deobfCompileOnly", configuration: "forgeGradleResovledDeobfProvided")
compileOnly fileTree(dir: "libraries", include: "*.jar", exclude: "*-runtime.jar")
compile fileTree(dir: "libraries", include: "*-runtime.jar")
}
sourceSets {
main {
java { srcDirs = ["$projectDir/common"] }
resources { srcDirs = ["$projectDir/resources"] }
}
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// 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'
}
}
project(":deobfCompileOnly") {
apply plugin: 'net.minecraftforge.gradle.forge'
version = "0.0.0"
minecraft {
version = "1.12-14.21.1.2413"
mappings = "snapshot_20170624"
}
repositories {
maven {
name = "DVS1 Maven FS"
url "http://dvs1.progwml6.com/files/maven"
}
}
dependencies {
deobfProvided "slimeknights.mantle:Mantle:1.11.2-1.2.0.+"
deobfProvided "slimeknights:TConstruct:1.11.2-2.7.0.+"
}
sourceSets {
main {
compileClasspath = configurations.forgeGradleResovledDeobfProvided
runtimeClasspath -= runtimeClasspath
}
test {
compileClasspath -= compileClasspath
runtimeClasspath -= runtimeClasspath
}
remove api
}
}