Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api
6 changes: 5 additions & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ repositories {
}

dependencies {
implementation(libs.kotlinReflect)
implementation(libs.kotlinStdlib)
implementation(libs.kotlinStdlib7)
implementation(libs.kotlinStdlib8)
implementation(libs.kotlin)
implementation(libs.licenser)
// implementation(libs.licenser)
implementation(libs.blossom)
implementation(libs.shadow)
implementation(libs.loom)
Expand Down
7 changes: 7 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import ca.stellardrift.build.configurate.ConfigFormats
import ca.stellardrift.build.configurate.catalog.PolyglotVersionCatalogExtension

pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}

plugins {
id("ca.stellardrift.polyglot-version-catalogs") version "6.1.0"
}
Expand Down
24 changes: 9 additions & 15 deletions build-logic/src/main/kotlin/extensions/Git.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import java.io.ByteArrayOutputStream
fun Project.getLatestGitCommitHash(): String {
return try {
val byteOut = ByteArrayOutputStream()
project.exec {
this.commandLine = "git rev-parse --short HEAD".split(" ")
this.standardOutput = byteOut
val task = providers.exec {
commandLine("git rev-parse --short HEAD".split(" "))
}

byteOut.toString("UTF-8").trim()
task.standardOutput.asText.get()
} catch (ex: Exception) {
"Unknown"
}
Expand All @@ -20,15 +19,11 @@ fun Project.getLatestGitCommitHash(): String {
fun Project.getPreviousTag(): String {
return try
{
val byteOut = ByteArrayOutputStream()
val error = ByteArrayOutputStream()
project.exec {
this.commandLine = "git describe --abbrev=0 --tags --exclude=${getLatestTag()}".split(" ")
this.standardOutput = byteOut
this.errorOutput = error
val task = providers.exec {
commandLine("git describe --abbrev=0 --tags --exclude=${getLatestTag()}".split(" "))
}

byteOut.toString("UTF-8").trim()
task.standardOutput.asText.get()
} catch (ex: Exception) {
"Unknown"
}
Expand All @@ -38,12 +33,11 @@ fun Project.getLatestTag(): String {
return try
{
val byteOut = ByteArrayOutputStream()
project.exec {
this.commandLine = "git describe --abbrev=0 --tags".split(" ")
this.standardOutput = byteOut
val task = providers.exec {
commandLine("git describe --abbrev=0 --tags".split(" "))
}

byteOut.toString("UTF-8").trim()
task.standardOutput.asText.get()
} catch (ex: Exception) {
"Unknown"
}
Expand Down
15 changes: 9 additions & 6 deletions build-logic/src/main/kotlin/impactor.base-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import extensions.getLatestGitCommitHash

plugins {
`java-library`
id("org.cadixdev.licenser")
// id("org.cadixdev.licenser")
id("net.kyori.blossom")
kotlin("jvm")
}
Expand All @@ -25,34 +25,36 @@ repositories {
includeModule("me.lucko", "spark-api")
}
}

maven("https://jitpack.io")
mavenLocal()
}

version = rootProject.version

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
languageVersion.set(JavaLanguageVersion.of(25))
}
}

tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
dependsOn(updateLicenses)
// dependsOn(updateLicenses)
finalizedBy(test)
}

jar {
if(project.parent?.name.equals("api")) {
archiveBaseName.set("Impactor-API-${project.name.substring(0, 1).toUpperCase()}${project.name.substring(1)}")
archiveBaseName.set("Impactor-API-${project.name.substring(0, 1).uppercase()}${project.name.substring(1)}")
} else {
archiveBaseName.set("Impactor-${project.name.substring(0, 1).toUpperCase()}${project.name.substring(1)}")
archiveBaseName.set("Impactor-${project.name.substring(0, 1).uppercase()}${project.name.substring(1)}")
}
archiveClassifier.set("dev-slim")
}
}

/*
license {
header(rootProject.file("HEADER.txt"))
properties {
Expand All @@ -61,6 +63,7 @@ license {
this.set("year", 2022)
}
}
*/

sourceSets {
main {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import extensions.isRelease
import extensions.writeVersion
import net.fabricmc.loom.task.RemapJarTask
import org.gradle.configurationcache.extensions.capitalized

plugins {
id("impactor.loom-conventions")

id("com.modrinth.minotaur")
id("com.github.johnrengelman.shadow")
id("com.gradleup.shadow")
}

val bundle: Configuration by configurations.creating {
Expand All @@ -19,38 +17,59 @@ dependencies {
listOf(
"net.kyori:examination-api:1.3.0",
"net.kyori:examination-string:1.3.0",
"net.kyori:adventure-api:4.17.0",
"net.kyori:adventure-key:4.17.0",
"net.kyori:adventure-nbt:4.17.0",
"net.kyori:adventure-text-serializer-plain:4.17.0",
"net.kyori:adventure-text-serializer-legacy:4.17.0",
"net.kyori:adventure-text-serializer-gson:4.17.0",
"net.kyori:adventure-text-serializer-json:4.17.0",
"net.kyori:adventure-text-minimessage:4.17.0",
"net.kyori:adventure-text-logger-slf4j:4.17.0",
"net.kyori:event-api:5.0.0-SNAPSHOT",
"net.kyori:adventure-api:4.26.1",
"net.kyori:adventure-key:4.26.1",
"net.kyori:adventure-nbt:4.26.1",
"net.kyori:adventure-text-serializer-plain:4.26.1",
"net.kyori:adventure-text-serializer-legacy:4.26.1",
"net.kyori:adventure-text-serializer-gson:4.26.1",
"net.kyori:adventure-text-serializer-json:4.26.1",
"net.kyori:adventure-text-minimessage:4.26.1",
"net.kyori:adventure-text-logger-slf4j:4.26.1",
"com.github.KyoriPowered.event:event-api:master-SNAPSHOT",
).forEach { include(it) }
}

tasks {
val remapProductionJar by registering(RemapJarTask::class) {
listOf(shadowJar, remapJar).forEach {
dependsOn(it)
mustRunAfter(it)
}

inputFile.set(shadowJar.flatMap { it.archiveFile })

archiveBaseName.set("Impactor-${project.name.capitalize()}")
archiveVersion.set(writeVersion(true))
}

val minecraft = rootProject.property("minecraft")
dependencies {
include(project(":api:core"))
include(project(":api:config"))
include(project(":api:economy"))
include(project(":api:items"))
include(project(":api:mail"))
include(project(":api:players"))
include(project(":api:plugins"))
include(project(":api:scoreboard"))
include(project(":api:storage"))
include(project(":api:text"))
include(project(":api:translations"))
include(project(":api:ui"))
include(project(":impactor"))
include(project(":minecraft:api"))
include(project(":minecraft:impl"))


//from :impactor - api
include("net.impactdev.impactor.api:commands:5.3.1+26.1.2")

include("com.zaxxer:HikariCP:5.0.1")
include("com.h2database:h2:2.1.214")
include("mysql:mysql-connector-java:8.0.33")
include("org.mariadb.jdbc:mariadb-java-client:3.1.2")
include("org.mongodb:mongo-java-driver:3.12.12")

include("com.github.ben-manes.caffeine:caffeine:3.1.5")
}

tasks {
shadowJar {
dependsOn(tasks.jar)
archiveBaseName.set("Impactor-${project.name}")
archiveClassifier.set("dev-shadow")

from(
zipTree(tasks.jar.get().archiveFile.get().asFile)
)

dependencies {
include(project(":api:core"))
include(project(":api:config"))
Expand Down Expand Up @@ -121,19 +140,14 @@ tasks {
"org.apache.maven"
).forEach { relocate(it, "$prefix.$it") }
}

remapJar {
archiveBaseName.set("Impactor-${project.name.capitalize()}")
archiveVersion.set("${minecraft}-${rootProject.version}")
}
}

tasks.withType<PublishToMavenRepository> {
dependsOn(tasks["remapProductionJar"])
dependsOn(tasks["shadowJar"])
}

tasks.withType<GenerateModuleMetadata> {
dependsOn(tasks["remapProductionJar"])
dependsOn(tasks["shadowJar"])
}

tasks.modrinth {
Expand All @@ -143,11 +157,11 @@ tasks.modrinth {
modrinth {
token.set(System.getenv("MODRINTH_GRADLE_TOKEN"))
projectId.set("Impactor")
versionNumber.set("${writeVersion(true)}-${project.name.capitalized()}")
versionNumber.set("${writeVersion(true)}-${project.name}")
versionName.set("Impactor ${writeVersion(true)}")

versionType.set(if(!isRelease()) "beta" else "release")
uploadFile.set(tasks["remapProductionJar"])
uploadFile.set(tasks["shadowJar"])

gameVersions.set(listOf(rootProject.property("minecraft").toString()))

Expand Down
11 changes: 1 addition & 10 deletions build-logic/src/main/kotlin/impactor.loom-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
plugins {
id("impactor.base-conventions")
id("dev.architectury.loom")
id("dev.architectury.loom-no-remap")
id("architectury-plugin")
}

loom {
silentMojangMappingsLicense()

// val identifier: String = project.findProperty("identifier")?.toString() ?: project.name
// mixin.defaultRefmapName.set("mixins.impactor.$identifier.refmap.json")
// mixin.useLegacyMixinAp.set(false)
}

dependencies {
minecraft("com.mojang:minecraft:${rootProject.property("minecraft")}")
mappings(loom.officialMojangMappings())
}
14 changes: 7 additions & 7 deletions build-logic/src/main/kotlin/impactor.root-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ tasks {

val collect by registering(Copy::class) {
val filters = mapOf(
":launchers:fabric" to "remapProductionJar",
":launchers:neoforge" to "remapProductionJar",
":launchers:fabric" to "shadowJar",
":launchers:neoforge" to "shadowJar",
)

val tasks = subprojects.filter { filters.containsKey(it.path) }.map { it.tasks.named(filters.getValue(it.path)) }
Expand All @@ -34,13 +34,13 @@ tasks {
dependsOn(changelog)
doLast {
val plugin = this.project.rootProject.property("plugin")
val target = this.project.projectDir.toPath().resolve("$buildDir").resolve("deploy").resolve("$plugin.md")
if(!Files.exists(target)) {
Files.createDirectories(target.parent)
Files.createFile(target)
val target = getLayout().buildDirectory.dir("deploy").get().file("$plugin.md")
if(!target.asFile.exists()) {
target.asFile.parentFile?.mkdirs()
target.asFile.createNewFile()
}

Files.write(target, changelog.get().result.encodeToByteArray())
target.asFile.writeText(changelog.get().result)
}
}

Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
base
id("impactor.root-conventions")
id("architectury-plugin") version "3.4-SNAPSHOT" apply false
id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false
id("org.spongepowered.gradle.vanilla") version "0.2.1-SNAPSHOT" apply false
id("architectury-plugin") version "3.5-SNAPSHOT" apply false
id("dev.architectury.loom-no-remap") version "1.17-SNAPSHOT" apply false
id("org.spongepowered.gradle.vanilla") version "0.3.2-SNAPSHOT" apply false
}

group = "net.impactdev.impactor"
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.parallel=false

# Project Versions
plugin=5.3.6
minecraft=1.21.1
neoforge=21.1.66
fabric-loader=0.16.9
fabric-api=0.107.0+1.21.1
minecraft=26.1.2
neoforge=26.1.2.75
fabric-loader=0.18.4
fabric-api=0.151.0+26.1.2

# Is the project currently in a snapshot state?
snapshot = true
Expand Down
Loading