This repository has been archived by the owner on Sep 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
175 lines (159 loc) · 5.06 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
import groovy.json.JsonSlurper
buildscript {
repositories {
mavenCentral()
mavenLocal()
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'
}
}
tasks.whenTaskAdded {
if (it.name.startsWith('publish')) it.dependsOn 'preparePublication'
}
apply plugin: 'maven'
apply plugin: 'cauldron'
apply plugin: 'maven-publish'
apply plugin: 'signing'
minecraft {
version = '1.7.10'
mcpVersion = '9.05'
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
installerVersion = "1.4"
subprojects {
repositories {
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
}
srgExtra "PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_7_R4"
}
group = 'com.cyberdynecc.thermos'
archivesBaseName = 'thermos'
ext.buildInfoCached = null;
def buildInfo(String key) {
if (!buildInfoCached) {
if (project.hasProperty('officialBuild')) {
buildInfoCached = new JsonSlurper().parse(new URL("https://prok.pw/version/${group}/${name}"))
} else {
buildInfoCached = [
nextBuildNumber: 'UNOFFICIAL.' + gitInfo('hash'),
version : 'NONE'
]
}
}
return key ? buildInfoCached[key] : buildInfoCached;
}
ext.gitInfoCached = null;
def gitInfo(String key) {
if (!gitInfoCached) {
if (file('.git').exists()) {
gitInfoCached = [
hash : ['git', 'log', "--format=%h", '-n', '1'].execute().text.trim(),
fullHash: ['git', 'log', "--format=%H", '-n', '1'].execute().text.trim(),
branch : System.getenv("CI_BUILD_REF_NAME") ?: ['git', 'symbolic-ref', '--short', 'HEAD'].execute().text.trim(),
message : ['git', 'log', "--format=%B", '-n', '1'].execute().text.trim()
]
} else {
gitInfoCached = [
hash : 'NOT_A_GIT',
fullHash: 'NOT_A_GIT',
branch : 'NOT_A_GIT',
message : 'NOT_A_GIT'
]
}
}
return key ? gitInfoCached[key] : gitInfoCached;
}
ext.mcVersion = "1.7.10"
ext.forgeVersion = "1420"
ext.revision = buildInfo('nextBuildNumber')
version = "${mcVersion}-${forgeVersion}.${revision}"
println "Updated Thermos version: ${version}"
launch4j {
jreMinVersion = '1.6.0'
}
tasks.packageUniversal {
classifier = 'server'
manifest.attributes([
'Thermos-Git-Branch': gitInfo('branch'),
'Git-Hash': gitInfo('fullHash'),
'Thermos-Version': project.version,
'Implementation-Vendor': 'CyberdyneCC',
'Implementation-Title': project.name,
'Implementation-Version': 'Thermos-'+project.version,
'Forge-Version': '10.13.3.1420',
'Specification-Vendor': 'Bukkit Team',
'Specification-Title': 'Bukkit',
'Specification-Version': '1.7.10-R0.1-SNAPSHOT'
])
}
tasks.createChangelog.onlyIf { false }
task signJars(type: Sign, dependsOn: [packageUniversal, packageInstaller]) {
sign packageInstaller
sign packageUniversal
}
task preparePublication(dependsOn: signJars) {}
def getSignatureFiles = {
def allFiles = project.tasks.signJars.signatureFiles.collect { it }
def signedServer = allFiles.find { it.name.contains('-server') }
def signedInstaller = allFiles.find { it.name.contains('-installer') }
return [
[archive: signedServer, classifier: 'server', extension: 'jar.asc'],
[archive: signedInstaller, classifier: 'installer', extension: 'jar.asc']
]
}
publishing {
repositories {
maven {
name 'ProK'
url 'https://prok.pw/repo/'
credentials {
username project.hasProperty('prokRepoUsername') ? prokRepoUsername : null
password project.hasProperty('prokRepoPassword') ? prokRepoPassword : null
}
}
}
publications {
gpg(MavenPublication) {
getSignatureFiles().each { signature ->
artifact(signature.archive) {
classifier = signature.classifier
extension = signature.extension
}
}
}
jar(MavenPublication) {
artifact packageUniversal
artifact packageInstaller
}
}
}
tasks.generateProjectCauldron << {
def file = new File('eclipse/cauldron/build.gradle')
file.append('''
dependencies {
compile 'org.apache.httpcomponents:httpclient:4.4.1'
}
''')
}
configurations {
compile.extendsFrom exported
}
dependencies {
exported 'org.apache.httpcomponents:httpclient:4.4.1'
}
packageUniversal {
from { configurations.exported.collect { it.isDirectory() ? it : zipTree(it) } }
}