-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
95 lines (80 loc) · 2.03 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
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'java'
id 'maven-publish'
}
base {
archivesName = "energy"
}
def ENV = System.getenv()
group = "teamreborn"
version = project.mod_version
loom {
addRemapConfiguration("testModImplementation") {
targetConfigurationName = "test"
onCompileClasspath = true
onRuntimeClasspath = true
}
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modApi fabricApi.module("fabric-transfer-api-v1", project.fabric_version)
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
testModImplementation fabricApi.module("fabric-registry-sync-v0", project.fabric_version)
}
test {
useJUnitPlatform()
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 21
}
jar {
from "LICENSE"
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
publishing {
publications {
create("maven", MavenPublication) {
groupId 'teamreborn'
artifactId project.base.archivesName.get()
version project.version
from components.java
}
}
repositories {
if (ENV.MAVEN_URL) {
maven {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}
// A task to ensure that the version being released has not already been released.
task checkVersion {
doFirst {
def xml = new URL("https://maven.fabricmc.net/teamreborn/energy/maven-metadata.xml").text
def metadata = new XmlSlurper().parseText(xml)
def versions = metadata.versioning.versions.version*.text();
if (versions.contains(version)) {
throw new RuntimeException("${version} has already been released!")
}
}
}
publish.mustRunAfter checkVersion