Skip to content

Gradle dependencies with IDE integration and lookup for available updates

License

Notifications You must be signed in to change notification settings

pvinis/buildSrcVersions

 
 

Repository files navigation

de.fayard.refreshVersions

Maven Central Kotlinlang Slack Code Triage Travis (.org) GitHub GitHub issues GitHub pull requests

The Gradle plugin de.fayard.refreshVersions goal is to make it as painless as possible to upgrade your project to the latest and greatest version of everything.

It does that by extracting all your dependencies, searching for available dependencies updates and generating Kotlin code, Groovy code or Gradle properties.

The plugin was called before de.fayard.buildSrcVersions, which still exists and is currently identical.

[The goal in the future is to focus on :refreshVersions](Splitties#104)

Installation

Edit your root build.gradle(.kts) file

We recommend to use the plugins block:

buildscript {
    //...
}
plugins {
  id("de.fayard.refreshVersions") version "0.7.0"
}
// Don't put any code before the buildscripts {} and plugins {} block

Updating Gradle is usually a good idea. You get less bugs, more features and more build speed, and it’s as simple as this:

$ ./gradlew wrapper --gradle-version 5.6.2

If you have to, use instead the legacy buildscript { …​ } syntax

Legacy buildscript syntax - click to expand
buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "de.fayard.refrshVersions:de.fayard.refrshVersions.gradle.plugin:0.7.0"
  }
}

apply plugin: "de.fayard.refrshVersions"

The plugin provides two tasks: :refreshVersions and :buildSrcVersions

The task :refreshVersions

The task :refreshVersions was introduced in the version 0.6.0 of the plugin.

It provides just the versions and their available updates and is a good solution for simple, single-module Gradle projects.

versions gradle properties

The task :buildSrcVersions

The task :buildSrcVersions is well suited for complex multi-module Gradle projects: Android, Kotlin multi-platform, …​

It generates this kind of code inside the Gradle buildSrc module.

carbon Libs Versions

Configuration

No configuration is required, but some things are configurable.

The default configuration is:

// See Plugin configuration at https://github.com/jmfayard/buildSrcVersions/issues/53
buildSrcVersions {
    rejectVersionIf {
        isNonStable(candidate.version)
    }
    orderBy = OrderBy.GROUP_AND_LENGTH
    indent = "from-editorconfig-file"
    renameLibs = "Libs"
    renameVersions = "Versions"
    useFdqnFor() // nothing
}

Requirements

  • Kotlin, JVM and Android projects.

  • Gradle 4.3+ and Gradle 5.0+

  • The IDE integration works

Design goals

  • First, to do no harm. The plugin should never update itself or otherwise break an existing build. The plugin should do nothing unless it’s explicitely called.

  • Be Lazy. Use code generation to avoid writing tedious code manually. Find available updates automatically instead of googling them. The plugin should do the right thing by default, no configuration should be mandatory. Leverage IDE tooling support (auto-completion, …​).

  • Be Humble. Render to the programmer the things that are the programmer’s. This include using the generated code and updating the dependencies.

FAQ

Questions? Look at the existing issues, then ask your own.

IDE Integration
Figure 1. FAQ

Changelog

If you migrate from an older version, two configuration options have been removed: rejectedVersionKeywords and useFdqnFor.

Contributing

  • This project is licensed under the MIT License. See LICENSE.txt

  • Explain your use case and start the discussion before your submit a pull-request

  • Your feature request or bug report may be better adressed by the parent plugin. Check out ben-manes/gradle-versions-plugin.

  • CONTRIBUTING.md describes the process for submitting pull requests.

Acknowledgments

Gradle and JetBrains have made this plugin possible by working on improving the IDE support for Kotlin code from the buildSrc module.

This plugin embraces and extends Ben Manes’s wonderful "Versions" plugin.

The Kotlin code generation is powered by Square’s Kotlinpoet

About

Gradle dependencies with IDE integration and lookup for available updates

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Kotlin 100.0%