Commit ab97904
authored
Make
In this changeset, we allow configuring JxBrowser version with a [lazily
evaluated
value](https://docs.gradle.org/current/userguide/properties_providers.html)
by changing `version` field to be a lazy `Property`.
## Problem
The Gradle [documentation
states](https://docs.gradle.org/current/userguide/properties_providers.html):
> When implementing a custom task or plugin, it’s imperative that you
use these lazy properties.
We use regular `String` properties instead. That is OK when a version is
a string literal in `build.gradle.kts`. But it's not OK, when the value
is taken from elsewhere. For example, from the version catalog:
```
jxbrowser {
// Calling `get()` this way is a bad practice, because the value may not be available yet.
version = libs.versions.jxbrowser.asProvider().get()
}
```
## Solution
We change the `version` field from `String` to `Property<String>`. We
don't change other fields because they're less likely to come from the
lazily evaluated sources. And we want to avoid breaking changes. More on
this in the next section.
## Backward compatibility
The plug-in stays backward compatible for Gradle 8.2 and newer. No
changes are required, because of
[`Property::assign`](https://github.com/gradle/gradle/blob/fcef0ec368956438f2c1272b64bad82c996ab236/platforms/core-configuration/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/PropertyExtensions.kt#L41)
extension method.
Users of older Gradle versions, will need to replace `version = "8.2.2"`
with `version.set("8.2.2")`. Otherwise, the build will fail.
## Version bump
Since this change is breaking for some of the users, we bump the version
to `2.0.0`.version a lazily evaluated property (#71)1 parent 7843dcd commit ab97904
6 files changed
Lines changed: 61 additions & 15 deletions
File tree
- src
- main/kotlin/com/teamdev/jxbrowser/gradle
- test/kotlin/com/teamdev/jxbrowser/gradle
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
Lines changed: 22 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
48 | | - | |
| 58 | + | |
49 | 59 | | |
50 | 60 | | |
51 | 61 | | |
| |||
175 | 185 | | |
176 | 186 | | |
177 | 187 | | |
178 | | - | |
| 188 | + | |
179 | 189 | | |
180 | 190 | | |
181 | 191 | | |
182 | 192 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
187 | 196 | | |
188 | | - | |
| 197 | + | |
189 | 198 | | |
190 | | - | |
| 199 | + | |
191 | 200 | | |
192 | 201 | | |
| 202 | + | |
193 | 203 | | |
194 | 204 | | |
195 | 205 | | |
196 | 206 | | |
197 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
198 | 211 | | |
199 | 212 | | |
200 | 213 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
Lines changed: 31 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
220 | 249 | | |
221 | 250 | | |
222 | 251 | | |
223 | 252 | | |
224 | | - | |
| 253 | + | |
225 | 254 | | |
226 | 255 | | |
227 | | - | |
| 256 | + | |
228 | 257 | | |
229 | 258 | | |
230 | 259 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
0 commit comments