Skip to content

Commit 2c53c5c

Browse files
committed
Merge remote-tracking branch 'origin/main' into lint-updater
2 parents c0d4f80 + e35bce8 commit 2c53c5c

File tree

37 files changed

+1038
-290
lines changed

37 files changed

+1038
-290
lines changed

.github/workflows/release-plugins.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,3 @@ jobs:
2020
wrapper-directory: plugins
2121
build-root-directory: plugins
2222
arguments: publishToAppropriateRepo --scan -Pgradle.publish.key=${{ secrets.gradle_publish_key }} -Pgradle.publish.secret=${{ secrets.gradle_publish_secret }}
23-
env:
24-
bintray_user: ${{ secrets.bintray_user }}
25-
bintray_api_key: ${{ secrets.bintray_api_key }}

CHANGELOG.md

Lines changed: 108 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Change log for refreshVersions
22

3-
## Unreleased
3+
## Version 0.10.0 (2021-05-13)
44

55
### New features
66

7+
- There's a new `versionFor` function that takes a dependency notation, or a version key, and returns the corresponding version that is in the `versions.properties` file. For example, if you use Jetpack Compose, you can leverage it to set `kotlinCompilerExtensionVersion` with `versionFor(AndroidX.compose.ui)`. Groovy DSL users can find it in the `Versions` class.
78
- Support updates of settings plugins in `settings.gradle.kts` and `settings.gradle` files (including refreshVersions itself).
8-
- Support getting versions from [Google Cloud Storage](https://cloud.google.com/storage) backed [repositories](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:gcs-repositories). This can be helpful if you need to update private artifacts hosted there. Thanks to [@NikkyAI](https://github.com/NikkyAI) for the contribution!
9+
- Support getting versions from [Google Cloud Storage](https://cloud.google.com/storage) backed [repositories](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:gcs-repositories). This can be helpful if you need to update private artifacts hosted there. Thanks to [NikkyAI](https://github.com/NikkyAI) for the contribution!
910

1011
### Changes
1112

@@ -16,22 +17,120 @@
1617
### Potentially breaking changes
1718

1819
- The fix of the `Square.sqlDelight.coroutinesExtensions` dependency notation can lead to such an error: `Failed to resolve: coroutines-extensions-1.4.4-_`. If you get a similar error on upgrade, it's because you applied a fix like that one: `Square.sqlDelight.coroutinesExtensions + ":_"`. You now can (must) remove it.
20+
- A bunch of new version key rules have been added, which means you might have changes of version keys, and because we currently don't have a migration facility for those, it might cause unwanted upgrades. Consequently, especially for Android projects, we recommend checking/verifying the changes made by refreshVersions after the first Gradle sync/reload/build that follows the upgrade.
1921

2022
### Fixes
2123

22-
- Authentication for maven repositories should now work correctly. Should, because it can only work using internal Gradle APIs for the time being (though there's a safeguard to not crash if the API changes). Thanks to @mayankmkh for the PR!
24+
- Authentication for maven repositories should now work correctly. Should, because it can only work using internal Gradle APIs for the time being (though there's a safeguard to not crash if the API changes). Thanks to [Mayank Kharbanda](https://github.com/mayankmkh) for the PR!
25+
- Custom `extraArtifactVersionKeyRules` could not be taken into account if there was an overlapping rule already present in refreshVersions, even if it was more specific. That ordering issue has now been fixed, the most specific rule will now always be the one applied.
26+
- If you had issues with some recent AndroidX artifacts, and their version key, they should all be fixed now, and there's all the latest dependency notations.
2327

2428
### New dependency notations
2529

30+
- AndroidX:
31+
- activity.ktx
32+
- activity.compose
33+
- appSearch
34+
- appSearch.compiler
35+
- appSearch.localStorage
36+
- biometricKtx
37+
- carApp
38+
- carApp.testing
39+
- compose:
40+
- material.ripple
41+
- runtime.rxJava3
42+
- runtime.saveable
43+
- ui:
44+
- test
45+
- testJunit4
46+
- testManifest
47+
- tooling
48+
- toolingData
49+
- viewBinding
50+
- constraintLayoutCompose
51+
- core.googleShortcuts
52+
- dataStore:
53+
- core
54+
- rxJava2
55+
- rxJava3
56+
- preferences:
57+
- core
58+
- rxJava2
59+
- rxJava3
60+
- hilt.navigationCompose
61+
- hilt.navigationFragment
62+
- leanback.paging
63+
- leanback.preference
64+
- leanback.tab
65+
- lifecycle.viewModelCompose
66+
- navigation.compose
67+
- navigation.dynamicFeaturesFragment
68+
- paging.compose
69+
- paging.rxJava3
70+
- savedStateKtx
71+
- security.appAuthenticator
72+
- transitionKtx
73+
- wear:
74+
- complications.data
75+
- complications.provider
76+
- input
77+
- inputTesting
78+
- ongoing
79+
- phoneInteractions
80+
- remoteInteractions
81+
- watchFace
82+
- watchFace.guava
83+
- watchFace.client
84+
- watchFace.clientGuava
85+
- watchFace.complicationsRendering
86+
- watchFace.data
87+
- watchFace.editor
88+
- watchFace.editorGuava
89+
- watchFace.style
90+
- tiles:
91+
- proto
92+
- renderer
93+
- work.multiprocess
94+
- work.rxJava3
2695
- Firebase:
27-
- analyticsKtx
28-
- authenticationKtx
29-
- cloudMessagingKtx
30-
- crashlyticsKtx
31-
- dynamicLinksKtx
32-
- performanceMonitoringKtx
96+
- analyticsKtx
97+
- authenticationKtx
98+
- cloudMessagingKtx
99+
- crashlyticsKtx
100+
- dynamicLinksKtx
101+
- performanceMonitoringKtx
102+
- Google:
103+
- accompanist:
104+
- appcompatTheme
105+
- coil
106+
- flowlayout
107+
- glide
108+
- imageloadingCore
109+
- insets
110+
- pager.indicators
111+
- pager
112+
- swiperefresh
113+
- systemuicontroller
114+
- android.material.composeThemeAdapter
115+
- dagger.hilt.compiler
33116
- Testing.kotest.assertions.kotlinxDateTime
34117

118+
### Special mentions
119+
120+
Thanks to all the folks that joined [Louis CAD](https://github.com/LouisCAD) in pair-programming sessions:
121+
122+
- [![](https://github.com/waah42.png?size=18) Waqas Ahmed](https://github.com/waah42)
123+
- [![](https://github.com/borsini.png?size=18) Benjamin Orsini](https://github.com/borsini)
124+
- [![](https://github.com/ZahraHeydari.png?size=18) Zahra Heydari](https://github.com/ZahraHeydari)
125+
- [![](https://github.com/ruffCode.png?size=18) Alexi Bre](https://github.com/ruffCode)
126+
- …and of course the original author and maintainer [![](https://github.com/jmfayard.png?size=18) Jean-Michel Fayard](https://github.com/jmfayard)
127+
128+
These were critical to ensure thorough testing, and great quality, all while keeping motivation to keep going.
129+
130+
We're very grateful for your time and help, and we think our users will be as well. 🙏
131+
132+
Also, thanks to all the folks that reported issues. It was very helpful to prioritize on our side.
133+
35134
## Version 0.9.7 (2020-10-16)
36135

37136
### Fixes

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# gradle refreshVersions
22

3-
Life is too short to google for dependencies and versions.
3+
> Life is too short to google for dependencies and versions
44
55
### Documentation is at [jmfayard.github.io/refreshVersions](https://jmfayard.github.io/refreshVersions/)
6+
7+
[![](https://raw.githubusercontent.com/jmfayard/refreshVersions/main/docs/img/screencast.png)](http://www.youtube.com/watch?v=VhYERonB8co "Gradle refreshVersions")

Releasing.main.kts

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,18 @@
44
* Copyright 2019 Louis Cognault Ayeva Derman. Use of this source code is governed by the Apache 2.0 license.
55
*/
66

7-
@file:Repository("https://dl.bintray.com/louiscad/maven")
7+
@file:Repository("https://repo.maven.apache.org/maven2/")
8+
//@file:Repository("https://oss.sonatype.org/content/repositories/snapshots")
89
//@file:Repository("file:///Users/louiscad/.m2/repository")
9-
@file:DependsOn("com.louiscad.incubator:lib-publishing-helpers:0.1.3")
10+
@file:DependsOn("com.louiscad.incubator:lib-publishing-helpers:0.1.4")
1011

1112
import java.io.File
1213
import Releasing_main.ReleaseStep.*
1314

1415
import lib_publisher_tools.cli.CliUi
1516
import lib_publisher_tools.cli.defaultImpl
1617
import lib_publisher_tools.cli.runUntilSuccessWithErrorPrintingOrCancel
17-
import lib_publisher_tools.vcs.Vcs
18-
import lib_publisher_tools.vcs.checkoutDevelop
19-
import lib_publisher_tools.vcs.checkoutMaster
20-
import lib_publisher_tools.vcs.git
21-
import lib_publisher_tools.vcs.isOnDevelopBranch
22-
import lib_publisher_tools.vcs.mergeMasterIntoCurrent
23-
import lib_publisher_tools.vcs.pullFromOrigin
24-
import lib_publisher_tools.vcs.pushToOrigin
18+
import lib_publisher_tools.vcs.*
2519
import lib_publisher_tools.versioning.StabilityLevel
2620
import lib_publisher_tools.versioning.Version
2721
import lib_publisher_tools.versioning.checkIsValidVersionString
@@ -36,8 +30,8 @@ fun File.checkChanged() = check(git.didFileChange(this)) {
3630
"Expected changes in the following file: $this"
3731
}
3832

39-
fun checkOnDevelopBranch() {
40-
check(git.isOnDevelopBranch()) { "Please, checkout the `develop` branch first." }
33+
fun checkOnMainBranch() {
34+
check(git.isOnMainBranch()) { "Please, checkout the `main` branch first." }
4135
}
4236

4337
@Suppress("EnumEntryName")
@@ -52,8 +46,8 @@ enum class ReleaseStep { // Order of the steps, must be kept right.
5246
`Push tags to origin`,
5347
`Request PR merge`,
5448
`Request GitHub release publication`,
55-
`Update master branch`,
56-
`Update develop branch from master`,
49+
`Update release branch`,
50+
`Update main branch from release`,
5751
`Change this library version back to a SNAPSHOT`,
5852
`Commit "prepare next dev version"`,
5953
`Push, at last`;
@@ -87,7 +81,7 @@ if (ongoingReleaseFile.exists()) {
8781
OngoingRelease.load()
8882
startAtStep = ReleaseStep.valueOf(OngoingRelease.currentStepName)
8983
} else {
90-
checkOnDevelopBranch()
84+
checkOnMainBranch()
9185
with(OngoingRelease) {
9286
versionBeforeRelease = versionsFile.bufferedReader().use { it.readLine() }.also {
9387
check(it.contains("-dev-") || it.endsWith("-SNAPSHOT")) {
@@ -124,7 +118,7 @@ fun askNewVersionInput(
124118

125119
fun CliUi.runReleaseStep(step: ReleaseStep): Unit = when (step) {
126120
`Change this library version` -> {
127-
checkOnDevelopBranch()
121+
checkOnMainBranch()
128122
OngoingRelease.newVersion.let { newVersion ->
129123
printInfo("refreshVersions new version: \"$newVersion\"")
130124
requestUserConfirmation("Confirm?")
@@ -176,7 +170,7 @@ fun CliUi.runReleaseStep(step: ReleaseStep): Unit = when (step) {
176170
git.pushToOrigin()
177171
}
178172
`Request PR submission` -> {
179-
requestManualAction("Create a pull request from the `develop` to the `master` branch on GitHub for the new version, if not already done.")
173+
requestManualAction("Create a pull request from the `main` to the `release` branch on GitHub for the new version, if not already done.")
180174
}
181175
`Wait for successful release by CI` -> {
182176
printInfo("To perform this step, we need to wait for the artifacts building and uploading.")
@@ -194,17 +188,17 @@ fun CliUi.runReleaseStep(step: ReleaseStep): Unit = when (step) {
194188
`Request GitHub release publication` -> {
195189
requestManualAction("Publish release on GitHub with the changelog.")
196190
}
197-
`Update master branch` -> {
198-
printInfo("Will now checkout the `master` branch, pull from GitHub (origin) to update the local `master` branch.")
191+
`Update release branch` -> {
192+
printInfo("Will now checkout the `release` branch, pull from GitHub (origin) to update the local `release` branch.")
199193
requestUserConfirmation("Continue?")
200-
git.checkoutMaster()
194+
git.checkoutBranch("release")
201195
git.pullFromOrigin()
202196
}
203-
`Update develop branch from master` -> {
204-
printInfo("About to checkout the develop branch (and update it from master for merge commits).")
197+
`Update main branch from release` -> {
198+
printInfo("About to checkout the main branch (and update it from release for merge commits).")
205199
requestUserConfirmation("Continue?")
206-
git.checkoutDevelop()
207-
git.mergeMasterIntoCurrent()
200+
git.checkoutMain()
201+
git.mergeBranchIntoCurrent("release")
208202
}
209203
`Change this library version back to a SNAPSHOT` -> {
210204
val newVersion = Version(OngoingRelease.newVersion)
@@ -219,18 +213,18 @@ fun CliUi.runReleaseStep(step: ReleaseStep): Unit = when (step) {
219213
printInfo("Congratulations for this new stable release!")
220214
printInfo("Let's update the library for next development version.")
221215
runUntilSuccessWithErrorPrintingOrCancel {
222-
printInfo("Enter the name of the next target version (`-SNAPSHOT` will be added automatically)")
216+
printInfo("Enter the name of the next target version (`-LOCAL-SNAPSHOT` will be added automatically)")
223217
val input = readLine()
224218
input.checkIsValidVersionString()
225219
when (Version(input).stabilityLevel()) {
226220
StabilityLevel.Unknown, StabilityLevel.Stable -> Unit
227221
else -> error("You need to enter a stable target version")
228222
}
229-
"$input-SNAPSHOT"
223+
"$input-LOCAL-SNAPSHOT"
230224
}
231225
} else OngoingRelease.versionBeforeRelease.let {
232-
if (it.endsWith("-SNAPSHOT")) it
233-
else "${it.substringBefore("-dev-")}-SNAPSHOT"
226+
if (it.endsWith("-LOCAL-SNAPSHOT")) it
227+
else "${it.substringBefore("-dev-")}-LOCAL-SNAPSHOT"
234228
}
235229
versionsFile.writeText(nextDevVersion)
236230
printInfo("${versionsFile.path} has been edited with next development version ($nextDevVersion).")

docs/add-dependencies.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ You can see [all the dependency objects in this directory]({{link.master}}/plugi
3434
All these dependency notations specify their version as the version
3535
placeholder (`_`), so refreshVersions can replace them seamlessly with the corresponding
3636
value defined in the `versions.properties` file, via Gradle APIs.
37+
The same will work for your own, non-built-in dependencies if you use that same version placeholder.
3738

3839
After adding a dependency that doesn't have its version specified in the
3940
`versions.properties` file yet, refreshVersions will edit it and put the
@@ -80,16 +81,51 @@ plugins {
8081

8182
As you see, the convention is pretty simple. The key is the id of the plugin, prefixed by `plugin.`: `plugin.some.plugin.id` sets the version of the plugin of id `some.plugin.id`.
8283

84+
## Get the version from anywhere
85+
86+
In some cases, you might need to get the version defined in the `versions.properties` file in a Gradle script.
87+
For these cases, there's the `versionFor` function that takes either a version key, or a full dependency notation.
88+
89+
Here's a usage example with Jetpack Compose in an Android project:
90+
91+
=== "build.gradle.kts"
92+
```kotlin
93+
import de.fayard.refreshVersions.core.versionFor
94+
95+
...
96+
97+
composeOptions {
98+
kotlinCompilerExtensionVersion = versionFor(AndroidX.compose.ui)
99+
}
100+
```
101+
=== "build.gradle"
102+
```groovy
103+
import static de.fayard.refreshVersions.core.Versions.versionFor
104+
105+
...
106+
107+
composeOptions {
108+
kotlinCompilerExtensionVersion = versionFor(AndroidX.compose.ui)
109+
}
110+
```
111+
112+
Using `versionFor("version.androidx.compose.ui")` would also work, so long as `version.androidx.compose.ui` is defined in the `versions.properties` file.
113+
83114
## Non-built-in dependency notations
84115

85-
### Use gradle buildSrcVersions (WIP)
116+
Generally speaking, so long as you have the version placeholder (`_`) in place of the version,
117+
refreshVersions will handle it.
118+
119+
Below are some ways to deal with the dependency notations that are not built-in.
120+
121+
### Using gradle buildSrcLibs (WIP)
86122

87123
Yet another approach to managing dependencies is to use the **Gradle buildSrc** module, and to automatically generate a file `Libs.kt` that contains all the dependencies applied to your build:
88124

89125
=== "buildSrc/src/main/kotlin/Libs.kt"
90126
```kotlin
91127
/**
92-
* Generated by `$ ./gradlew buildSrcVersions`
128+
* Generated by `$ ./gradlew buildSrcLibs`
93129
*/
94130
object Libs {
95131

@@ -102,22 +138,23 @@ object Libs {
102138

103139
Because this file used the placeholder version `_`, it is compatible with gradle refreshVersions!
104140

105-
**This feature is not done yet. If you think we should prioritze it, please vote for [this issue]({{link.issues}}/235) with a 👍 and subscribe to it.**
141+
**This feature is not done yet. If you think we should prioritize it, please vote for [this issue]({{link.issues}}/235) with a 👍 and subscribe to it.**
106142

107143

108-
### Use Package Search from JetBrains
144+
### Using Package Search from JetBrains
109145

110-
JetBrains offers the plugin [**Package Search**](https://plugins.jetbrains.com/plugin/12507-package-search).
146+
JetBrains offers the plugin [**Package Search**](https://plugins.jetbrains.com/plugin/12507-package-search),
147+
it is compatible with both IntelliJ IDEA and Android Studio. It also has a website
111148

112149
Package Search provides a nice UX to add a dependency:
113150

114-
![](https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2019/10/Screenshot-2019-10-21-at-10.28.33-1.png)
151+
![](img/jetbrains_package_search_screenshot.png)
115152

116153
Can you use it with refreshVersions?
117154

118155
Sure, just use the version placeholder (`_`).
119156

120-
### Use the libraries.gradle pattern
157+
### Using the libraries.gradle pattern
121158

122159
An older approach to centralize dependencies is to have a `libraries.gradle` file:
123160

docs/before-publish.sh

100644100755
File mode changed.

docs/contributing/improving-docs.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Docs are powered by MKDocs
44

5-
The documentation of refreshVersions is published on a website accessible via this url: {{link.site}}.
5+
The documentation of refreshVersions is published on a website accessible via this url: [{{link.site}}](../index.md).
6+
67
It is generated with MKDocs from Markdown files.
78
The variant of Markdown used in MKDocs has useful additional features that we use:
89
- "Variables" interpolation, useful for long urls repeated in the doc.
@@ -13,7 +14,7 @@ The variant of Markdown used in MKDocs has useful additional features that we us
1314
A bunch of things are defined in the `mkdocs.yml` file (located at the root of the repo):
1415

1516
- The structure of the documentation website is under the `nav` key.
16-
- Under the `extra` key, we have common text snippets (example usage: `{{ '{{' }}link.site{{ '}}' }}`)
17+
- Under the `extra` key, we have common text snippets (example usage: `{{ '{{' }}link.github{{ '}}' }}`)
1718
- Website metadata is defined at the top of the file (you probably don't need to touch it)
1819
- Theme and MKDocs configuration
1920

docs/faq.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)