Skip to content

Commit

Permalink
chore: some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
utybo committed Nov 1, 2024
1 parent 1d5116b commit 264c6ea
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 56 deletions.
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ dependencies {
for (pluginDef in pluginsDef) {
val actualLib = pluginDef.get()
implementation(
group = actualLib.getPluginId(),
name = actualLib.getPluginId() + ".gradle.plugin",
version = actualLib.getVersion().toString()
group = actualLib.pluginId,
name = actualLib.pluginId + ".gradle.plugin",
version = actualLib.version.toString()
)
}

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/tegral.base-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ group = rootProject.group

fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = Regex("/^[0-9,.v-]+(-r)?$/")
val regex = Regex("^[0-9,.v-]+(-r)?$")
return !stableKeyword && !(version.matches(regex)) || version.contains("-M")
}


tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
// Reject all non stable versions
// Reject all non-stable versions
rejectVersionIf {
isNonStable(candidate.version)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ val aggregatedProjects: Configuration by configurations.creating {
isCanBeConsumed = false
}

@Suppress("UnstableApiUsage") // VerificationType is incubating
val aggregatedProjectsExecData: Configuration by configurations.creating {
isCanBeResolved = true
isCanBeConsumed = false
Expand All @@ -27,6 +28,7 @@ val aggregatedProjectsExecData: Configuration by configurations.creating {
}
}

@Suppress("UnstableApiUsage") // VerificationType is incubating
val aggregatedProjectsSources: Configuration by configurations.creating {
isCanBeResolved = true
isCanBeConsumed = false
Expand All @@ -52,10 +54,14 @@ val aggregatedProjectsClasses: Configuration by configurations.creating {
extendsFrom(aggregatedProjects)

attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements::class.java, LibraryElements.CLASSES))
attribute(
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
objects.named(LibraryElements::class.java, LibraryElements.CLASSES)
)
}
}

@Suppress("UnstableApiUsage") // VerificationType is incubating
val compositeReportExecData: Configuration by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies {
testing {
suites {
// Configure the built-in test suite
@Suppress("UnstableApiUsage")
val test by getting(JvmTestSuite::class) {
// Use JUnit Jupiter test framework
useJUnitJupiter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id("signing")
}

project.extra["includeInCatalog"] = true
extra["includeInCatalog"] = true

detekt {
config.from(rootProject.layout.projectDirectory.file("detekt-config.published.yaml"))
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/tegral.pktg-e2e-test.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ val generatorCodeCoverage = tasks.register<JacocoReport>("generatorCodeCoverage"
dependsOn(prismaGenerate)
}

@Suppress("UnstableApiUsage")
val generatorCodeCoverageOutput by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
Expand Down
1 change: 0 additions & 1 deletion dokka/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import dev.adamko.dokkatoo.tasks.DokkatooGenerateModuleTask
import dev.adamko.dokkatoo.tasks.DokkatooGeneratePublicationTask

plugins {
Expand Down
59 changes: 27 additions & 32 deletions tegral-catalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,49 @@ plugins {
id("tegral.publish-conventions")
}

// FIXME better typing
fun computeLibrariesToInclude(): Pair<List<Pair<String, String>>, Map<String, List<String>>> {
val result = mutableListOf<Pair<String, String>>()
val bundles = mutableMapOf<String, MutableList<String>>()
data class LibEntry(val name: String, val artifact: String)
data class ComputedEntries(val libs: MutableList<LibEntry>, val bundles: MutableMap<String, MutableList<String>>)

val projects = rootProject.getSubprojects()
for (project in projects) {
val includeInCatalog = project.extensions.extraProperties.properties["includeInCatalog"] as? Boolean ?: false
fun computeLibrariesToInclude(): ComputedEntries {
val computedEntries = ComputedEntries(mutableListOf(), mutableMapOf())

for (project in rootProject.subprojects) {
val includeInCatalog = project.extra.properties["includeInCatalog"] as? Boolean ?: false
if (includeInCatalog) {
val name = project.getName().let { if (it.startsWith("tegral-")) it.substring(7) else it }
val name = project.name.let { if (it.startsWith("tegral-")) it.substring(7) else it }

result.add(name to project.group.toString() + ':' + project.name.toString() + ':' + project.version.toString())
computedEntries.libs.add(
LibEntry(
name,
project.group.toString() + ':' + project.name + ':' + project.version.toString()
)
)

val relevantBundles = project.extensions.extraProperties.properties["includeInBundles"] as? List<*> ?: listOf<Any>()
val relevantBundles =
project.extra.properties["includeInBundles"] as? List<*> ?: listOf<Any>()
for (bundle in relevantBundles) {
if (!bundles.containsKey(bundle)) {
bundles[bundle.toString()] = mutableListOf()
}
bundles.get(bundle)!!.add(name)
computedEntries.bundles.computeIfAbsent(bundle.toString()) { mutableListOf() }.add(name)
}
}
}
return result to bundles
return computedEntries
}

// FIXME: This doesn't look right
val setupVersionCatalog = tasks.register("setupVersionCatalog") {
doLast {
catalog {
versionCatalog {
val (exportedLibraries, exportedBundles) = computeLibrariesToInclude()
for (exportedLibrary in exportedLibraries) {
val (name, dependency) = exportedLibrary
library(name, dependency)
}

print(exportedBundles)
gradle.projectsEvaluated {
catalog {
versionCatalog {
val (exportedLibraries, exportedBundles) = computeLibrariesToInclude()
for ((name, dependency) in exportedLibraries) {
library(name, dependency)
}

for ((bundleName, bundleLibraries) in exportedBundles.entries) {
bundle(bundleName, bundleLibraries)
}
for ((bundleName, bundleLibraries) in exportedBundles.entries) {
bundle(bundleName, bundleLibraries)
}
}
}
}

tasks.named("generateCatalogAsToml") { dependsOn(setupVersionCatalog) }

publishing {
publications {
named<MavenPublication>("maven") {
Expand Down
6 changes: 3 additions & 3 deletions tegral-di/tegral-di-services/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ dependencies {
api(project(":tegral-services:tegral-services-api"))
}

ext["humanName"] = "Tegral DI Services"
ext["description"] = "Extension for Tegral DI that provides necessary tooling and hooks for integrating Tegral Services in a Tegral DI environment."
ext["url"] = "https://tegral.zoroark.guru/docs/modules/core/di/extensions/services"
extra["humanName"] = "Tegral DI Services"
extra["description"] = "Extension for Tegral DI that provides necessary tooling and hooks for integrating Tegral Services in a Tegral DI environment."
extra["url"] = "https://tegral.zoroark.guru/docs/modules/core/di/extensions/services"
8 changes: 4 additions & 4 deletions tegral-di/tegral-di-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("tegral.kotlin-published-library-conventions")
}

ext["includeInBundles"] = listOf("web-test")
extra["includeInBundles"] = listOf("web-test")

dependencies {
api(project(":tegral-di:tegral-di-core"))
Expand All @@ -13,6 +13,6 @@ dependencies {
testImplementation(libs.mockk)
}

ext["humanName"] = "Tegral DI Test"
ext["description"] = "Test utilities for Tegrarl DI-powered applications."
ext["url"] = "https://tegral.zoroark.guru/docs/modules/core/di/testing/"
extra["humanName"] = "Tegral DI Test"
extra["description"] = "Test utilities for Tegrarl DI-powered applications."
extra["url"] = "https://tegral.zoroark.guru/docs/modules/core/di/testing/"
2 changes: 1 addition & 1 deletion tegral-openapi/tegral-openapi-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ extra["url"] = "https://tegral.zoroark.guru/docs/modules/core/openapi/cli"

tasks.named<Jar>("jar") {
manifest {
attributes.put("Main-Class", "guru.zoroark.tegral.openapi.cli.MainKt")
attributes["Main-Class"] = "guru.zoroark.tegral.openapi.cli.MainKt"
}
}
2 changes: 1 addition & 1 deletion tegral-prismakt/tegral-prismakt-generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ extra["url"] = "https://tegral.zoroark.guru/docs/modules/core/prismakt"

tasks.named<Jar>("jar") {
manifest {
attributes.put("Main-Class", "guru.zoroark.tegral.prismakt.generator.MainKt")
attributes["Main-Class"] = "guru.zoroark.tegral.prismakt.generator.MainKt"
}
}
1 change: 0 additions & 1 deletion tegral-web/tegral-web-appdsl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id("tegral.kotlin-published-library-conventions")
}

extra["includeInCatalog"] = true
extra["includeInBundles"] = listOf("web")

dependencies {
Expand Down
6 changes: 3 additions & 3 deletions tegral-web/tegral-web-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ dependencies {
api(project(":tegral-config:tegral-config-core"))
}

ext["humanName"] = "Tegral Web Config"
ext["description"] = "Provides the necessary configuration sections for Tegral Web apps."
ext["url"] = "https://tegral.zoroark.guru/docs/modules/web/config"
extra["humanName"] = "Tegral Web Config"
extra["description"] = "Provides the necessary configuration sections for Tegral Web apps."
extra["url"] = "https://tegral.zoroark.guru/docs/modules/web/config"
3 changes: 0 additions & 3 deletions website/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
plugins {

}

repositories {
mavenCentral()
maven { url = uri("https://gitlab.com/api/v4/projects/29365238/packages/maven") }
}

// FIXME Those configurations should have something

val servine by configurations.creating {
isCanBeResolved = true
isCanBeConsumed = false
Expand Down

0 comments on commit 264c6ea

Please sign in to comment.