Skip to content

Commit

Permalink
2.0.14 测试版本
Browse files Browse the repository at this point in the history
  • Loading branch information
Bkm016 committed Sep 8, 2024
1 parent 880293a commit 9237bab
Show file tree
Hide file tree
Showing 5 changed files with 406 additions and 94 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "io.izzel.taboolib"
version = "2.0.13"
version = "2.0.14"

configurations {
create("embed") {
Expand Down
41 changes: 26 additions & 15 deletions src/main/groovy/io/izzel/taboolib/gradle/TabooLibPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ class TabooLibPlugin implements Plugin<Project> {
project.repositories.maven {
url project.uri("https://repo.spongepowered.org/maven")
}

// 注册扩展
def tabooExt = project.extensions.create('taboolib', TabooLibExtension)
// 注册配置
def taboo = project.configurations.maybeCreate('taboo')
// 注册任务
def tabooTask = project.tasks.maybeCreate('taboolibMainTask', TabooLibMainTask)
tabooTask.group = "taboolib"
Expand All @@ -43,6 +42,11 @@ class TabooLibPlugin implements Plugin<Project> {
project.tasks.maybeCreate('taboolibBuildApi')
project.tasks.taboolibBuildApi.group = "taboolib"

// 注册配置
def taboo = project.configurations.maybeCreate('taboo') // 这个名字起的着实二逼
def include = project.configurations.maybeCreate('include') // 这个代替 "taboo"
def dynamic = project.configurations.maybeCreate('dynamic') // 这个还没做完

// 添加依赖以及重定向配置
project.afterEvaluate {
def api = false
Expand All @@ -52,23 +56,28 @@ class TabooLibPlugin implements Plugin<Project> {
} catch (Throwable ignored) {
}

// 继承 "taboo" 配置
// 继承 "taboo", "include" 配置
project.configurations.implementation.extendsFrom(taboo)
project.configurations.implementation.extendsFrom(include)
// 继承 "dynamic" 配置
project.configurations.compileOnly.extendsFrom(dynamic)
project.configurations.testImplementation.extendsFrom(dynamic)

// com.mojang:datafixerupper:4.0.26
project.dependencies.add('implementation', 'com.mojang:datafixerupper:4.0.26')
// org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3
// 自动引入 com.mojang:datafixerupper:4.0.26
project.dependencies.add('compileOnly', 'com.mojang:datafixerupper:4.0.26')
// 自动引入 org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3
if (tabooExt.version.coroutines != null) {
project.dependencies.add('implementation', 'org.jetbrains.kotlinx:kotlinx-coroutines-core:' + tabooExt.version.coroutines)
project.dependencies.add('compileOnly', 'org.jetbrains.kotlinx:kotlinx-coroutines-core:' + tabooExt.version.coroutines)
project.dependencies.add('testImplementation', 'org.jetbrains.kotlinx:kotlinx-coroutines-core:' + tabooExt.version.coroutines)
}

// subprojects
// 自动引入 TabooLib 模块
tabooExt.env.modules.each {
def dep = project.dependencies.create("io.izzel.taboolib:${it}:${tabooExt.version.taboolib}")
if (api || isIncludeModule(it) && !tabooExt.subproject) {
project.configurations.taboo.dependencies.add(dep)
def dependency = project.dependencies.create("io.izzel.taboolib:${it}:${tabooExt.version.taboolib}")
if (api || isCoreModule(it) && !tabooExt.subproject) {
project.configurations.include.dependencies.add(dependency)
} else {
project.configurations.implementation.dependencies.add(dep)
project.configurations.compileOnly.dependencies.add(dependency)
project.configurations.testImplementation.dependencies.add(dependency)
}
}

Expand All @@ -90,7 +99,6 @@ class TabooLibPlugin implements Plugin<Project> {
}

def kotlinVersion = KotlinPluginWrapperKt.getKotlinPluginVersion(project).replaceAll("[._-]", "")

def jarTask = project.tasks.jar as Jar
tabooTask.configure { TabooLibMainTask task ->
task.tabooExt = tabooExt
Expand All @@ -116,7 +124,10 @@ class TabooLibPlugin implements Plugin<Project> {
}
}

static def isIncludeModule(String module) {
/**
* 是否为必要模块
*/
static def isCoreModule(String module) {
return module == "common" || module == "platform-application" || Platforms.values().any { p -> p.module == module }
}
}
270 changes: 270 additions & 0 deletions src/main/kotlin/io/izzel/taboolib/gradle/ModuleName.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
package io.izzel.taboolib.gradle

/**
* 基础模块:配置文件,任务链
*/
val Basic = arrayOf(
"basic-configuration",
"basic-submit-chain",
)

/**
* Bukkit 虚拟 OP 工具
*/
val BukkitFakeOp = arrayOf(
"bukkit-fake-op",
"bukkit-nms"
)

/**
* Bukkit 与 Vault、PlaceholderAPI 等插件交互
*/
val BukkitHook = arrayOf(
"bukkit-hook",
)

/**
* Bukkit 寻路工具
*/
val BukkitNavigation = arrayOf(
"bukkit-navigation",
"bukkit-nms"
)

/**
* Bukkit 箱子菜单
*/
val BukkitUI = arrayOf(
"bukkit-ui",
"bukkit-ui-12100",
"bukkit-ui-legacy",
"bukkit-util",
"bukkit-xseries",
"bukkit-xseries-item",
"bukkit-nms",
"minecraft-chat",
)

/**
* Bukkit 扩展工具
*/
val BukkitUtil = arrayOf(
"bukkit-util",
"bukkit-xseries",
"minecraft-chat",
"minecraft-i18n",
"basic-configuration"
)

/**
* XSeries
*/
val XSeries = arrayOf(
"bukkit-xseries",
)

/**
* XSeries(XSkull 及 ItemBuilder)
*/
val BukkitXSeriesItem = arrayOf(
"bukkit-xseries",
"bukkit-xseries-item",
)

/**
* Bukkit NMS
*/
val BukkitNMS = arrayOf(
"bukkit-nms",
)

/**
* Bukkit NMS 扩展工具
*/
val BukkitNMSUtil = arrayOf(
"bukkit-nms-legacy",
"bukkit-nms-stable",
"bukkit-nms-tag",
"bukkit-nms-tag-12005",
"bukkit-nms-tag-legacy",
"bukkit-nms",
*BukkitUtil,
)

/**
* Bukkit NMS ItemTag 工具
*/
val BukkitNMSItemTag = arrayOf(
"bukkit-nms-tag",
"bukkit-nms-tag-12005",
"bukkit-nms-tag-legacy",
"bukkit-nms",
"minecraft-chat",
)

/**
* Bukkit NMS 数据序列化工具
*/
val BukkitNMSDataSerializer = arrayOf(
"bukkit-nms-data-serializer",
"bukkit-nms"
)

/**
* Bukkit NMS 实体 AI
*/
val BukkitNMSEntityAI = arrayOf(
"bukkit-nms-ai",
"bukkit-nms"
)

/**
* 数据库
*/
val Database = arrayOf(
"database",
"basic-configuration",
)

/**
* Alkaid Redis
*/
val DatabaseAlkaidRedis = arrayOf(
"database-alkaid-redis",
"basic-configuration",
)

/**
* IOC
*/
val DatabaseIoc = arrayOf(
"database-ioc",
"basic-configuration",
)

/**
* Lettuce Redis
*/
val DatabaseLettuceRedis = arrayOf(
"database-lettuce-redis",
"basic-configuration",
)

/**
* 玩家数据库
*/
val DatabasePlayer = arrayOf(
"database-player",
*Database
)

/**
* Persistent Container
*/
val DatabasePtc = arrayOf(
"database-ptc",
*Database
)

/**
* Persistent Container With Object
*/
val DatabasePtcObject = arrayOf(
"database-ptc-object",
*Database
)

/**
* Minecraft 文本工具
*/
val MinecraftChat = arrayOf(
"minecraft-chat",
)

/**
* Minecraft 效果工具
*/
val MinecraftEffect = arrayOf(
"minecraft-effect",
)

/**
* 指令帮助
*/
val CommandHelper = arrayOf(
"minecraft-command-helper",
"minecraft-chat",
"minecraft-i18n",
)

/**
* 国际化接口
*/
val I18n = arrayOf(
"minecraft-i18n",
"minecraft-chat",
"basic-configuration",
)

/**
* Kether 脚本引擎
*/
val Kether = arrayOf(
"minecraft-kether",
"minecraft-chat",
"minecraft-i18n",
"bukkit-nms",
"bukkit-nms-stable",
"basic-configuration",
)

/**
* BStats 数据统计
*/
val Metrics = arrayOf(
"minecraft-metrics",
"basic-configuration",
)

/**
* BungeeCord 通讯
*/
val Porticus = arrayOf(
"minecraft-porticus",
"basic-configuration",
)

/**
* Javascript 脚本环境
*/
val Javascript = arrayOf("script-javascript")

/**
* Jexl 脚本环境
*/
val Jexl = arrayOf("script-jexl")

/**
* Afybroker 平台
*/
val AfyBroker = arrayOf("platform-afybroker")

/**
* 独立程序
*/
val App = arrayOf("platform-application")

/**
* Bukkit 平台
*/
val Bukkit = arrayOf("platform-bukkit")

/**
* BungeeCord 平台
*/
val BungeeCord = arrayOf("platform-bungee")

/**
* Velocity 平台
*/
val Velocity = arrayOf("platform-velocity")
Loading

0 comments on commit 9237bab

Please sign in to comment.