You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[8.17] Fix reproducability of builds against Java EA versions (#132847) (#132979)
* Fix reproducability of builds against Java EA versions (#132847)
* Introduce dedicated toolchain resolver for EA java versions
* Fix reproducability of builds against Java EA versions
This fixes a reproducability issue when using the gradle javaToolChain api.
There is no way to test toolchain candidates reliable against the build number in use.
This meant that ones you e.g. have resolved some version of java 25, gradle toolchain detection
does not detect the difference between certain builds (or even ea vs. released version)
Therefore we fallback to rely on our custom JDKDownloadPlugin for now here.
Syncing with the gradle team, they want to fix this somewhen in 9.x. We will revisit our solution
ones something is available. Ultimately we want to get rid of usages of the JDK download plugin.
* Minor cleanup and fixing non set distribution type in jdk
* Fix ea jdk selection not just based on major version
explicitly requires to add a ea postfix to the runtime sys property
* Fix test reproduce linies when using java ea version
* Apply review feedback
* Use runtime jdk when patching
* More cleanup
(cherry picked from commit 16fe7db)
# Conflicts:
# BUILDING.md
# build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/JdkDownloadPluginFuncTest.groovy
# build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/toolchain/OracleOpenJdkToolchainResolver.java
# build-tools-internal/src/test/groovy/org/elasticsearch/gradle/internal/toolchain/OracleOpenJdkToolchainResolverSpec.groovy
# test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java
* Fix merge issues
Copy file name to clipboardExpand all lines: BUILDING.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,10 +92,17 @@ uses the changed dependencies. In most cases, `precommit` or `check` are good ca
92
92
We prefer sha256 checksums as md5 and sha1 are not considered safe anymore these days. The generated entry
93
93
will have the `origin` attribute been set to `Generated by Gradle`.
94
94
95
+
<<<<<<< HEAD
95
96
>A manual confirmation of the Gradle generated checksums is currently not mandatory.
96
97
>If you want to add a level of verification you can manually confirm the checksum (e.g. by looking it up on the website of the library)
97
98
>Please replace the content of the `origin` attribute by `official site` in that case.
98
99
>
100
+
=======
101
+
> [!Tip]
102
+
> A manual confirmation of the Gradle generated checksums is currently not mandatory.
103
+
> If you want to add a level of verification you can manually confirm the checksum (e.g. by looking it up on the website of the library)
104
+
> Please replace the content of the `origin` attribute by `official site` in that case.
105
+
>>>>>>> 16fe7db13720 (Fix reproducability of builds against Java EA versions (#132847))
99
106
100
107
#### Custom plugin and task implementations
101
108
@@ -186,6 +193,25 @@ dependencies {
186
193
187
194
To test an unreleased development version of a third party dependency you have several options.
188
195
196
+
### How do I test against java early access (ea) versions?
197
+
198
+
Currently only openjdk EA builds by oracle are supported.
199
+
To test against an early access version java version you can pass the major
200
+
java version appended with `-ea` as a system property (e.g. -Druntime.java=26-ea) to the Gradle build:
201
+
202
+
```
203
+
./gradlew clean test -Druntime.java=26-ea
204
+
```
205
+
206
+
This will run the tests using the JDK 26 EA version and pick the latest available build of the matching JDK EA version we expose
207
+
in our custom jdk catalogue at `https://storage.googleapis.com/elasticsearch-jdk-archive/jdks/openjdk/latest.json`.
208
+
209
+
To run against a specific build number of the EA build you can pass a second system property (e.g. `-Druntime.java.build=6`):
210
+
211
+
```
212
+
./gradlew clean test -Druntime.java=26-ea -Druntime.java.build=6
213
+
```
214
+
189
215
#### How to use a Maven based third party dependency via `mavenlocal`?
190
216
191
217
1. Clone the third party repository locally
@@ -229,11 +255,16 @@ In addition to snapshot builds JitPack supports building Pull Requests. Simply u
229
255
3. Run the Gradle build as needed. Keep in mind the initial resolution might take a bit longer as this needs to be built
230
256
by JitPack in the background before we can resolve the adhoc built dependency.
231
257
258
+
<<<<<<< HEAD
232
259
---
233
260
234
261
**NOTE**
235
262
236
263
You should only use that approach locally or on a developer branch for production dependencies as we do
264
+
=======
265
+
> [!Note]
266
+
> You should only use that approach locally or on a developer branch for production dependencies as we do
267
+
>>>>>>> 16fe7db13720 (Fix reproducability of builds against Java EA versions (#132847))
237
268
not want to ship unreleased libraries into our releases.
238
269
---
239
270
@@ -265,10 +296,15 @@ allprojects {
265
296
```
266
297
4. Run the Gradle build as needed with `--write-verification-metadata` to ensure the Gradle dependency verification does not fail on your custom dependency.
267
298
299
+
<<<<<<< HEAD
268
300
---
269
301
**NOTE**
270
302
271
303
As Gradle prefers to use modules whose descriptor has been created from real meta-data rather than being generated,
304
+
=======
305
+
> [!Note]
306
+
> As Gradle prefers to use modules whose descriptor has been created from real meta-data rather than being generated,
307
+
>>>>>>> 16fe7db13720 (Fix reproducability of builds against Java EA versions (#132847))
272
308
flat directory repositories cannot be used to override artifacts with real meta-data from other repositories declared in the build.
273
309
For example, if Gradle finds only `jmxri-1.2.1.jar` in a flat directory repository, but `jmxri-1.2.1.pom` in another repository
274
310
that supports meta-data, it will use the second repository to provide the module.
Copy file name to clipboardExpand all lines: build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractGitAwareGradleFuncTest.groovy
Copy file name to clipboardExpand all lines: build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/JdkDownloadPluginFuncTest.groovy
0 commit comments