You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case of projects using precompiled buildSrc, the platform plugin is not working, as it will try to find gradle.properties or libs.versions.toml from it directory (/buildSrc/gradle.properties or /buildSrc/.gradle/libs/versions.toml) instead of the files from root directory (/gradle.properties and /.gradle/libs/versions.toml)
That would be nice to be able to apply it at the root settings as well as in the buildSrc to fully use this feature
I don't know what will be the best solution, have 1 plugin for root settings and an other for the buildSrc, or be able to manage it directly in the plugin when retrieving from the properties or the toml file
Here is my current workaround to have it:
in /buildSrc/settings.gradle.kts
importio.micronaut.gradle.catalog.LenientVersionCatalogParserimportio.micronaut.gradle.catalog.MicronautCatalogSettingsPlugin.MN_OVERRIDE_VERSIONS_TOML_FILEimportio.micronaut.gradle.catalog.VersionCatalogTomlModelimportorg.gradle.internal.management.VersionCatalogBuilderInternalimportjava.util.Propertiesimportjava.util.function.Consumerval properties =Properties()
file("../gradle.properties").inputStream().use { fis -> properties.load(fis) }
val micronautVersion = properties["micronautVersion"] asString
dependencyResolutionManagement {
repositories {
mavenCentral()
}
versionCatalogs {
create("mn") {
description ="Micronaut Catalog"
from("io.micronaut.platform:micronaut-platform:$micronautVersion")
val catalogOverrideFile = file("../gradle/$MN_OVERRIDE_VERSIONS_TOML_FILE")
if (catalogOverrideFile.exists()) {
val parser =LenientVersionCatalogParser()
catalogOverrideFile.inputStream().use { fis ->
parser.parse(fis)
val model = parser.model
fixupMicronautCatalogWith(this, model)
}
}
}
}
}
funfixupMicronautCatalogWith(catalog:VersionCatalogBuilder, model:VersionCatalogTomlModel) {
model.versionsTable.forEach { versionModel ->val version = versionModel.version
val reference = versionModel.reference
if (reference !=null) {
catalog.version(reference) {
val strictly = version!!.strictly
if (strictly !=null) {
strictly(strictly)
} else {
val require = version.require
if (require !=null) {
require(require)
}
}
val prefer = version.prefer
if (prefer !=null) {
prefer(prefer)
}
if (version.isRejectAll) {
rejectAll()
} else {
val rejectedVersions = version.rejectedVersions
rejectedVersions?.forEach(Consumer { versions:String?->
reject(
versions
)
})
}
}
}
}
}
rootProject.name ="buildSrc"
Feature description
In case of projects using precompiled buildSrc, the platform plugin is not working, as it will try to find
gradle.properties
orlibs.versions.toml
from it directory (/buildSrc/gradle.properties or /buildSrc/.gradle/libs/versions.toml) instead of the files from root directory (/gradle.properties and /.gradle/libs/versions.toml)That would be nice to be able to apply it at the root settings as well as in the buildSrc to fully use this feature
I don't know what will be the best solution, have 1 plugin for root settings and an other for the buildSrc, or be able to manage it directly in the plugin when retrieving from the properties or the toml file
Here is my current workaround to have it:
in /buildSrc/settings.gradle.kts
Of course, there is this issue about using the type-safe version available in the precompiled script plugin, but the work-around work pretty well
ProjectExt.kt
fileThen, the
mn
catalog will be available in the precompiled script pluginsThe text was updated successfully, but these errors were encountered: