-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.gradle
112 lines (93 loc) · 2.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
plugins {
id 'java'
id 'maven-publish'
id 'checkstyle'
id 'eclipse'
id "com.diffplug.spotless" version "6.23.3"
}
group 'net.fabricmc'
version '1.5.3'
def ENV = System.getenv()
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")
base {
archivesName = "fabric-meta"
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'io.javalin:javalin:5.6.3'
implementation 'org.slf4j:slf4j-simple:2.0.9'
implementation 'commons-io:commons-io:2.15.1'
implementation 'org.jetbrains:annotations:24.1.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.2"
testImplementation 'io.javalin:javalin-testtools:5.6.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
java {
sourceCompatibility = 21
targetCompatibility = 21
}
test {
useJUnitPlatform()
}
jar {
manifest {
attributes "Main-Class": "net.fabricmc.meta.FabricMeta"
}
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 21
}
spotless {
lineEndings = com.diffplug.spotless.LineEnding.UNIX
java {
licenseHeaderFile(rootProject.file("HEADER"))
removeUnusedImports()
importOrder('java', 'javax', '', 'net.fabricmc')
indentWithTabs()
trimTrailingWhitespace()
}
}
checkstyle {
configFile = file('checkstyle.xml')
toolVersion = "10.12.1"
}
publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.base.archivesName.get()
version project.version
artifact jar
}
}
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/net/fabricmc/fabric-meta/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