Skip to content

Commit a9bdde8

Browse files
committed
Update Gradle to 8.5 and ZAP to 2.14
Update Gradle Wrapper to 8.5 and ZAP to latest version. Apply the common plugins and remove now redundant configurations. Address warns with Java 21. Update GitHub Actions in workflow and add Java 21 to CI. Signed-off-by: thc202 <thc202@gmail.com>
1 parent 4bfdda9 commit a9bdde8

File tree

9 files changed

+25
-45
lines changed

9 files changed

+25
-45
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
java: [11]
14+
java: [11, 21]
1515

1616
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-java@v3
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-java@v4
1919
with:
2020
distribution: 'temurin'
2121
java-version: ${{ matrix.java }}

build.gradle.kts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@ import org.zaproxy.gradle.addon.misc.ConvertMarkdownToHtml
33

44
plugins {
55
`java-library`
6-
id("org.zaproxy.add-on") version "0.9.0"
7-
id("com.diffplug.spotless") version "6.20.0"
8-
}
9-
10-
repositories {
11-
mavenCentral()
6+
id("org.zaproxy.add-on") version "0.10.0"
7+
id("com.diffplug.spotless")
8+
id("org.zaproxy.common")
129
}
1310

1411
description = "A template for a 3rd party ZAP Java add-on."
1512

1613
zapAddOn {
1714
addOnId.set("addonjava")
1815
addOnName.set("A Template Java Add-on")
19-
zapVersion.set("2.13.0")
16+
zapVersion.set("2.14.0")
2017
addOnStatus.set(AddOnStatus.ALPHA)
2118

2219
releaseLink.set("https://github.com/youruser/javaexample/compare/v@PREVIOUS_VERSION@...v@CURRENT_VERSION@")
@@ -37,12 +34,6 @@ java {
3734
}
3835

3936
spotless {
40-
java {
41-
licenseHeaderFile("$rootDir/gradle/spotless/license.java")
42-
43-
googleJavaFormat("1.17.0").aosp()
44-
}
45-
4637
kotlinGradle {
4738
ktlint()
4839
}

gradle/spotless/license.java

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

gradle/wrapper/gradle-wrapper.jar

-19.4 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=7c3ad722e9b0ce8205b91560fd6ce8296ac3eadf065672242fd73c06b8eeb6ee
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
3+
distributionSha256Sum=c16d517b50dd28b3f5838f0e844b7520b8f1eb610f2f29de7e4e04a1b7c9c79b
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
8788

8889
# Use the maximum available, or set MAX_FD != -1 to use that value.
8990
MAX_FD=maximum
@@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
146147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
148149
MAX_FD=$( ulimit -H -n ) ||
149150
warn "Could not query maximum file descriptor limit"
150151
esac
151152
case $MAX_FD in #(
152153
'' | soft) :;; #(
153154
*)
154155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
156157
ulimit -n "$MAX_FD" ||
157158
warn "Could not set maximum file descriptor limit to $MAX_FD"
158159
esac
@@ -201,11 +202,11 @@ fi
201202
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
202203
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
203204

204-
# Collect all arguments for the java command;
205-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
206-
# shell script including quotes and variable substitutions, so put them in
207-
# double quotes to make sure that they get re-expanded; and
208-
# * put everything else in single quotes, so that it's not re-expanded.
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
209210

210211
set -- \
211212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

settings.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
plugins {
2+
id("org.zaproxy.common.settings") version "0.2.0"
3+
id("com.diffplug.spotless") version "6.20.0" apply false
4+
}
5+
16
rootProject.name = "addon-java"

src/main/java/com/github/youruser/zap/javaexample/RightClickMsgMenu.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class RightClickMsgMenu extends PopupMenuItemHttpMessageContainer {
3434

3535
private static final long serialVersionUID = 1L;
3636

37+
@SuppressWarnings("serial")
3738
private ExtensionJavaExample extension;
3839

3940
public RightClickMsgMenu(ExtensionJavaExample ext, String label) {

src/main/java/com/github/youruser/zap/javaexample/SimpleExampleAPI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class SimpleExampleAPI extends ApiImplementor {
3535

3636
private static final Logger LOGGER = LogManager.getLogger(SimpleExampleAPI.class);
3737

38+
@SuppressWarnings("this-escape")
3839
public SimpleExampleAPI() {
3940
this.addApiAction(new ApiAction(ACTION_HELLO_WORLD));
4041
}

0 commit comments

Comments
 (0)