diff --git a/build-logic/core/library/build.gradle.kts b/build-logic/core/library/build.gradle.kts index 39875fcc18..702e1a64ed 100644 --- a/build-logic/core/library/build.gradle.kts +++ b/build-logic/core/library/build.gradle.kts @@ -40,6 +40,11 @@ gradlePlugin { id = "lib" } + create("lib.single") { + implementationClass = "LibSinglePlugin" + id = "lib.single" + } + create("lib.utils") { implementationClass = "LibUtilsPlugin" id = "lib.utils" diff --git a/build-logic/core/library/src/main/kotlin/LibSinglePlugin.kt b/build-logic/core/library/src/main/kotlin/LibSinglePlugin.kt new file mode 100644 index 0000000000..1286f7c867 --- /dev/null +++ b/build-logic/core/library/src/main/kotlin/LibSinglePlugin.kt @@ -0,0 +1,24 @@ +import org.gradle.kotlin.dsl.apply + +/** + * . + * + * @author 985892345 + * @date 2024/2/15 16:37 + */ +class LibSinglePlugin : BasePlugin() { + override fun PluginScope.configure() { + apply(plugin = "base.library") + if (project.gradle.startParameter.taskNames.any { it.contains(":lib_single:assembleDebug") }) { + // 在 AS 使用锤子对 lib_single 模块单独进行构建时, + // 会因为 AndroidManifest 文件没有设置 single_module_app_name 会构建失败, + // 所以这里就设置一个默认的名字 + // 单模块的名字在另一个地方设置的 + androidLib { + defaultConfig { + manifestPlaceholders["single_module_app_name"] = project.name + } + } + } + } +} \ No newline at end of file diff --git a/build-logic/core/manager/src/main/kotlin/ModuleManagerPlugin.kt b/build-logic/core/manager/src/main/kotlin/ModuleManagerPlugin.kt index 5989d469b5..133756317c 100644 --- a/build-logic/core/manager/src/main/kotlin/ModuleManagerPlugin.kt +++ b/build-logic/core/manager/src/main/kotlin/ModuleManagerPlugin.kt @@ -19,6 +19,7 @@ class ModuleManagerPlugin : BasePlugin() { projectName == "lib_utils" -> "lib.utils" projectName == "lib_config" -> "lib.config" projectName == "lib_debug" -> "lib.debug" + projectName == "lib_single" -> "lib.single" projectName.startsWith("module_") -> "module" projectName.startsWith("lib_") -> "lib" projectName.startsWith("api_") -> "api"