-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.gradle.kts
113 lines (101 loc) · 3.09 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
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
import org.gradle.jvm.tasks.Jar
import java.nio.file.FileSystems
import kotlin.io.path.*
plugins {
id("io.freefair.lombok") version "8.11" apply false
id("com.modrinth.minotaur") version "2.+" apply false
id("com.gradleup.shadow") version "8.+" apply false
id("dev.yumi.gradle.licenser") version "2.0.+"
id("io.github.p03w.machete") version "2.+" apply false
id("fabric-loom") version "1.9.+" apply false
id("ploceus") version "1.9.+" apply false
}
version = "${project.version}"
group = "io.github.axolotlclient"
repositories {
maven {
url = uri("https://moehreag.duckdns.org/maven/releases")
}
mavenCentral()
}
allprojects {
repositories {
maven("https://maven.terraformersmc.com/releases")
maven("https://maven.fabricmc.net")
maven("https://maven.quiltmc.org/repository/release")
maven("https://moehreag.duckdns.org/maven/releases")
maven("https://moehreag.duckdns.org/maven/snapshots")
maven("https://maven.parchmentmc.org")
maven("https://repo.hypixel.net/repository/Hypixel/") {
content {
includeGroup("net.hypixel")
}
}
maven("https://api.modrinth.com/maven") {
content {
includeGroup("maven.modrinth")
}
}
mavenLocal()
mavenCentral()
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
apply(plugin = "io.freefair.lombok")
apply(plugin = "com.modrinth.minotaur")
apply(plugin = "dev.yumi.gradle.licenser")
extensions.getByType(JavaPluginExtension::class).withSourcesJar()
tasks.getByName("jar", Jar::class) {
filesMatching("LICENSE") {
rename("^(LICENSE.*?)(\\..*)?$", "\$1_${archiveBaseName}\$2")
}
}
license {
rule(file("../HEADER"))
include("**/*.java")
}
tasks.register("collectBuilds") {
dependsOn(tasks.getByName("build"))
if (project.name == "common") {
enabled = false
}
actions.addLast {
val outDir = rootProject.projectDir.resolve("builds").toPath()
outDir.createDirectories()
val archiveDir = outDir.resolve("archive")
outDir.listDirectoryEntries().forEach { old ->
if (!old.isRegularFile()) {
return@forEach
}
val oldName = old.fileName.toString()
val oldVer = oldName.substring(0, oldName.indexOf("+"))
val mcVer = oldName.substring(oldName.indexOf("+")+1, oldName.length-4).removeSuffix("-sources")
if (!project.version.toString().contains(mcVer)) {
return@forEach
}
// check if it's the current version, if it is we don't archive it
if (project.version.toString().contains(oldVer.substring(oldVer.indexOf("-")+1))) {
return@forEach
}
archiveDir.createDirectories()
val versionArchive = archiveDir.resolve("$oldVer.zip")
synchronized(rootProject) {
(if (versionArchive.notExists()) {
FileSystems.newFileSystem(versionArchive, mapOf("create" to "true"))
} else {
FileSystems.newFileSystem(versionArchive)
}).use {
old.moveTo(it.getPath(oldName))
}
}
}
project.layout.buildDirectory.dir("libs").get().asFileTree.files.forEach { file ->
if (file.name.contains(project.version.toString())) {
file.toPath().copyTo(outDir.resolve(file.name.toString()), overwrite = true)
}
}
}
}
}