-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
88 lines (74 loc) · 2.15 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
plugins {
id "java"
id "maven-publish"
id 'com.github.johnrengelman.shadow' version '5.0.0'
}
sourceCompatibility = targetCompatibility = 1.8
compileJava {
sourceCompatibility = targetCompatibility = 1.8
}
version = "${fw_version}${-> getVersionSuffix()}"
group = "net.kunmc.lab"
archivesBaseName = rootProject.name
configurations {
shadow {
implementation.extendsFrom shadow
}
}
shadowJar {
configurations = [project.configurations.shadow]
}
tasks.assemble.dependsOn(shadowJar)
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
}
dependencies {
compileOnly "net.minecraftforge:installer:2.1.4"
shadow project(":legacy")
}
java {
withSourcesJar()
}
jar {
manifest.attributes([
"Specification-Title": "${project.name}",
"Specification-Vendor": "Kamesuta",
"Specification-Version": "${project.version}".split("-")[0],
"Implementation-Title": "${project.name}",
"Implementation-Version": "${project.version}",
"Implementation-Vendor" :"Kamesuta",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Automatic-Module-Name": "${project.group}.${project.archivesBaseName}".toString().toLowerCase(),
"Multi-Release": "true",
"Main-Class": "net.kunmc.lab.forgecli.Main",
"GitCommit": String.valueOf(System.getenv("GITHUB_SHA"))
])
}
publishing {
publications {
maven(MavenPublication) {
groupId "${project.group}"
artifactId "${project.archivesBaseName}"
version "${project.version}"
from components.java
}
}
repositories {
maven {
url = layout.buildDirectory.dir("maven")
}
}
}
tasks.publish.dependsOn build
static String getVersionSuffix() {
if (System.getenv("IS_PUBLICATION") != null) {
return ""
} else if (System.getenv("GITHUB_RUN_NUMBER") != null && System.getenv("GITHUB_SHA") != null) {
return "-s." + System.getenv("GITHUB_RUN_NUMBER") + "-" + System.getenv("GITHUB_SHA").substring(0, 7)
}
return "-LOCAL"
}