-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle
186 lines (163 loc) · 5.7 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
plugins {
id "com.matthewprenger.cursegradle" version "1.0.7"
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32"
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
def versionInfo = getGitVersion()
version = "${versionInfo['simpleretrogen.version']}"
group= "cpw.mods" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "simpleretrogen"
minecraft {
version = "1.10-12.18.0.1984-1.10.0"
mappings = "snapshot_20160529"
runDir = "run"
}
curseforge {
apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0'
project {
id = '240566'
changelog = file('CHANGELOG.html')
changelogType = 'html'
releaseType = 'beta'
}
}
afterEvaluate {
tasks.curseforge240566.dependsOn.remove(reobfJar)
tasks.curseforge240566.dependsOn.remove(jar)
tasks.curseforge240566.dependsOn.add(makeChangelog)
}
task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
filePath = "CHANGELOG.html"
untaggedName = "Current release ${project.version}"
// gitHubApi = "https://api.github.com/repos/cpw/simpleretrogen"
templateContent = """
<h1>Simpleretrogen changelog history</h1>
<h2>Version ${project.version} for minecraft ${project.minecraft.version}</h2>
<ul>
{{#tags}}
<li><h3>{{name}}</h3>
<hr/>
<ul>
{{#commits}}
<li>{{{message}}}</li>
{{/commits}}
</ul>
{{/tags}}
</ul>
"""
}
jar {
appendix = project.minecraft.version
}
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 propsFile = new File(destinationDir, 'version.properties')
def properties = new Properties()
properties.putAll(versionInfo)
properties['simpleretrogen.build.mcversion'] = project.minecraft.version
properties.store(propsFile.newWriter(), null)
}
}
uploadArchives {
repositories.mavenDeployer {
dependsOn 'build'
if (project.hasProperty('forgeMavenPassword'))
{
repository(url: "http://files.minecraftforge.net/maven/manage/upload") {
authentication(userName: project.getProperty('forgeMavenUser'), password: project.getProperty('forgeMavenPassword')) // the elvis operator. look it up.
}
}
else
{
// local repo folder. Might wanna juset use gradle install if you wanans end it to maven-local
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
}
// This is just the pom data for the maven repo
pom {
groupId = project.group
// Force the maven upload to use the <mcversion>-<version> syntax preferred at files
version = "${project.minecraft.version}-${project.version}"
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'simpleretrogen'
url 'https://github.com/cpw/simpleretrogen'
scm {
url 'https://github.com/cpw/simpleretrogen'
connection 'scm:git:git://github.com/cpw/simpleretrogen.git'
developerConnection 'scm:git:[email protected]:cpw/simpleretrogen.git'
}
issueManagement {
system 'github'
url 'https://github.com/cpw/simpleretrogen/issues'
}
licenses {
license {
name 'GNU Public License (GPL), Version 3.0'
url 'http://www.gnu.org/licenses/gpl-3.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'cpw'
name 'cpw'
roles { role 'developer' }
}
}
}
}
}
}
// This is a special task for pulling the version information from git and the environment (for BUILD_NUMBER)
def getGitVersion()
{
def out = [:]
// call git command.
def outStream = new ByteArrayOutputStream()
def result = exec {
executable = 'git'
args = [ 'describe', '--long', "--match=[^(jenkins)]*"]
standardOutput = outStream
}
def fullVersion = outStream.toString().trim()
def matcher = fullVersion =~ /(\d+).(\d+)-(\d+)-(.*)/
def maj = matcher[0][1]
def min = matcher[0][2]
def rev = matcher[0][3]
def bn = project.ext.properties.buildNumber ?: System.getenv("PROMOTED_NUMBER") ?: System.getenv("BUILD_NUMBER") ?: "1"
out['simpleretrogen.build.major.number'] = maj.toString()
out['simpleretrogen.build.minor.number'] = min.toString()
out['simpleretrogen.build.revision.number'] = rev.toString()
out['simpleretrogen.build.githash'] = matcher[0][4].toString()
out['simpleretrogen.build.number' ] = bn.toString()
out['simpleretrogen.version' ] = "${maj}.${min}.${rev}+${bn}".toString()
return out
}