forked from FabricMC/fabric-meta
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
116 lines (97 loc) · 2.85 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
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GroovyAccessibility
plugins {
id 'java'
id 'application'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.6.1'
id 'eclipse'
id "com.github.gmazzo.buildconfig" version "5.2.0"
}
def legacyVersion = "1.7.8"
group 'net.legacyfabric'
version '1.5.3'
version = legacyVersion + "+fabricmc." + project.version
def ENV = System.getenv()
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")
sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "fabric-meta"
repositories {
mavenCentral()
}
dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
implementation group: 'io.javalin', name: 'javalin', version: '3.13.11'
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.32'
implementation group: 'commons-io', name: 'commons-io', version: '2.8.0'
}
buildConfig {
className("BuildConstants")
packageName("net.legacyfabric.meta")
useJavaOutput()
buildConfigField(String.class, "VERSION", "$project.version")
}
jar {
manifest {
attributes "Main-Class": "net.fabricmc.meta.FabricMeta"
}
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
mainClassName = 'net.fabricmc.meta.FabricMeta'
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = 8
}
}
license {
matching(excludes: ['**/BuildConstants.java'], includes: ['**/legacyfabric/**']) {
header = file("LF-ONLY-HEADER")
}
matching(includes: ['**/VersionDatabase.java', '**/MinecraftLauncherMeta.java','**/EndpointsV2.java',
'**/ProfileHandler.java', '**/MavenUrlVersion.java', '**/ServerBootstrap.java'
]) {
header = file('LF-HEADER')
}
header file('HEADER')
include '**/*.java'
exclude '**/BuildConstants.java'
}
publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
artifact jar
}
}
repositories {
if (ENV.MAVEN_PUBLISH_CREDENTIALS) {
maven {
url "https://maven.legacyfabric.net"
credentials {
username ENV.MAVEN_PUBLISH_CREDENTIALS.split(":")[0]
password ENV.MAVEN_PUBLISH_CREDENTIALS.split(":")[1]
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}
// A task to ensure that the version being released has not already been released.
task checkVersion {
doFirst {
def xml = new URL("https://maven.legacyfabric.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