-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
72 lines (61 loc) · 2.38 KB
/
build.gradle.kts
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
plugins {
java
`maven-publish`
}
group = extra["project.group"]?.toString() ?: throw IllegalArgumentException("The project group has not been set.")
version = extra["project.version"]?.toString() ?: throw IllegalArgumentException("The project version has not been set.")
val gitBranch = System.getenv("GITHUB_REF_NAME")
val gitCommit = System.getenv("GITHUB_SHA")
if (gitBranch != null && gitCommit != null) {
val shortenedCommit = gitCommit.substring(0, 7)
version = "$version-SNAPSHOT+$gitBranch-$shortenedCommit"
}
repositories {
mavenCentral()
maven("https://libraries.minecraft.net/")
maven("https://maven.fabricmc.net/")
}
dependencies {
implementation("commons-io:commons-io:2.11.0")
implementation("org.ow2.asm:asm-tree:9.4")
implementation("net.fabricmc:tiny-mappings-parser:0.3.0+build.17")
compileOnly("org.apache.logging.log4j:log4j-api:2.8.1")
compileOnly("org.slf4j:slf4j-api:1.8.0-beta4")
}
java {
withSourcesJar()
withJavadocJar()
}
publishing {
publications.create<MavenPublication>("mavenJava") {
artifactId =
extra["project.name"]?.toString()
?: throw IllegalArgumentException("The project name has not been set.")
groupId = project.group.toString()
version = project.version.toString()
from(components["java"])
}
repositories {
val publishingUsername = project.findProperty("spruceloader.publishing.username")?.toString() ?: System.getenv("SPRUCELOADER_PUBLISHING_USERNAME")
val publishingPassword = project.findProperty("spruceloader.publishing.password")?.toString() ?: System.getenv("SPRUCELOADER_PUBLISHING_PASSWORD")
if (publishingUsername != null && publishingPassword != null) {
fun MavenArtifactRepository.applyCredentials() {
authentication.create<BasicAuthentication>("basic")
credentials {
username = publishingUsername
password = publishingPassword
}
}
maven {
name = "SpruceReleases"
url = uri("https://maven.spruceloader.xyz/releases")
applyCredentials()
}
maven {
name = "SpruceSnapshots"
url = uri("https://maven.spruceloader.xyz/snapshots")
applyCredentials()
}
}
}
}