-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
261 additions
and
152 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
plugins { | ||
id("catalog.plugin") | ||
kotlin("jvm") version "1.9.10" | ||
`java-gradle-plugin` | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
implementation(gradleTestKit()) | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
group=com.triumphcraft | ||
group=dev.triumphteam | ||
version=1.0-SNAPSHOT |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1 @@ | ||
dependencyResolutionManagement { | ||
includeBuild("build-logic") | ||
repositories.gradlePluginPortal() | ||
} | ||
|
||
val projectName = "catalog" | ||
rootProject.name = "catalog-common" | ||
|
||
listOf( | ||
"root", | ||
"lily", | ||
"service", | ||
"application" | ||
).forEach(::includeProject) | ||
|
||
fun includeProject(name: String) { | ||
include(name) { | ||
this.name = "$projectName-$name" | ||
} | ||
} | ||
|
||
fun include(name: String, block: ProjectDescriptor.() -> Unit) { | ||
include(name) | ||
project(":$name").apply(block) | ||
} | ||
rootProject.name = "cataloger" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package dev.triumphteam.cataloguer | ||
|
||
import dev.triumphteam.cataloguer.task.ValidateCatalogTask | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.internal.catalog.parser.TomlCatalogFileParser | ||
import org.gradle.api.plugins.catalog.CatalogPluginExtension | ||
import org.gradle.api.plugins.catalog.internal.DefaultVersionCatalogPluginExtension | ||
import org.gradle.kotlin.dsl.register | ||
import java.nio.file.Path | ||
|
||
public abstract class CatalogerPlugin : Plugin<Project> { | ||
|
||
private companion object { | ||
private const val GRADLE_CATALOG_PLUGIN = "org.gradle.version-catalog" | ||
private const val VALIDATE_CATALOG_TASK = "validateCatalog" | ||
private const val CATALOG_PATH = "libs.versions.toml" | ||
} | ||
|
||
override fun apply(project: Project): Unit = with(project) { | ||
// Apply the catalog plugin | ||
plugins.apply(GRADLE_CATALOG_PLUGIN) | ||
|
||
val catalogExtension = extensions.getByType(CatalogPluginExtension::class.java) | ||
|
||
afterEvaluate { | ||
catalogExtension.versionCatalog { | ||
// Importing root toml first | ||
TomlCatalogFileParser.parse(rootProject.tomlCatalog, this) | ||
// We don't want to import root twice | ||
if (project == rootProject) return@versionCatalog | ||
// Then combining it with the actual project's toml | ||
TomlCatalogFileParser.parse(project.tomlCatalog, this) | ||
} | ||
} | ||
|
||
if (catalogExtension is DefaultVersionCatalogPluginExtension) { | ||
// Register validator | ||
tasks.register<ValidateCatalogTask>(VALIDATE_CATALOG_TASK) { | ||
this.catalogExtension.set(catalogExtension) | ||
} | ||
} | ||
} | ||
|
||
/** Quick util for getting the catalog file. */ | ||
private val Project.tomlCatalog: Path | ||
get() = file(CATALOG_PATH).toPath() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
package dev.triumphteam.cataloguer |
Oops, something went wrong.