Skip to content

Commit

Permalink
Merge pull request #1189 from thc202/gradle/v7.6
Browse files Browse the repository at this point in the history
Update Gradle and plugins
  • Loading branch information
kingthorin authored Feb 7, 2023
2 parents f2621f4 + cdc8f32 commit 36b231f
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 37 deletions.
18 changes: 7 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ plugins {
jacoco
id("org.zaproxy.add-on") version "0.8.0"
id("org.zaproxy.crowdin") version "0.3.1"
id("com.diffplug.spotless") version "6.11.0"
id("com.github.ben-manes.versions") version "0.39.0"
id("com.github.node-gradle.node") version "3.4.0"
id("com.diffplug.spotless") version "6.14.1"
id("com.github.ben-manes.versions") version "0.45.0"
id("com.github.node-gradle.node") version "3.5.1"
}

apply(from = "$rootDir/gradle/compile.gradle.kts")
Expand Down Expand Up @@ -133,7 +133,7 @@ java {
targetCompatibility = javaVersion
}

val jupiterVersion = "5.8.1"
val jupiterVersion = "5.9.2"

dependencies {
compileOnly("org.zaproxy.addon:network:0.1.0")
Expand All @@ -155,10 +155,6 @@ tasks.withType<Test>().configureEach {
useJUnitPlatform()
}

jacoco {
toolVersion = "0.8.8"
}

val jacocoReportAll by tasks.registering(JacocoReport::class) {
executionData(tasks.named("test").get(), tasks.named("testTutorial").get(), tasks.named("zapStartTest").get())
sourceSets(sourceSets.main.get())
Expand Down Expand Up @@ -357,9 +353,9 @@ tasks.withType<Test>().configureEach {
systemProperties.putAll(
mapOf(
"wdm.chromeDriverVersion" to "83.0.4103.39",
"wdm.geckoDriverVersion" to "0.31.0",
"wdm.forceCache" to "true"
)
"wdm.geckoDriverVersion" to "0.32.1",
"wdm.forceCache" to "true",
),
)
}

Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
`java-gradle-plugin`
id("com.diffplug.spotless") version "6.11.0"
id("com.diffplug.spotless") version "6.14.1"
}

apply(from = "../gradle/compile.gradle.kts")
Expand All @@ -10,8 +10,8 @@ repositories {
}

dependencies {
implementation("org.apache.commons:commons-lang3:3.8.1")
implementation("org.zaproxy:zap-clientapi:1.6.0")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("org.zaproxy:zap-clientapi:1.11.0")
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.zaproxy.gradle.tasks;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
Expand All @@ -29,7 +30,6 @@
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.gradle.api.DefaultTask;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input;
Expand All @@ -40,17 +40,17 @@
/** A task that downloads a ZAP weekly release. */
public class ZapDownloadWeekly extends DefaultTask {

private final DirectoryProperty into;
private final Property<File> into;
private final Property<String> zapVersions;

public ZapDownloadWeekly() {
ObjectFactory objects = getProject().getObjects();
into = objects.directoryProperty();
into = objects.property(File.class);
zapVersions = objects.property(String.class);
}

@Input
public DirectoryProperty getInto() {
public Property<File> getInto() {
return into;
}

Expand Down Expand Up @@ -78,7 +78,7 @@ public void download() {
String weeklyUrl = elementNodeList.item(0).getTextContent();

String fileName = weeklyUrl.substring(weeklyUrl.lastIndexOf('/') + 1);
Path file = into.get().getAsFile().toPath().resolve(fileName);
Path file = into.get().toPath().resolve(fileName);
if (Files.exists(file)) {
try (ZipFile zip = new ZipFile(file.toFile())) {
getLogger().info("Skipping download, the file already exists.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected List<String> getBaseCommand() {
}
});
command.add(CLASSPATH_ARG);
command.add(getZapJarName(getInstallDir().getAsFile().get()));
command.add(getZapJarName(getInstallDir().get()));
command.add(MAIN_CLASSNAME);
return command;
}
Expand Down Expand Up @@ -121,7 +121,7 @@ public String getExecutable() {
@Internal
@Override
public File getWorkingDir() {
return getInstallDir().getAsFile().get();
return getInstallDir().get();
}

@Override
Expand Down
19 changes: 9 additions & 10 deletions buildSrc/src/main/java/org/zaproxy/gradle/tasks/ZapStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.Arrays;
import java.util.List;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;
Expand All @@ -54,26 +53,26 @@ public class ZapStart extends ZapApiTask {
private static final String LINUX_START_SCRIPT = "./zap.sh";
private static final String WINDOWS_START_SCRIPT = "zap.bat";

private final DirectoryProperty installDir;
private final DirectoryProperty homeDir;
private final Property<File> installDir;
private final Property<File> homeDir;
private final ListProperty<String> args;
private final Property<Integer> connectionTimeout;

public ZapStart() {
ObjectFactory objects = getProject().getObjects();
installDir = objects.directoryProperty();
homeDir = objects.directoryProperty();
installDir = objects.property(File.class);
homeDir = objects.property(File.class);
args = objects.listProperty(String.class);
connectionTimeout = objects.property(Integer.class).value(DEFAULT_TIMEOUT);
}

@Input
public DirectoryProperty getInstallDir() {
public Property<File> getInstallDir() {
return installDir;
}

@Input
public DirectoryProperty getHomeDir() {
public Property<File> getHomeDir() {
return homeDir;
}

Expand Down Expand Up @@ -114,8 +113,8 @@ public void start() {

ProcessBuilder pb = new ProcessBuilder();
pb.redirectErrorStream(true)
.redirectOutput(new File(homeDir.get().getAsFile(), "output"))
.directory(installDir.get().getAsFile());
.redirectOutput(new File(homeDir.get(), "output"))
.directory(installDir.get());

List<String> command = new ArrayList<>();
command.addAll(getBaseCommand());
Expand Down Expand Up @@ -156,7 +155,7 @@ public void start() {
protected List<String> getBaseCommand() {
return Arrays.asList(
Os.isFamily(Os.FAMILY_WINDOWS)
? new File(installDir.get().getAsFile(), WINDOWS_START_SCRIPT).toString()
? new File(installDir.get(), WINDOWS_START_SCRIPT).toString()
: LINUX_START_SCRIPT);
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=db9c8211ed63f61f60292c69e80d89196f9eb36665e369e7f00ac4cc841c2219
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionSha256Sum=312eb12875e1747e05c2f81a4789902d7e4ec5defbd1eefeaccc08acf096505d
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down

0 comments on commit 36b231f

Please sign in to comment.