-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
111 lines (91 loc) · 2.71 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
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10"
}
}
repositories {
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: "com.matthewprenger.cursegradle"
ext.configFile = file('gradle.properties')
ext.privFile = file('private.properties')
ext.config = parseConfig(configFile)
ext.priv = parseConfig(privFile)
version = "${config.mc_version}-${config.mod_version}.${config.build_number}"
group="${config.author}.${config.mod_name}".toLowerCase()
archivesBaseName = config.mod_name
if (System.getenv("CIRCLE_BUILD_NUM") != null) {
//adds the build number to the end of the version string if on a build server
version += ".${System.getenv("CIRCLE_BUILD_NUM")}"
}
minecraft {
version = "${mc_version}-${forge_version}"
runDir = "run"
if (project.hasProperty('mappings_version'))
mappings = project.mappings_version
replace 'GRADLE:BUILD', config.build_number
replace 'GRADLE:VERSION', this.version
replace 'GRADLE:MCVERSION', config.mod_version
replaceIn 'Reference.java'
useDepAts = true
makeObfSourceJar = true
}
dependencies {
deobfCompile "autoreglib:AutoRegLib:1.3:20"
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version': config.mod_version, 'mcversion': config.mc_version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
/**
* Increments the buildnumber in your config file, and saves it
*/
task incrementBuildNumber(dependsOn: reobfJar) {
doLast {
config.build_number = (config.build_number.toString().toInteger()) + 1
configFile.withWriter {
config.toProperties().store(it, "")
}
}
}
def parseConfig(File config) {
if(config.exists()){
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
} else {
return null
}
}