-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
133 lines (117 loc) · 3.35 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
//file:noinspection GroovyAccessibility
//file:noinspection GroovyAssignabilityCheck
plugins {
id "java-library"
id "idea"
id "maven-publish"
}
def isSnapshotVersion = { versionString ->
return versionString.contains("-g")
}
def getGitVersion = { ->
def projectVersion = rootProject.mod_version + "+" + rootProject.minecraft_version
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine "git", "describe", "--tags"
standardOutput = stdout
}
def gitVersionString = stdout.toString().trim()
def gitVersionStringParsed = gitVersionString.startsWith("v") ? gitVersionString.substring(1) : gitVersionString
// If it's a snapshot version, append '-SNAPSHOT'
if (isSnapshotVersion(gitVersionStringParsed)) {
return gitVersionStringParsed + "-SNAPSHOT"
} else {
return projectVersion
}
}
catch (Exception ignored) {
return projectVersion
}
}
println("${rootProject.mod_name} version: ${getGitVersion()}")
allprojects {
apply plugin: "java-library"
apply plugin: "idea"
version = "${getGitVersion()}"
group = project.maven_group
repositories {
mavenCentral()
maven { url = "https://api.modrinth.com/maven" }
maven { url = "https://jitpack.io" }
maven { url = "https://maven.shedaniel.me/" }
maven { url = "https://maven.blamejared.com" }
maven { url = "https://minecraft.guntram.de/maven/" }
maven { url = "https://maven.terraformersmc.com/" }
// maven { url = "https://maven.wispforest.io/" }
maven { url = "https://maven.cafeteria.dev" }
maven { url = "https://maven.gegy.dev" }
maven { url = "https://maven.kosmx.dev/" }
maven { url = "https://jitpack.io" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
maven {
name = "Xander Maven"
url = "https://maven.isxander.dev/releases"
}
maven {
name = "Ladysnake Mods"
url = "https://maven.ladysnake.org/releases"
}
// Reach entity attributes, and more
maven {
url = "https://maven.jamieswhiteshirt.com/libs-release"
content {
includeGroup "com.jamieswhiteshirt"
}
}
maven {
url "https://dl.cloudsmith.io/public/klikli-dev/mods/maven/"
content {
includeGroup "com.klikli_dev"
}
}
}
dependencies {
api(annotationProcessor("org.projectlombok:lombok:1.18.34"))
api("org.jetbrains:annotations:24.1.0")
api("com.google.guava:guava:33.2.1-jre")
api("org.apache.logging.log4j:log4j-core:2.23.1")
api("com.google.code.gson:gson:2.11.0")
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = "${rootProject.java_version}" as int
}
}
subprojects { project ->
if (project.name != 'content') {
apply plugin: "maven-publish"
publishing {
repositories {
maven {
name = "ReposiliteMavenRepo"
// Determine if it's a snapshot and adjust the URL accordingly.
url = isSnapshotVersion(project.version) ?
"https://maven.sigmundgranaas.com/snapshots/" :
"https://maven.sigmundgranaas.com/releases/"
credentials {
username 'admin'
password System.getenv("REPOSILITE_ADMIN_SECRET")
}
}
}
publications {
mavenJava(MavenPublication) {
groupId = group
if (project.name === 'fabric') {
artifactId = "${rootProject.mod_id}-fabric"
archivesBaseName = "${rootProject.mod_id}-fabric"
} else {
artifactId = archivesBaseName
}
from components.java
}
}
}
}
}