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 9
/
Copy pathbuild.gradle
111 lines (96 loc) · 2.78 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
plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
id 'fabric-loom' version '0.4-SNAPSHOT'
id "maven-publish"
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
def build_number = System.getenv('BUILD_NUMBER') != null ? System.getenv('BUILD_NUMBER') : 'CUSTOM'
group = package_group
archivesBaseName = "${mod_name}-fabric"
version = "${mc_version}-${mod_version}-${build_number}"
minecraft {
refmapName = mod_name.toLowerCase() + '-refmap.json'
}
repositories {
maven { url = "https://maven.abusedmaster.xyz/" }
maven { url = "https://jitpack.io" }
}
dependencies {
minecraft "com.mojang:minecraft:${mc_version}"
mappings "net.fabricmc:yarn:${mc_version}+build.${mappings_version}:v2"
modCompile "net.fabricmc:fabric-loader:${loader_version}"
modCompile "net.fabricmc.fabric-api:fabric-api:${api_version}"
modCompile "com.github.emilyploszaj:trinkets:v${trinkets_version}"
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
}
task apiJar(type: Jar) {
from sourceSets.main.allSource
from sourceSets.main.output
include 'info/tehnut/soulbound/api/**/*'
classifier = 'api'
}
publishing {
tasks.publish.dependsOn 'build'
publications {
mavenJava(MavenPublication) {
artifact remapJar
artifact sourcesJar
artifact apiJar
}
}
repositories {
if (project.hasProperty('maven_repo')) {
maven { url maven_repo }
} else {
mavenLocal()
}
}
}
curseforge {
if (project.hasProperty('curse_key_TehNut'))
apiKey = project.curse_key_TehNut
project {
id = "${curse_id}"
changelog = getChangelogText()
releaseType = 'release'
addGameVersion "1.16.1"
addGameVersion "Java 8"
addArtifact sourcesJar
addArtifact apiJar
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))
afterEvaluate {
uploadTask.dependsOn(remapJar)
}
}
options {
forgeGradleIntegration = false
}
}
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
}