Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rickbusarow/gradle-dependency-sync
https://github.com/rickbusarow/gradle-dependency-sync
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rickbusarow/gradle-dependency-sync
- Owner: rickbusarow
- License: apache-2.0
- Created: 2021-06-19T21:03:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-02T13:15:50.000Z (10 months ago)
- Last Synced: 2024-03-02T14:30:50.697Z (10 months ago)
- Language: Kotlin
- Size: 349 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.rickbusarow.gradle-dependency-sync?style=flat-square)](https://plugins.gradle.org/plugin/com.rickbusarow.gradle-dependency-sync)
[![License](https://img.shields.io/badge/license-apache2.0-blue?style=flat-square.svg)](https://opensource.org/licenses/Apache-2.0)## What does it do?
This Gradle plugin will sync dependency declarations between
a `build.gradle` or `build.gradle.kts` file and
[Gradle's new .toml file.](https://docs.gradle.org/nightly/userguide/platforms.html#sub:central-declaration-of-dependencies)This is useful if you'd like to utilize IntelliJ/Android Studio's built in dependency update warnings,
or if you're using [Dependabot](https://github.com/dependabot/dependabot-core). Both of these tools only support
dependencies which are defined as string literals in a Gradle build file.If a dependency is declared in the build file but not in .toml,
DependencySync will automatically create a new declaration in the toml file.If the dependency is declared in both files, but with different versions,
DependencySync will replace the older version with the newer one.If a toml dependency is declared using a version from the `[versions]` section via `version.ref = "my-dependency-version"`,
then DependencySync will update the declaration for `my-dependency-version` instead.
It will then look for any dependencies in the build file which may need to be updated in order to keep both files in sync.## Config
First, create an empty module in your project, such as `:dependency-sync`. Add this to your root project's `settings.gradle[.kts]`
Do not add this module as a dependency to any other module.```kotlin
// settings.gradle.ktspluginManagement {
repositories {
gradlePluginPortal()
}
}...
include(":dependency-sync")
```
Now add a `build.gradle[.kts]` file. Declare every single external dependency for the entire project here,
using the `dependencySync` configuration. This configuration doesn't do anything,
but it's necessary for the IDE and Dependabot to do their parsing.```kotlin
// ./dependency-sync/build.gradle.ktsplugins {
id("com.rickbusarow.gradle-dependency-sync") version "0.11.4"
}dependencySync {
gradleBuildFile.set(buildFile.path) // optional -- default is just the build file of the applied module
typeSafeFile.set("${rootDir}/gradle/libs.versions.toml") // optional -- this path is the default
}dependencies {
dependencySync("com.android.tools.build:gradle:4.2.1")
dependencySync("androidx.activity:activity-ktx:1.2.3")
// ...
}
```## Task
This task is very fast. You can obviously just invoke it manually, but you can also try invoking it as part of your CI on Dependabot pull requests.
``` shell
./gradlew dependencySync
```## License
``` text
Copyright (C) 2021 Rick Busarow
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```