forked from CraftTweaker/ContentTweaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
159 lines (136 loc) · 4.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
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
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.4.0"
}
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.matthewprenger.cursegradle"
apply plugin: "maven"
version = "${minecraft_version}-" + getVersion()
group = "com.teamacronymcoders"
archivesBaseName = "${mod_name}"
minecraft {
version = "${minecraft_version}-${forge_version}"
mappings = "${mappings_version}"
runDir = "run/"
useDepAts = true
replace "@VERSION@", project.version
replaceIn "${mod_name}.java"
replace "base@[0.0.0,);", "base@[" + base_version + ",);"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven {
name "BASE"
url "http://maven.blamejared.com"
}
maven {
name 'Tinkers/JEI'
url 'http://dvs1.progwml6.com/files/maven'
}
maven {
name 'Chickens'
url 'https://minecraft.curseforge.com/api/maven/'
}
}
dependencies {
deobfCompile "com.teamacronymcoders.base:base:${minecraft_version}-${base_version}-SNAPSHOT.+"
deobfCompile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-${crafttweaker_version}"
deobfCompile "slimeknights:TConstruct:${minecraft_version}-${tinkers_version}"
deobfCompile "slimeknights.mantle:Mantle:1.12-${mantle_version}"
deobfCompile "mezz.jei:${jei_version}"
deobfCompile "chickens:chickens:${chickens_version}"
}
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"
}
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://" + (System.getenv("local_maven") != null ? System.getenv("local_maven") : System.getenv("bamboo_local_maven")))
}
}
}
curseforge {
apiKey = findProperty('curseforge_api_token') ?: 0
project {
id = "237065"
releaseType = 'release'
changelog = file("changelog.md")
changelogType = 'markdown'
mainArtifact(jar) {
relations {
requiredLibrary "crafttweaker"
requiredLibrary "base"
}
}
}
}
task genGitChangelog() {
def stdout = new ByteArrayOutputStream()
// first commit to check from, in our case the first commit of the branch
String firstCommit = "3351e76f9166b22adf52287be5d9b0715a9ebf3e";
String repoLink = "https://github.com/CraftTweaker/ContentTweaker/commit/"
// was having issues with grep and spaces in the regex
exec {
commandLine 'git', 'log', '-i', '--grep=version\\spush', '--grep=open\\sbeta\\sspecific\\scode', '--pretty=tformat:%H', '--date=local', firstCommit + '..@{0}'
standardOutput = stdout
}
if (stdout.toString().trim().indexOf("\n") >= 0) {
firstCommit = stdout.toString().split("\n")[0].trim();
}
System.out.println("Last version hash: \"" + firstCommit + "\"");
stdout = new ByteArrayOutputStream()
def test = exec {
commandLine 'git', 'log', '--pretty=tformat:- [%s](' + repoLink + '%H) - %aN - %cd', '--max-parents=1', '--date=local', firstCommit + "..@"
standardOutput = stdout
}
File file = new File("changelog.md")
file.write("### Current version: " + project.version)
file.append("\n" + stdout.toString())
System.out.println("Changelog generated!")
}
String getVersion() {
String version = "${mod_version}"
String branch = project.hasProperty("branch") ? project.branch : ""
if(branch != "") {
version += "-" + branch
String buildNumber = getBuildNumber()
if(buildNumber != "") {
version += "." + buildNumber
}
}
return version
}
static String getBuildNumber() {
String buildNumber = System.getenv("BUILD_NUMBER") != null ? System.getenv("BUILD_NUMBER") : ""
if(buildNumber == "") {
buildNumber = System.getenv("bamboo_buildNumber") != null ? "." + System.getenv("bamboo_buildNumber") : ""
}
return buildNumber
}