Skip to content

Astra-Interactive/TomlMerger

Repository files navigation

🧩 What It Does

Here’s a hypothetical minimal example to show how it could work in practice.

Suppose you have two libs.versions.toml files:

[versions]
kotlin = "1.8.0"
coroutines = "1.6.4"

[libraries]
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
[versions]
kotlin = "1.8.10"
serialization = "1.5.0"

[libraries]
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }

After you run this project, you'll get this:

[versions]
# See it took max version
# Which is done by VersionSelectorStrategy
kotlin = "1.8.10"
coroutines = "1.6.4"
serialization = "1.5.0"

[libraries]
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }

🛠️ How to Use

From source

./gradlew :application:run --args="/path/to/your/toml/files"

Or from .jar

java -jar TomlMerger-0.0.1.jar "/path/to/your/toml/files"

🧪 Roadmap / To-Do

There's no active roadmap, but you are free to open an issue or PR.

I've created this project to merge my libs.versions.toml and it works for me

📂 Use Case: Centralizing Dependencies

This tool is particularly useful when you are migrating to or managing a large multi-module project where different subprojects might have maintained their own dependency files.

Instead of manually checking and combining them, you can use the merger:

  • Gather all scattered libs.versions.toml files.
  • Run the merger to create a single source of truth for all dependencies.
  • Apply the resulting merged file as your main Gradle Version Catalog.

🚀 Everything has come to one form!

[versions]
dependency-version = "2.2.0"
[libraries]
dependency-library = { module = "com.example.dep:module", version.ref = "dependency-version" }
[plugins]
dependency-plugin = { id = "org.jetbrains.kotlin.jvm", version.ref = "dependency-version" }

About

Merge libs.versions.toml files

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages