Dynamically select Gradle based on Java version
What does this MR do?
While working on adding support for Java 17 and Gradle 7, I noticed that the Gradle Java compatibility chart shows that different versions of Java require different versions of Gradle.
This MR improves the logic for switching the gradle version in analyzer-wrapper so that in addition to supporting Java 17, we also support dynamically switching the Gradle version for Java 13, 14, 15 and 16.
See this discussion for more details.
Testing
None of the following test projects contain a gradlew
file, so the version of gradle is not pinned, and is dynamically selected based on the DS_JAVA_VERSION
value:
-
Using java version 'adoptopenjdk-14.0.1+7.1' Using gradle version '6.7.1'
-
Using java version 'adoptopenjdk-16.0.0+36' Using gradle version '7.3.3'
-
Using java version 'adoptopenjdk-17.0.2+8' Using gradle version '7.3.3'
What are the relevant issue numbers?
gitlab-org/gitlab#341170 (closed)
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated for GitLab EE, if necessary -
Documentation created/updated for this project, if necessary -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Job definition updated, if necessary -
Conforms to the code review guidelines -
Conforms to the Go guidelines -
Security reports checked/validated by reviewer
Edited by Adam Cohen