From 3d4a31240f3f1f5debcaf09209e278a45a9bd8ac Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Thu, 30 Nov 2023 09:20:19 +0100 Subject: [PATCH] Automatically handle Java dependencies updates (#4891) * Automatically handle Java dependencies updates * Fix commands * Fix commands * Fix paths * Copy deps --- .github/dependabot.yml | 12 ++++++++++++ Dockerfile | 4 +--- dependencies/checkstyle/build.gradle | 12 ++++++++++++ dependencies/google-java-format/build.gradle | 12 ++++++++++++ scripts/install-checkstyle.sh | 3 +++ scripts/install-google-java-format.sh | 3 +++ 6 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 dependencies/checkstyle/build.gradle create mode 100644 dependencies/google-java-format/build.gradle diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0808a577..f14d2aeb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -37,3 +37,15 @@ updates: schedule: interval: "weekly" open-pull-requests-limit: 10 + + # Maintain dependencies for Java + - package-ecosystem: "gradle" + directory: "/dependencies/checkstyle" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + - package-ecosystem: "gradle" + directory: "/dependencies/google-java-format" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 diff --git a/Dockerfile b/Dockerfile index 3a1d34c1..050f283f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,12 +34,10 @@ FROM python:3.11.5-alpine3.17 as base_image ################################ # Set ARG values used in Build # ################################ -ARG CHECKSTYLE_VERSION='10.3.4' ARG CLJ_KONDO_VERSION='2023.05.18' # Dart Linter ## stable dart sdk: https://dart.dev/get-dart#release-channels ARG DART_VERSION='2.8.4' -ARG GOOGLE_JAVA_FORMAT_VERSION='1.18.1' ## install alpine-pkg-glibc (glibc compatibility layer package for Alpine Linux) ARG GLIBC_VERSION='2.34-r0' ARG KTLINT_VERSION='0.47.1' @@ -94,7 +92,7 @@ RUN apk add --no-cache \ ######################################## # Copy dependencies files to container # ######################################## -COPY dependencies/* / +COPY dependencies/ / ################################################################### # Install Dependencies # diff --git a/dependencies/checkstyle/build.gradle b/dependencies/checkstyle/build.gradle new file mode 100644 index 00000000..030ea73a --- /dev/null +++ b/dependencies/checkstyle/build.gradle @@ -0,0 +1,12 @@ +repositories { + mavenLocal() + mavenCentral() +} + +// Hold this dependency here so we can get automated updates using DependaBot +dependencies { + implementation 'com.puppycrawl.tools:checkstyle:10.3.4' +} + +group 'com.github.super-linter' +version '1.0.0-SNAPSHOT' diff --git a/dependencies/google-java-format/build.gradle b/dependencies/google-java-format/build.gradle new file mode 100644 index 00000000..c2d49f60 --- /dev/null +++ b/dependencies/google-java-format/build.gradle @@ -0,0 +1,12 @@ +repositories { + mavenLocal() + mavenCentral() +} + +// Hold this dependency here so we can get automated updates using DependaBot +dependencies { + implementation 'com.google.googlejavaformat:google-java-format:1.18.1' +} + +group 'com.github.super-linter' +version '1.0.0-SNAPSHOT' diff --git a/scripts/install-checkstyle.sh b/scripts/install-checkstyle.sh index f924ace1..ebeb272a 100755 --- a/scripts/install-checkstyle.sh +++ b/scripts/install-checkstyle.sh @@ -2,6 +2,9 @@ set -euo pipefail +CHECKSTYLE_VERSION="$(grep <"checkstyle/build.gradle" "checkstyle" | awk -F ':' '{print $3}' | tr -d "'")" +echo "Installing Checkstyle: ${CHECKSTYLE_VERSION}" + url=$(curl -s \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ diff --git a/scripts/install-google-java-format.sh b/scripts/install-google-java-format.sh index e23f725a..58413698 100755 --- a/scripts/install-google-java-format.sh +++ b/scripts/install-google-java-format.sh @@ -2,6 +2,9 @@ set -euo pipefail +GOOGLE_JAVA_FORMAT_VERSION="$(grep <"google-java-format/build.gradle" "google-java-format" | awk -F ':' '{print $3}' | tr -d "'")" +echo "Installing Google Java Format: ${GOOGLE_JAVA_FORMAT_VERSION}" + url=$(curl -s \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \