-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
161 lines (142 loc) · 5.42 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
plugins {
id 'architectury-plugin' version '3.4-SNAPSHOT'
id 'dev.architectury.loom' version '1.7-SNAPSHOT' apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id "com.modrinth.minotaur" version "2.+" apply false
id 'net.darkhax.curseforgegradle' version '1.1.+' apply false
}
architectury {
minecraft = rootProject.minecraft_version
}
allprojects {
group = "terrails.colorfulhearts"
version = rootProject.mod_version
}
// all subprojects
configure(subprojects.findAll { it.name != "api" }) {
apply plugin: 'dev.architectury.loom'
apply plugin: 'architectury-plugin'
// disable ExpectPlatform since it seems to randomly not get applied when building
architectury.injectInjectables = false
loom {
accessWidenerPath = project(":common").file("src/main/resources/colorfulhearts.accesswidener")
}
base {
// colorfulhearts-loader-version
archivesBaseName = "colorfulhearts-${project.name}-${rootProject.minecraft_version}"
}
repositories {
maven { url = "https://maven.parchmentmc.org" }
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.21:${rootProject.parchment_version}@zip" as String)
}
}
java {
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 21
}
}
// all non-api subprojects
configure(subprojects.findAll { !it.path.startsWith(":api") }) {
repositories {
maven { url "https://maven.ryanliptak.com/" }
maven { url "https://maven.shedaniel.me/" }
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
}
tasks.register('printChangelog') {
doLast {
println(fetchChangelog())
}
}
// From https://github.com/architectury/architectury-api/blob/7f76087ffb453a7b1c65ce53a8e0ed05745575aa/build.gradle#L93
ext.fetchChangelog = {
def branch = "git rev-parse --abbrev-ref HEAD".execute().in.text.trim()
if (branch.isBlank() || branch == "HEAD") {
throw new GradleException("Branch name could not be fetched.")
}
def repoUrl = "https://github.com/terrails/colorful-hearts"
def changes = new StringBuilder("Latest changes ([See all](${repoUrl}/commits/${branch}))\n---")
def log = "git log --max-count=30 --no-merges --pretty=format:\"* %s ([%h](${repoUrl}/commit/%H))\"".execute()
log.in.eachLine { line ->
if (!line.startsWithIgnoreCase("* bump")) { // version change commits should be ignored
changes << "\n${line}"
}
}
if (log.waitFor() == 0) {
return changes.toString()
} else {
throw new GradleException("Received an error while executing git log.")
}
}
}
// all non-common subprojects
configure(subprojects.findAll { it.name != "common" && it.name != "api" }) {
apply plugin: 'maven-publish'
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}
publishing {
publications {
maven(MavenPublication) {
groupId = rootProject.group
artifactId = "colorfulhearts-${project.name}${project.path.startsWith(':api') ? "-api" : ""}"
from components.java
// From https://github.com/Fuzss/modresources/blob/d40b8125cadb6ab1b56d90c03eb0c09a666d949a/gradle/v2/main.gradle#L235-L260
pom {
name = "Colorful Hearts"
description = "A client side mod that replaces multiple vanilla heart rows with a single row using colored hearts"
url = "https://github.com/Terrails/colorful-hearts"
scm {
url = "https://github.com/Terrails/colorful-hearts"
connection = "scm:git:git://github.com/Terrails/colorful-hearts.git"
developerConnection = "scm:git:[email protected]:Terrails/colorful-hearts.git"
}
issueManagement {
system = "github"
url = "https://github.com/Terrails/colorful-hearts/issues"
}
licenses {
license {
name = "MIT"
url = "https://spdx.org/licenses/MIT.html"
}
}
developers {
developer {
id = "terrails"
name = "Terrails"
}
}
}
}
}
if (System.getenv("MODMAVEN_PATH")) {
def mavenPath = System.getenv("MODMAVEN_PATH")
if (file(mavenPath).exists()) {
repositories {
maven {
name = "ModMaven"
url "file://" + System.getenv("MODMAVEN_PATH")
}
}
}
}
}
}