Skip to content

GradleUp/buildSrc-catalog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

eac5dfa · Oct 8, 2024

History

9 Commits
Sep 25, 2024
Sep 25, 2024
Sep 22, 2024
Sep 25, 2024
Sep 22, 2024
Sep 22, 2024
Sep 16, 2024
Oct 8, 2024
Sep 22, 2024
Sep 22, 2024
Sep 22, 2024
Sep 22, 2024

Repository files navigation

buildSrc-catalog

This project aims to alleviate the long standing issue about having version catalogs accessible from precompiled script plugins

It is actually based on two plugins, a setting one and a project one

buildSrc-catalog, the setting plugin

It shall be applied in your buildSrc/settings.gradle.kts

plugins {
    id("elect86.buildSrc-catalog")
}

It automatically includes any libs.versions.toml file found in the root gradle folder and generates, on configuration time, the accessors for all the elements found in the lib catalog: versions, libraries, bundles and plugins under the file buildSrc/src/main/kotlin/libs.kt.

Generation will be skipped if not needed. It can detect and react to any libs.versions.toml modification

It also offers two confortable methods for adding a plugin as a dependency

Let's image you have the following:

kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

in your buildSrc/build.gradle.kts you can simply write

import org.example.gradlePlugin

dependencies {
    implementation(libs.plugins.kotlin.serialization.gradlePlugin)
}

or also:

import org.example.implementation

dependencies {
    implementation(libs.plugins.kotlin.serialization)
}

plugins-catalog, the project plugin

It shall be applied in your buildSrc/build.gradle.kts

plugins {
    id("elect86.plugins-catalog")
}

It allows to use accessors within the plugins block in precompiled plugins

the setting plugin above will generate the following accessor

val PluginDependencySpecScope.`kotlin-serialization`

which can be use in your buildSrc/src/main/kotlin/myPlugin.gradle.kts as

import `kotlin-serialization`

plugins {
    `kotlin-serialization`
}

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages