-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
93 lines (81 loc) · 3.25 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
plugins {
id 'fabric-loom' version '1.8-SNAPSHOT' apply false
id 'com.github.johnrengelman.shadow' version '7.1.0' apply false
id 'org.cadixdev.licenser' version '0.6.1' apply false
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
}
subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'org.cadixdev.licenser'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
version = project.mod_version + "." + getVersionSuffix()
license {
header = rootProject.file('HEADER.txt')
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://repo.codemc.org/repository/maven-public' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
afterEvaluate {
if (it.plugins.hasPlugin("com.modrinth.minotaur")) {
modrinth {
token = System.getenv("MODRINTH_TOKEN") // This is the default. Remember to have the MODRINTH_TOKEN environment variable set or else this will fail, or set it to whatever you want - just make sure it stays private!
projectId = "raknetify" // This can be the project ID or the slug. Either will work!
// versionNumber = project.version + "+" + project.minecraft_version // You don't need to set this manually. Will fail if Modrinth has this version already
// versionName = project.version + " devbuild for " + project.minecraft_version
versionType = "alpha" // This is the default -- can also be `beta` or `alpha`
// uploadFile = remapShadowJar // With Loom, this MUST be set to `remapJar` instead of `jar`!
gameVersions = ["1.17", "1.17.1", "1.18", "1.18.1", "1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4", "1.20.5", "1.20.6", "1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4"]
// loaders = ["fabric"]
changelog = com.ishland.buildscript.ParseGItHubActionChangelog.getChangelog()
}
}
}
}
afterEvaluate {
logger.lifecycle("Version String: ${project.mod_version + '.' + getVersionSuffix()}")
logger.lifecycle(com.ishland.buildscript.ParseGItHubActionChangelog.getChangelog())
}
String getVersionSuffix() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--dirty'
standardOutput = stdout
}
stdout = stdout.toString().strip()
def suffix = ""
if (stdout.endsWith("-dirty")) {
stdout = stdout.substring(0, stdout.length() - "-dirty".length())
suffix = "-dirty"
}
if (stdout.indexOf('-') < 0) {
return "0" + suffix;
}
def split = stdout.split('-')
return split[split.length - 2] + suffix
}