Skip to content

Commit

Permalink
Merge branch 'ben-manes:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeppis committed May 26, 2021
2 parents 70a6511 + 9bef5cb commit d54587f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 11 deletions.
73 changes: 64 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@ You may also wish to explore additional functionality provided by,
- [deblibs-gradle-plugin](https://github.com/hellofresh/deblibs-gradle-plugin)
- [refreshVersions](https://github.com/jmfayard/refreshVersions)

**Table of contents**
<!-- TOC -->
- [Usage](#usage)
- [`plugins` block:](#plugins-block)
- [`buildscript` block:](#buildscript-block)
- [using a Gradle init script](#using-a-gradle-init-script)
- [Tasks](#tasks)
- [`dependencyUpdates`](#dependencyupdates)
- [Multi-project build](#multi-project-build)
- [Revisions](#revisions)
- [RejectVersionsIf and componentSelection](#rejectversionsif-and-componentselection)
- [Gradle Release Channel](#gradle-release-channel)
- [Constraints](#constraints)
- [Kotlin DSL](#kotlin-dsl)
- [Try out the samples](#try-out-the-samples)
- [Report format](#report-format)
- [Json report](#json-report)
- [XML report](#xml-report)
- [HTML report](#html-report)
- [<a name="custom_report_format"></a>Custom report format](#a-namecustom_report_formatacustom-report-format)
<!-- /TOC -->

## Usage

[![Build](https://github.com/ben-manes/gradle-versions-plugin/workflows/build/badge.svg)](https://github.com/ben-manes/gradle-versions-plugin/actions)
Expand Down Expand Up @@ -108,6 +130,7 @@ The strategy can be specified either on the task or as a system property for ad
gradle dependencyUpdates -Drevision=release
```

#### RejectVersionsIf and componentSelection

To further define which version to accept, you need to define what means an unstable version. Sadly, there are
no agreed standard on this, but this is a good starting point:
Expand All @@ -124,7 +147,8 @@ def isNonStable = { String version ->
```

</details>
<details>

<details open>
<summary>Kotlin</summary>

```kotlin
Expand All @@ -148,19 +172,33 @@ You can either use the simplified syntax `rejectVersionIf { ... }` or configure

<!-- Always modify first examples/groovy and make sure that it works. THEN modify the README -->

Example 1: reject all non stable versions

```groovy
// https://github.com/ben-manes/gradle-versions-plugin
tasks.named("dependencyUpdates").configure {
// Example 1: reject all non stable versions
rejectVersionIf {
isNonStable(it.candidate.version)
}
}
```

// Example 2: disallow release candidates as upgradable versions from stable versions
Example 2: disallow release candidates as upgradable versions from stable versions

```groovy
// https://github.com/ben-manes/gradle-versions-plugin
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}
```

Example 3: using the full syntax

// Example 3: using the full syntax
```groovy
// https://github.com/ben-manes/gradle-versions-plugin
tasks.named("dependencyUpdates").configure {
resolutionStrategy {
componentSelection {
all {
Expand All @@ -174,26 +212,44 @@ tasks.named("dependencyUpdates").configure {
```

</details>
<details>
<details open>
<summary>Kotlin</summary>

<!-- Always modify first examples/kotlin and make sure that it works. THEN modify the README -->

Example 1: reject all non stable versions

```kotlin
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

// https://github.com/ben-manes/gradle-versions-plugin
tasks.withType<DependencyUpdatesTask> {
// Example 1: reject all non stable versions
rejectVersionIf {
isNonStable(candidate.version)
}
}
```

Example 2: disallow release candidates as upgradable versions from stable versions

```kotlin
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

// Example 2: disallow release candidates as upgradable versions from stable versions
// https://github.com/ben-manes/gradle-versions-plugin
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
```

Example 3: using the full syntax

// Example 3: using the full syntax
```kotlin
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

// https://github.com/ben-manes/gradle-versions-plugin
tasks.withType<DependencyUpdatesTask> {
resolutionStrategy {
componentSelection {
all {
Expand All @@ -205,7 +261,6 @@ tasks.withType<DependencyUpdatesTask> {
}
}
```

</details>

#### Gradle Release Channel
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ task createClasspathManifest {

// Add the classpath file to the test runtime classpath
dependencies {
implementation 'com.thoughtworks.xstream:xstream:1.4.16'
implementation 'com.thoughtworks.xstream:xstream:1.4.17'

testRuntimeOnly files(createClasspathManifest)

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit d54587f

Please # to comment.