Skip to content

Commit f71631a

Browse files
committed
Gradle Migration
1. Migrated from Maven to Gradle. 2. Migrated workflows from Maven to Gradle. 3. Added Gradle related files to the .gitignore. 4. Added a Gradle plugin to handle license headers automatically (both `ConnectConfigTest.java` files and `DatabaseLifecycleTest.java` were missing headers, this makes sure that never happens again and keeps all headers consistent). See `HEADER`. 5. Suppressed all PMD and normal false positive warnings to make Gradle happy while fixing accurate warnings. 6. Used non deprecated alternatives to anything that was deprecated to make Gradle happy. 7. Added quoting to `detect_linux_distribution.sh` to prevent word splitting which would break the script. 8. Added `.gitattributes` to normalize line endings and protect the `gradle-wrapper.jar`.
1 parent 734b7c5 commit f71631a

60 files changed

Lines changed: 1440 additions & 893 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.PVS-Studio/ide-warnings.json

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"languages": {
3+
"JAVA": {
4+
"groups": {
5+
"OWASP": "DISABLED",
6+
"GA": "SHOW_ALL"
7+
}
8+
}
9+
},
10+
"warnings": {
11+
"V6027": true,
12+
"V6026": true,
13+
"V6029": true,
14+
"V6028": true,
15+
"V6023": true,
16+
"V6022": true,
17+
"V6025": true,
18+
"V6024": true,
19+
"V6021": true,
20+
"V6020": true,
21+
"V6038": true,
22+
"V6037": true,
23+
"V6039": true,
24+
"V6034": true,
25+
"V6033": true,
26+
"V6036": true,
27+
"V6035": true,
28+
"V6030": true,
29+
"V6032": true,
30+
"V6031": true,
31+
"V6126": true,
32+
"V6005": true,
33+
"V6125": true,
34+
"V6004": true,
35+
"V6007": true,
36+
"V6128": true,
37+
"V6006": true,
38+
"V6127": true,
39+
"V6001": true,
40+
"V6089": true,
41+
"V6122": true,
42+
"V6088": true,
43+
"V6121": true,
44+
"V6124": true,
45+
"V6003": true,
46+
"V6002": true,
47+
"V6123": true,
48+
"V6009": true,
49+
"V6008": true,
50+
"V6129": true,
51+
"V6085": true,
52+
"V6084": true,
53+
"V6087": true,
54+
"V6120": true,
55+
"V6086": true,
56+
"V6081": true,
57+
"V6080": true,
58+
"V6083": true,
59+
"V6082": true,
60+
"V6016": true,
61+
"V6015": true,
62+
"V6018": true,
63+
"V6017": true,
64+
"V6012": true,
65+
"V6011": true,
66+
"V6099": true,
67+
"V6132": true,
68+
"V6014": true,
69+
"V6013": true,
70+
"V6019": true,
71+
"V6090": true,
72+
"V6096": true,
73+
"V6095": true,
74+
"V6010": true,
75+
"V6131": true,
76+
"V6098": true,
77+
"V6097": true,
78+
"V6130": true,
79+
"V6092": true,
80+
"V6091": true,
81+
"V6094": true,
82+
"V6093": true,
83+
"V6104": true,
84+
"V6103": true,
85+
"V6106": true,
86+
"V6105": true,
87+
"V6100": true,
88+
"V6067": true,
89+
"V6066": true,
90+
"V6069": true,
91+
"V6102": true,
92+
"V6068": true,
93+
"V6101": true,
94+
"V6108": true,
95+
"V6107": true,
96+
"V6109": true,
97+
"V6063": true,
98+
"V6062": true,
99+
"V6065": true,
100+
"V6064": true,
101+
"V6061": true,
102+
"V6060": true,
103+
"V6115": true,
104+
"V6114": true,
105+
"V6117": true,
106+
"V6116": true,
107+
"V6078": true,
108+
"V6111": true,
109+
"V6077": true,
110+
"V6110": true,
111+
"V6113": true,
112+
"V6079": true,
113+
"V6112": true,
114+
"V6119": true,
115+
"V6118": true,
116+
"V6074": true,
117+
"V6073": true,
118+
"V6076": true,
119+
"V6075": true,
120+
"V6070": true,
121+
"V6072": true,
122+
"V6071": true,
123+
"V6049": true,
124+
"V6048": true,
125+
"V6045": true,
126+
"V6044": true,
127+
"V6047": true,
128+
"V6046": true,
129+
"V6041": true,
130+
"V6040": true,
131+
"V6043": true,
132+
"V6042": true,
133+
"V6059": true,
134+
"V6056": true,
135+
"V6055": true,
136+
"V6058": true,
137+
"V6057": true,
138+
"V6052": true,
139+
"V6051": true,
140+
"V6054": true,
141+
"V6053": true,
142+
"V6050": true
143+
}
144+
}

.PVS-Studio/settings.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"src": [],
3+
"ext": [],
4+
"threads": 15,
5+
"output-type": "json",
6+
"securityRelatedIssues": false,
7+
"annotation-file": [],
8+
"incremental": false,
9+
"force-rebuild": false,
10+
"disable-cache": false,
11+
"exclude": [],
12+
"analyze-only": [],
13+
"fail-on-warnings": false,
14+
"analysis-mode": [
15+
"GA"
16+
],
17+
"disabled-warnings": [],
18+
"enabled-warnings": [],
19+
"additional-warnings": [],
20+
"suppress-base": ".PVS-Studio/suppress_base.json",
21+
"timeout": 10,
22+
"compatibility": false,
23+
"exclude-packages": [],
24+
"activate-license": false,
25+
"version": false,
26+
"is-java-core-subprocess-with-add-opens-for-native-libs-field-reflective-access": false,
27+
"write-to-stdout": false,
28+
"verbose": false,
29+
"useOfflineDocumentation": false,
30+
"skip-modules": [],
31+
"include-generated": false,
32+
"launch-mode": "IDEA",
33+
"enable-all-warnings": false,
34+
"benchmark": false,
35+
"java": "java",
36+
"jvm-arguments": [
37+
"-Xss64m"
38+
],
39+
"traceLogFileName": "pvs.log",
40+
"traceSpoonLogFileName": "spoon.log",
41+
"check-license": false,
42+
"logging": "OFF",
43+
"project": "C:/Users/organ/Documents/GitHub/embedded-postgres",
44+
"type": "sources",
45+
"disableDiag": false
46+
}

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto eol=lf
2+
gradlew text eol=lf
3+
*.bat text eol=crlf
4+
*.cmd text eol=crlf
5+
gradle-wrapper.jar -text -diff -merge -filter

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "weekly"
7-
- package-ecosystem: "maven"
7+
- package-ecosystem: "gradle"
88
directory: "/"
99
schedule:
1010
interval: "weekly"

.github/workflows/release.yml

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,49 @@ on:
33
milestone:
44
types: [closed]
55
jobs:
6-
build:
6+
release:
77
name: Release ${{ github.event.milestone.title }}
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v4
11+
uses: actions/checkout@v5
1212
with:
1313
ref: master
1414
fetch-depth: 0
15+
- name: Validate Gradle Wrapper
16+
uses: gradle/actions/wrapper-validation@v5
1517
- name: Set up Git
1618
run: |
1719
git config user.name "Zonky Bot"
1820
git config user.email "bot@zonky.com"
19-
- name: Set up JDK
20-
uses: actions/setup-java@v4
21+
- name: Set up JDK 8
22+
uses: actions/setup-java@v5
2123
with:
2224
distribution: 'zulu'
23-
java-version: 8
24-
server-id: ossrh
25-
server-username: MAVEN_USER
26-
server-password: MAVEN_PASS
27-
gpg-private-key: ${{ secrets.SIGNING_CERT }}
28-
gpg-passphrase: SIGNING_PASS
29-
- name: Release with Maven
25+
java-version: '8'
26+
cache: 'gradle'
27+
- name: Make Gradle wrapper executable
28+
run: chmod +x gradlew
29+
- name: Publish to Maven Central via Gradle
3030
env:
3131
RELEASE_VERSION: ${{ github.event.milestone.title }}
32-
MAVEN_USER: ${{ secrets.MAVEN_USER }}
33-
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
34-
SIGNING_PASS: ${{ secrets.SIGNING_PASS }}
35-
run: mvn -B release:prepare release:perform -DreleaseVersion=$RELEASE_VERSION
36-
- name: Upload staged artifacts to Central Sonatype
32+
# Gradle signing plugin (build.gradle.kts)
33+
MAVEN_SIGNING_KEY: ${{ secrets.SIGNING_CERT }}
34+
MAVEN_SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASS }}
35+
# nmcp credentials (build.gradle.kts)
36+
USERNAME_TOKEN: ${{ secrets.MAVEN_USER }}
37+
PASSWORD_TOKEN: ${{ secrets.MAVEN_PASS }}
38+
# Use the milestone title as the build's version without touching gradle.properties
39+
run: |
40+
./gradlew \
41+
-Pversion=$RELEASE_VERSION \
42+
clean check publishAllPublicationsToCentralPortal \
43+
--stacktrace
44+
# Reproduces Maven Release Plugin’s v@{project.version} tag
45+
- name: Tag release
46+
if: success()
3747
env:
38-
SONATYPE_USERNAME: ${{ secrets.MAVEN_USER }}
39-
SONATYPE_PASSWORD: ${{ secrets.MAVEN_PASS }}
48+
RELEASE_VERSION: ${{ github.event.milestone.title }}
4049
run: |
41-
SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64)
42-
PUBLISH_NAMESPACE="io.zonky"
43-
echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..."
44-
RESPONSE=$(curl -s -w "%{http_code}" -o response_body.txt -X POST \
45-
-H "Authorization: Bearer $SONATYPE_TOKEN" \
46-
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$PUBLISH_NAMESPACE?publishing_type=user_managed")
47-
if [ "$RESPONSE" -ne 200 ]; then
48-
echo "Failed to upload artifacts to Central Sonatype. Response code: $RESPONSE. Response body: "
49-
cat response_body.txt
50-
echo "Visit https://central.sonatype.com/publishing/deployments for more information."
51-
exit 1
52-
else
53-
echo "Artifacts were uploaded successfully to Central Sonatype."
54-
echo "Visit https://central.sonatype.com/publishing/deployments to view your artifacts."
55-
fi
50+
git tag "v$RELEASE_VERSION"
51+
git push origin "v$RELEASE_VERSION"

.github/workflows/test.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
java: [8, 11, 17, 21, 22] # LTS and newer versions
9+
java: [8, 11, 17, 21, 25] # LTS and newer versions
1010
steps:
11-
- name: Checkout project
12-
uses: actions/checkout@v4
13-
- name: Set up JDK
14-
uses: actions/setup-java@v4
15-
with:
16-
distribution: 'zulu'
17-
java-version: ${{ matrix.java }}
18-
cache: 'maven'
19-
- name: Build with Maven
20-
run: mvn -B test
11+
- name: Checkout project
12+
uses: actions/checkout@v5
13+
- name: Validate Gradle Wrapper
14+
uses: gradle/actions/wrapper-validation@v5
15+
- name: Set up JDK
16+
uses: actions/setup-java@v5
17+
with:
18+
distribution: 'zulu'
19+
java-version: ${{ matrix.java }}
20+
cache: 'gradle'
21+
- name: Make Gradle wrapper executable
22+
run: chmod +x gradlew
23+
- name: Build with Gradle
24+
run: ./gradlew check

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ target/
1717
.project
1818
.settings
1919
dist/
20+
.gradle/
21+
build/
22+
out/
23+
classes/

HEADER

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright ${CREATION_YEAR} Tomas Vanek
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
https://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

0 commit comments

Comments
 (0)