-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
84 lines (72 loc) · 2.26 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
73
74
75
76
77
78
79
80
81
82
83
84
@file:Suppress("GradlePackageVersionRange")
plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("maven-publish")
}
val libVersion: String by project
group = "net.modmanagermc"
version = if(project.hasProperty("snapshot")) "$libVersion-SNAPSHOT" else libVersion
repositories {
maven("https://maven.fabricmc.net") {
name = "Fabric"
}
mavenCentral()
}
val loaderVersion: String by project
val fabricKotlinVersion: String by project
val kotlinVersion: String by project
dependencies {
local("net.fabricmc:fabric-language-kotlin:${fabricKotlinVersion}")
local("net.fabricmc:fabric-loader:$loaderVersion")
local("org.apache.httpcomponents:httpclient:4.5.13")
local("org.apache.logging.log4j:log4j-api:2.17.1")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
testImplementation("org.apache.logging.log4j:log4j-core:2.17.1")
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
}
fun DependencyHandler.local(dependencyNotation: Any) {
compileOnly(dependencyNotation)
testImplementation(dependencyNotation)
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
tasks {
test {
File("run").mkdirs()
workingDir("run")
}
processResources {
filesMatching("fabric.mod.json") {
expand(
mutableMapOf(
"version" to version,
"fabricKotlinVersion" to fabricKotlinVersion,
)
)
}
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ModManagerMC/core")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
register<MavenPublication>("gpr") {
from(components["java"])
artifact(sourcesJar.get())
}
}
}