GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Splitties/gradle-dependencies-dsl: More concise dependencies declaration for Gradle projects. Avoid repeating implementation, api, etc.

BranchesTags
Open more actions menu

Latest commit

 

History

21 Commits
21 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
gradle/wrapper
gradle/wrapper
 
 
src/main/kotlin/org
src/main/kotlin/org
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle.kts
build.gradle.kts
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle.kts
settings.gradle.kts
 
 
version.txt
version.txt
 
 
versions.properties
versions.properties
 
 

Repository files navigation

Dependencies DSL for Gradle projects

Instead of repeating implementation or api countless times in your Gradle build scripts, you can use this DSL to write it just once per set of dependencies.

Before

api, implementation, and testImplementation are repeated, adding unwanted noise.

dependencies {
    api("com.example.whatever:what-you-need:x.x.x")
    api(libs.coolFramework) // From version catalog
    api(KotlinX.coroutines) // From refreshVersions built-in dependency notations
    implementation(libs.something) // From version catalog
    implementation(libs.stuff) // From version catalog
    implementation("com.example.whatever:yet-another-thing:x.x.x")
    implementation("com.example.whatever:your-favorite-library:x.x.x")
    implementation("com.example.whatever:utils-of-course:x.x.x")
    testImplementation(Kotlin.test.junit)
    testImplementation(Testing.kotest.assertions.core)
    testImplementation(KotlinX.coroutines.test)
}

After

Straight to the dependency notations, minimal noise!

dependencies {
    api {
        "com.example.whatever:what-you-need:x.x.x"()
        libs.coolFramework()
        KotlinX.coroutines()
    }
    implementation {
        libs.something()
        libs.stuff()
        "com.example.whatever:yet-another-thing:x.x.x"()
        "com.example.whatever:your-favorite-library:x.x.x"()
        "com.example.whatever:utils-of-course:x.x.x"()
    }
    testImplementation {
        Kotlin.test.junit()
        Testing.kotest.assertions.core()
        KotlinX.coroutines.test()
    }
}

Important

Don't forget to add the parentheses to the dependency notations or it won't work!

Extra features

Arbitrary configurations support

We support custom or less-standard configurations as well:

dependencies {
    this("anotherConfiguration") {
        libs.something()
    }
}

Convenient exclude overload

You can put a plain dependency notation into exclude, which can be especially handy when using refreshVersions:

AndroidX.wear.remoteInteractions {
    //TODO: Remove when https://issuetracker.google.com/issues/275580742 is fixed.
    exclude(KotlinX.coroutines.guava)
}

How to add to your project

Go in the settings.gradle.kts file, located at the root of your Gradle project.

Add the following line into the plugins { … } block (add one at the top of the file it there's none):

id("org.splitties.dependencies-dsl") version "0.2.0"

It can also work if you add it in the build.gradle.kts file of the module you want to try this DSL in.

License

This library is published under Apache License version 2.0 which you can see here.

About

More concise dependencies declaration for Gradle projects. Avoid repeating implementation, api, etc.

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

14 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.