-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
168 lines (136 loc) · 4.67 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
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
}
}
plugins {
id 'com.matthewprenger.cursegradle' version '1.0.9'
id 'org.ajoberstar.grgit' version '1.3.2'
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
apply plugin: "org.ajoberstar.grgit"
import org.ajorberstar.grgit.*
ext.git = grgit.open(file('.'))
ext {
configFile = file "build.properties"
revision = git.head().abbreviatedId
depth = git.log().size()
}
configFile.withReader {
def prop = new Properties()
prop.load(it)
//noinspection GrUnresolvedAccess
ext.config = new ConfigSlurper().parse prop
}
version = config.mod_version
group= "portablejim.audiodeath" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "audiodeath"
minecraft {
version = config.minecraft_version + "-" + config.forge_version
mappings = "snapshot_20160320"
runDir = "run"
}
version = "${config.minecraft_version}-${config.mod_version}.${ext.depth}+${ext.revision}"
processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
include 'version.properties'
// replace version and mcversion
expand 'version':project.config.mod_version, 'mcversion':project.config.minecraft_version, 'gitrev': revision, 'revnumber': depth
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude 'version.properties'
}
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
}
jar {
manifest {
attributes 'ModSide': 'CLIENT'
}
}
//noinspection GrUnresolvedAccess
task release(type: Copy) {
dependsOn "build"
from project.tasks.jar.archivePath
into "release/"
}
build.dependsOn deobfJar
artifacts {
archives deobfJar
}
configurations {
deployerJars
}
uploadArchives {
dependsOn 'reobf'
repositories {
if(project.hasProperty("pushMaven")) {
logger.info("Pushing to maven repo")
mavenDeployer {
configuration = configurations.deployerJars
repository(url: "file://localhost/home/public_html/maven.jamesmckay.id.au/htdocs/")
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
packaging = 'jar'
description 'Audio Death mod'
}
}
}
}
}
curseforge {
if (project.hasProperty('curseForgeApiKey')) apiKey = project.curseForgeApiKey
else apiKey = 0
//debug = true
project {
id = '225125'
changelog = new File('Changelog.md').getText('utf-8').split('\n-{3,8}|\n\n')[2]
changelogType = 'text'
releaseType = 'alpha' // Just a default
mainArtifact (jar) {
displayName = "Audio Death $config.mod_version [MC$config.compatible_versions; rev $depth]"
}
addArtifact deobfJar
//addGameVersion config.compatible_versions
for (String newVersion : config.compatible_versions.split(",")) {
addGameVersion newVersion
}
}
}
task curseAlpha(dependsOn: tasks.curseforge) {}
task curseBeta(dependsOn: tasks.curseforge) {}
task curseRelease(dependsOn: tasks.curseforge) {}
gradle.taskGraph.whenReady { taskGraph ->
curseforge.curseProjects.each { it.mainArtifact.displayName = "Audio Death $config.mod_version [MC$config.compatible_versions; rev $ext.depth]" }
if (taskGraph.hasTask(curseAlpha)) {
curseforge.curseProjects.each { it.additionalArtifacts.each { it.releaseType = 'alpha' } }
curseforge.curseProjects.each { it.releaseType = 'alpha' }
curseforge.curseProjects.each { it.mainArtifact.releaseType = 'alpha' }
} else if (taskGraph.hasTask(curseBeta)) {
curseforge.curseProjects.each { it.releaseType = 'beta' }
curseforge.curseProjects.each { it.mainArtifact.releaseType = 'beta' }
curseforge.curseProjects.each { it.additionalArtifacts.each { it.releaseType = 'beta' } }
} else if (taskGraph.hasTask(curseRelease)) {
curseforge.curseProjects.each { it.releaseType = 'release' }
curseforge.curseProjects.each { it.mainArtifact.releaseType = 'release' }
curseforge.curseProjects.each { it.additionalArtifacts.each { it.releaseType = 'release' } }
}
}