forked from portablejim/VeinMiner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
169 lines (133 loc) · 3.91 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
buildscript {
repositories {
mavenCentral()
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:1.2-SNAPSHOT'
}
}
apply plugin: 'forge'
apply plugin: 'maven'
apply plugin: 'curseforge'
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
//noinspection GrUnresolvedAccess
ext.config = new ConfigSlurper().parse prop
}
group= "portablejim.veinminer"
version = config.mod_version
archivesBaseName = "VeinMiner"
minecraft {
version = config.minecraft_version + "-" + config.forge_version
}
String buildNumber = "unknown"
if(System.getenv("BUILD_NUMBER") != null) {
buildNumber = System.getenv("BUILD_NUMBER")
}
version = "${config.minecraft_version}_${config.mod_version}.${buildNumber}"
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, 'buildnumber': buildNumber
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude 'version.properties'
}
}
ext.sharedmanifest = manifest {
attributes 'FMLCorePlugin': 'portablejim.veinminer.asm.VeinMinerCorePlugin'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
jar {
manifest = project.manifest {
from sharedmanifest
}
}
sourceCompatibility = 6
targetCompatibility = 6
task apiJar(type: Jar) {
from sourceSets.main.output
classifier = 'api'
include "portablejim/veinminer/api/**"
}
task deobfJar(type: Jar) {
from sourceSets.main.output
manifest = project.manifest {
from sharedmanifest
}
classifier = 'dev'
}
//noinspection GrUnresolvedAccess
task release(type: Copy) {
dependsOn "build"
from project.tasks.jar.archivePath
into "release/"
}
build.dependsOn apiJar, 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 'VeinMiner Mod'
}
}
}
}
}
ext.curseForgeReleaseType = null
task ('curseGeneral') << {
curse {
projectId = '67133'
if (project.hasProperty('curseForgeApiKey')) apiKey = project.curseForgeApiKey
else apiKey = 0
releaseType = curseForgeReleaseType
changelog = new File('Changelog.md').getText('utf-8').split('\n-{3,8}|\n\n')[2]
displayName = String.format('VeinMiner %s [MC%s; build %s]', config.mod_version, config.compatible_versions, buildNumber)
additionalArtifact deobfJar, apiJar
for (String newVersion : config.compatible_versions.split(",")) {
addGameVersion newVersion
}
}.execute()
}
task setCurseAlpha << {
print('Set alpha')
curseForgeReleaseType = 'alpha'
}
task setCurseRelease << {
print('Set release')
curseForgeReleaseType = 'release'
}
task curseAlpha(dependsOn: 'curseGeneral') {
curseGeneral.dependsOn setCurseAlpha
}
task curseRelease(dependsOn: 'curseGeneral') {
curseGeneral.dependsOn setCurseRelease
}