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
101 changes: 62 additions & 39 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
plugins {
id("fabric-loom")
kotlin("jvm")
id("com.google.devtools.ksp")
id("com.gorylenko.gradle-git-properties") version "2.5.2"
id("io.gitlab.arturbosch.detekt") version "1.23.6"
id("com.github.node-gradle.node") version "7.1.0"
Expand Down Expand Up @@ -89,44 +90,51 @@ fun Configuration.excludeProvidedLibs() = apply {
includeDependency.excludeProvidedLibs()
includeModDependency.excludeProvidedLibs()

configurations.include.get().extendsFrom(includeModDependency)
configurations.modApi.get().extendsFrom(includeModDependency)
configurations.modCompileOnlyApi.get().extendsFrom(includeModDependency)

repositories {
mavenCentral()
mavenLocal()
maven {
name = "CCBlueX"
url = uri("https://maven.ccbluex.net/releases")
}
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
maven {
name = "Jitpack"
url = uri("https://jitpack.io")
}
maven {
name = "TerraformersMC"
url = uri("https://maven.terraformersmc.com/")
}
maven {
name = "ViaVersion"
url = uri("https://repo.viaversion.com/")
}
maven {
name = "modrinth"
url = uri("https://api.modrinth.com/maven")
configurations {
include {
extendsFrom(includeModDependency)
}
maven {
name = "OpenCollab Snapshots"
url = uri("https://repo.opencollab.dev/maven-snapshots/")
modApi {
extendsFrom(includeModDependency)
}
maven {
name = "Lenni0451"
url = uri("https://maven.lenni0451.net/everything")
}

allprojects {
repositories {
mavenLocal()
mavenCentral()
maven {
name = "CCBlueX"
url = uri("https://maven.ccbluex.net/releases")
}
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
maven {
name = "Jitpack"
url = uri("https://jitpack.io")
}
maven {
name = "TerraformersMC"
url = uri("https://maven.terraformersmc.com/")
}
maven {
name = "ViaVersion"
url = uri("https://repo.viaversion.com/")
}
maven {
name = "modrinth"
url = uri("https://api.modrinth.com/maven")
}
maven {
name = "OpenCollab Snapshots"
url = uri("https://repo.opencollab.dev/maven-snapshots/")
}
maven {
name = "Lenni0451"
url = uri("https://maven.lenni0451.net/everything")
}
}
}

Expand Down Expand Up @@ -155,6 +163,11 @@ dependencies {
modApi("com.viaversion:viafabricplus-api:${viafabricplus_version}")
modRuntimeOnly("com.viaversion:viafabricplus:${viafabricplus_version}")

// KSP
api(project(":liquid-inbuilt-annotations"))
include(project(":liquid-inbuilt-annotations")) // use `include` because it has no extra dependency
ksp(project(":liquid-ksp"))

// Minecraft Authlib
includeDependency("com.github.CCBlueX:mc-authlib:${project.property("mc_authlib_version")}")

Expand Down Expand Up @@ -203,10 +216,9 @@ dependencies {

afterEvaluate {
includeDependency.incoming.resolutionResult.allDependencies.forEach {
val compileOnlyApiDependency = dependencies.compileOnlyApi(it.requested.toString()) {
val apiDependency = dependencies.api(it.requested.toString()) {
isTransitive = false
}
val apiDependency = dependencies.api(compileOnlyApiDependency)!!

dependencies.include(apiDependency)
}
Expand Down Expand Up @@ -356,7 +368,11 @@ tasks.register<CompareJsonKeysTask>("verifyI18nJsonKeys") {

val languageFolder = file("src/main/resources/resources/liquidbounce/lang")
baselineFile.set(languageFolder.resolve(baselineFileName))
files.from(languageFolder.listFiles().filter { it.extension.equals("json", ignoreCase = true) })
files.from(
languageFolder.listFiles()?.filter {
it.extension.equals("json", ignoreCase = true)
} ?: emptyList<File>()
)
consoleOutputCount.set(5)
}

Expand All @@ -371,6 +387,13 @@ java {
}

kotlin {
sourceSets {
test {
// task kspKotlin
kotlin.srcDir("build/generated/ksp/main/kotlin")
}
}

compilerOptions {
suppressWarnings = true
jvmToolchain(21)
Expand Down
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ kotlin.code.style=official
kotlin.incremental=true
kotlin.caching.enabled=true
kotlin.parallel.tasks.in.project=true
# Skip kspTestKotlin task because we will use the result of kspKotlin (main)
ksp.allow.all.target.configuration=false

# Gradle settings
org.gradle.daemon=true
Expand Down Expand Up @@ -47,6 +49,9 @@ archives_base_name=liquidbounce
# Kotlin
# https://kotlinlang.org/releases.html
kotlin_version=2.1.10
# KSP
# https://github.com/google/ksp/releases
ksp_version=2.1.10-1.0.31
# https://maven.fabricmc.net/net/fabricmc/fabric-language-kotlin/
fabric_kotlin_version=1.13.1+kotlin.2.1.10
# mcef
Expand Down
1 change: 1 addition & 0 deletions liquid-inbuilt-annotations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.utils.client

annotation class Nameable(val name: String)
plugins {
kotlin("jvm")
}

version = "0.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/

package net.ccbluex.liquidbounce.annotations

/**
* Marks a CommandFactory `object` which should be included in CommandManager.
*
* Visibility should be `public`.
*
* It should be like:
* ```kotlin
* @InbuiltCommandFactory
* object CommandExample : CommandFactory { ... }
* ```
*
* Run Gradle task `kspKotlin` to generate.
* It will be auto-executed when you run `compileKotlin` task.
* Generated files could be found at `<rootProject>/build/generated/ksp/main/kotlin/`.
*
* All `CommandFactory` objects will be collected as an array.
* You can get the array by `CommandManager.allCommandFactories`. Don't modify it.
* This extension will be defined in the same package of `CommandManager`.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class InbuiltCommandFactory
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/

package net.ccbluex.liquidbounce.annotations

/**
* Marks a class of Event implementation which should be included in EventManager.
*
* Visibility should be `public`.
*
* It should be like:
* ```kotlin
* @InbuiltEvent("example")
* class/object ExampleEvent : Event/CancellableEvent
* ```
* An Event can be singleton, which means it is stateless and immutable.
*
* Run Gradle task `kspKotlin` to generate.
* It will be auto-executed when you run `compileKotlin` task.
* Generated files could be found at `<rootProject>/build/generated/ksp/main/kotlin/`.
*
* All `Event` objects will be collected as an array.
* You can get the array by `EventManager.allEventClasses`. Don't modify it.
* This extension will be defined in the same package of `EventManager`.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class InbuiltEvent(
/**
* In lower camel case. Used for:
* - Script
* - Web-based event flow
*
* This property should be unique in project-wide.
* Generally it can be represented by the class name (Upper-Camel) as:
* ```kotlin
* className.removeSuffix("Event").replaceFirstChar { it.lowercaseChar() }
* ```
*
* Example:
* ```kotlin
* @InbuiltEvent("myNew")
* class MyNewEvent
* ```
*/
val name: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/

package net.ccbluex.liquidbounce.annotations

/**
* Marks a ClientModule `object` which should be included in `ModuleManager`.
*
* Visibility should be `public`.
*
* It should be like:
* ```kotlin
* @InbuiltModule
* object ModuleExample : ClientModule("Example", ...) { ... }
* ```
* All modules should have unique name.
*
* Run Gradle task `kspKotlin` to generate.
* It will be auto-executed when you run `compileKotlin` task.
* Generated files could be found at `<rootProject>/build/generated/ksp/main/kotlin/`.
*
* All `ClientModule` objects will be collected as an array.
* You can get the array by `ModuleManager.allClientModules`. Don't modify it.
* This extension will be defined in the same package of `ModuleManager`.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class InbuiltModule
1 change: 1 addition & 0 deletions liquid-ksp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
29 changes: 29 additions & 0 deletions liquid-ksp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/

plugins {
kotlin("jvm")
}

version = "0.0.0"

dependencies {
implementation("com.google.devtools.ksp:symbol-processing-api:${rootProject.property("ksp_version")}")
implementation(project(":liquid-inbuilt-annotations"))
}
Loading
Loading