Skip to content

Commit c376050

Browse files
committed
Build tweaks and Gradle update
Update Gradle wrapper to latest version (4.0). Apply Java plugin (and other properties) to just the subprojects. Use constants for Java version. Execute uberJar task automatically when building and update the README to reflect the change. Allow to generate the POM file and install it to local Maven repository.
1 parent 45d2e2d commit c376050

File tree

6 files changed

+83
-65
lines changed

6 files changed

+83
-65
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Checkout the tagged version:
105105

106106
Create the artifacts/libraries necessary for the release:
107107

108-
./gradlew clean build uberJar
108+
./gradlew clean build
109109

110110
### Release to Maven Central
111111

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
task wrapper(type: Wrapper) {
2-
gradleVersion = '3.2.1'
2+
gradleVersion = '4.0'
33
}
44

55
apply from: "gradle/compile.gradle"
66
apply from: "gradle/idea.gradle"
77
apply from: "gradle/eclipse.gradle"
88

9-
allprojects {
9+
subprojects {
1010
apply plugin: 'java'
1111
group = 'org.zaproxy'
1212

@@ -18,6 +18,6 @@ allprojects {
1818
mavenCentral()
1919
}
2020

21-
sourceCompatibility = 1.7
22-
targetCompatibility = 1.7
21+
sourceCompatibility = JavaVersion.VERSION_1_7
22+
targetCompatibility = JavaVersion.VERSION_1_7
2323
}

gradle/wrapper/gradle-wrapper.jar

1.84 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-bin.zip
6-
distributionSha256Sum=9843a3654d3e57dce54db06d05f18b664b95c22bf90c6becccb61fc63ce60689
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
6+
distributionSha256Sum=56bd2dde29ba2a93903c557da1745cafd72cdd8b6b0b83c05a40ed7896b79dfe

gradlew

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
##############################################################################
44
##
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
3333
# Use the maximum available, or set MAX_FD != -1 to use that value.
3434
MAX_FD="maximum"
3535

36-
warn ( ) {
36+
warn () {
3737
echo "$*"
3838
}
3939

40-
die ( ) {
40+
die () {
4141
echo
4242
echo "$*"
4343
echo
@@ -154,16 +154,19 @@ if $cygwin ; then
154154
esac
155155
fi
156156

157-
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158-
function splitJvmOpts() {
159-
JVM_OPTS=("$@")
157+
# Escape application args
158+
save () {
159+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160+
echo " "
160161
}
161-
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162-
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
162+
APP_ARGS=$(save "$@")
163+
164+
# Collect all arguments for the java command, following the shell quoting and substitution rules
165+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
163166

164167
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165-
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
168+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
166169
cd "$(dirname "$0")"
167170
fi
168171

169-
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
172+
exec "$JAVACMD" "$@"

subprojects/zap-clientapi/zap-clientapi.gradle

Lines changed: 63 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ task uberJar(type: Jar) {
5353
with jar
5454
}
5555

56+
build.dependsOn 'uberJar'
57+
5658
artifacts { archives sourcesJar, javadocJar }
5759

5860
signing {
@@ -61,6 +63,66 @@ signing {
6163
}
6264
}
6365

66+
ext.pomData = pom {
67+
project {
68+
name 'OWASP ZAP API Client'
69+
packaging 'jar'
70+
description 'Java implementation to access OWASP ZAP API.'
71+
url 'https://github.com/zaproxy/zap-api-java'
72+
73+
organization {
74+
name 'OWASP'
75+
url 'https://www.owasp.org/index.php/ZAP'
76+
}
77+
78+
mailingLists {
79+
mailingList {
80+
name 'OWASP ZAP User Group'
81+
82+
archive 'https://groups.google.com/group/zaproxy-users'
83+
}
84+
mailingList {
85+
name 'OWASP ZAP Developer Group'
86+
87+
archive 'https://groups.google.com/group/zaproxy-develop'
88+
}
89+
}
90+
91+
scm {
92+
url 'https://github.com/zaproxy/zap-api-java'
93+
connection 'scm:git:https://github.com/zaproxy/zap-api-java.git'
94+
developerConnection 'scm:git:https://github.com/zaproxy/zap-api-java.git'
95+
}
96+
97+
licenses {
98+
license {
99+
name 'The Apache License, Version 2.0'
100+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
101+
distribution 'repo'
102+
}
103+
}
104+
105+
developers {
106+
developer {
107+
id 'psiinon'
108+
name 'Simon Bennetts'
109+
110+
}
111+
}
112+
}
113+
}
114+
115+
task generatePom {
116+
description 'Generates the POM file.'
117+
pomData.writeTo("$buildDir/pom.xml")
118+
}
119+
120+
install {
121+
repositories.mavenInstaller {
122+
pom = pomData
123+
}
124+
}
125+
64126
uploadArchives {
65127
repositories {
66128
mavenDeployer {
@@ -80,54 +142,7 @@ uploadArchives {
80142
}
81143
}
82144

83-
pom {
84-
project {
85-
name 'OWASP ZAP API Client'
86-
packaging 'jar'
87-
description 'Java implementation to access OWASP ZAP API.'
88-
url 'https://github.com/zaproxy/zap-api-java'
89-
90-
organization {
91-
name 'OWASP'
92-
url 'https://www.owasp.org/index.php/ZAP'
93-
}
94-
95-
mailingLists {
96-
mailingList {
97-
name 'OWASP ZAP User Group'
98-
99-
archive 'https://groups.google.com/group/zaproxy-users'
100-
}
101-
mailingList {
102-
name 'OWASP ZAP Developer Group'
103-
104-
archive 'https://groups.google.com/group/zaproxy-develop'
105-
}
106-
}
107-
108-
scm {
109-
url 'https://github.com/zaproxy/zap-api-java'
110-
connection 'scm:git:https://github.com/zaproxy/zap-api-java.git'
111-
developerConnection 'scm:git:https://github.com/zaproxy/zap-api-java.git'
112-
}
113-
114-
licenses {
115-
license {
116-
name 'The Apache License, Version 2.0'
117-
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
118-
distribution 'repo'
119-
}
120-
}
121-
122-
developers {
123-
developer {
124-
id 'psiinon'
125-
name 'Simon Bennetts'
126-
127-
}
128-
}
129-
}
130-
}
145+
pom = pomData
131146
}
132147
}
133148
}

0 commit comments

Comments
 (0)