mirror of
https://github.com/HighCapable/SweetDependency.git
synced 2025-09-07 19:14:30 +08:00
feat: add enable / disable auto generate dependencies namespace function
This commit is contained in:
@@ -76,9 +76,9 @@ internal object DependencyDeployHelper {
|
||||
* @param settings 当前设置
|
||||
*/
|
||||
internal fun generateVersionCatalogs(settings: Settings) {
|
||||
val pluginsNamespace = SweetDependencyConfigs.document.preferences().dependenciesNamespace.plugins()
|
||||
runCatching {
|
||||
settings.dependencyResolutionManagement.versionCatalogs.create(pluginsNamespace) {
|
||||
val pluginsOption = SweetDependencyConfigs.document.preferences().dependenciesNamespace.plugins
|
||||
if (pluginsOption.isEnable) runCatching {
|
||||
settings.dependencyResolutionManagement.versionCatalogs.create(pluginsOption.name()) {
|
||||
Dependencies.plugins().forEach { (dependencyName, artifact) ->
|
||||
if (GradleTaskManager.isInternalRunningTask && artifact.version().isAutowire) SError.make(
|
||||
"""
|
||||
@@ -140,8 +140,14 @@ internal object DependencyDeployHelper {
|
||||
* @param rootProject 当前根项目
|
||||
*/
|
||||
internal fun resolveAccessors(rootProject: Project) {
|
||||
val librariesOption = SweetDependencyConfigs.document.preferences().dependenciesNamespace.libraries
|
||||
if (librariesOption.isEnable.not()) {
|
||||
accessorsPomData.relativePomPath.toFile().takeIf { it.exists() }?.deleteRecursively()
|
||||
accessorsGenerator.clearGeneratedData()
|
||||
return
|
||||
}
|
||||
if (Dependencies.isOutdate || accessorsDir.resolve(accessorsPomData.relativePomPath).isEmpty())
|
||||
accessorsGenerator.build().compile(accessorsPomData, accessorsDir.absolutePath, accessorsGenerator.compileStubFiles)
|
||||
accessorsGenerator.build(librariesOption.name()).compile(accessorsPomData, accessorsDir.absolutePath, accessorsGenerator.compileStubFiles)
|
||||
rootProject.addDependencyToBuildScript(accessorsDir.absolutePath, accessorsPomData)
|
||||
}
|
||||
|
||||
|
@@ -88,8 +88,14 @@ internal object RuntimeDebugTransaction {
|
||||
"autowire-on-sync-mode" value preferences.autowireOnSyncMode,
|
||||
"repositories-mode" value preferences.repositoriesMode,
|
||||
"dependencies-namespace" to mapOf(
|
||||
"plugins" value preferences.dependenciesNamespace.plugins().ifBlank { NONE },
|
||||
"libraries" value preferences.dependenciesNamespace.libraries().ifBlank { NONE }
|
||||
"plugins" to mapOf(
|
||||
"enable" value preferences.dependenciesNamespace.plugins.isEnable,
|
||||
"name" value preferences.dependenciesNamespace.plugins.name().ifBlank { NONE }
|
||||
),
|
||||
"libraries" to mapOf(
|
||||
"enable" value preferences.dependenciesNamespace.libraries.isEnable,
|
||||
"name" value preferences.dependenciesNamespace.libraries.name().ifBlank { NONE }
|
||||
)
|
||||
),
|
||||
"version-filter" with (if (vfExclusionList.isEmpty()) "(disabled)" else "") to versionFilterMap
|
||||
),
|
||||
|
Reference in New Issue
Block a user