This repository has been archived by the owner on May 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
174 lines (148 loc) · 4.33 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
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}
plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
id "maven-publish"
}
apply plugin: 'net.minecraftforge.gradle'
def build_number = System.getenv('BUILD_NUMBER') != null ? System.getenv('BUILD_NUMBER') : 'CUSTOM'
version = "${mc_version}-${mod_version}-${build_number}"
group = "mcp.mobius.waila"
archivesBaseName = "SoulShardsRespawn-forge"
minecraft {
mappings channel: "snapshot", version: "20200125-1.15.1"
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'info'
property 'username', 'SoulShards'
mods {
waila {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run/server')
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'info'
mods {
waila {
source sourceSets.main
}
}
}
}
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include '**/*.toml'
expand 'version': project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.toml'
}
}
repositories {
maven { url "https://tehnut.info/maven" }
}
dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
compileOnly fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}:api")
runtimeOnly fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}")
}
apply from: "gradle/process_mod_info.gradle"
// Combine main and API source sets
jar {
from sourceSets.main.output
manifest {
attributes(["Specification-Title": project.version,
"Specification-Vendor": "TehNut",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"TehNut",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
}
}
// API jar
task apiJar(type: Jar) {
classifier = 'api'
include 'info/tehnut/soulshardsrespawn/**/*'
from sourceSets.main.allSource
from sourceSets.main.output
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
tasks.build.dependsOn apiJar, sourcesJar
tasks.withType(JavaCompile) { task ->
task.options.encoding = 'UTF-8'
}
publishing {
tasks.publish.dependsOn 'build'
publications {
mavenJava(MavenPublication) {
artifact jar
artifact sourcesJar
artifact apiJar
}
}
repositories {
if (project.hasProperty('maven_repo')) {
maven { url maven_repo }
} else {
mavenLocal()
}
}
}
String getChangelogText() {
def changelogFile = new File('changelog.txt')
String str = ''
String separator = '---'
int lineCount = 0
boolean done = false
changelogFile.eachLine {
if (done || it == null) {
return
}
if (lineCount < 3) {
lineCount++
if (it.startsWith(separator)) {
return
}
}
if (!it.startsWith(separator)) {
str += "$it" + (lineCount < 3 ? ':\n\n' : '\n')
return
}
done = true // once we go past the first version block, parse no more
}
return str
}
curseforge {
if (project.hasProperty('curse_key_TehNut'))
apiKey = project.curse_key_TehNut
project {
id = "${curse_id}"
changelog = getChangelogText()
releaseType = 'release'
addGameVersion "Forge"
addGameVersion "1.15"
addGameVersion "1.15.1"
addGameVersion "1.15.2"
addArtifact sourcesJar
addArtifact apiJar
}
}