Skip to content

Commit 0a8b39e

Browse files
committed
migrate to gradle
1 parent bc729df commit 0a8b39e

File tree

316 files changed

+33830
-30314
lines changed

Some content is hidden

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

316 files changed

+33830
-30314
lines changed

.github/workflows/codeql.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,17 @@ jobs:
5555
queries: +security-extended,security-and-quality
5656

5757
# Autobuild fails so use custom build steps
58-
- name: Set up JDK 17
58+
- name: Set up JDK
5959
uses: actions/setup-java@v4
6060
with:
61-
java-version: '8.0.302'
61+
java-version: 17
6262
distribution: 'temurin'
6363

64-
- name: Run maven package
65-
run: mvn -s .github/m2/settings.xml clean package
66-
env:
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
- name: Setup Gradle
65+
uses: gradle/actions/setup-gradle@v4
66+
67+
- name: Run Gradle build
68+
run: ./gradlew assemble
6869

6970
- name: Perform CodeQL Analysis
7071
uses: github/codeql-action/analyze@v3

.github/workflows/maven.yml

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

.github/workflows/push.yml

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,35 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- name: Set up JDK 8
17+
- name: Set up JDK
1818
uses: actions/setup-java@v4
1919
with:
20-
java-version: 8.0.302
20+
java-version: 17
2121
distribution: 'temurin'
2222

23-
- name: Run maven verify
24-
run: |
25-
mvn -s .github/m2/settings.xml clean verify
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v4
25+
26+
- name: Run Gradle build
27+
run: ./gradlew build
2828

2929
- uses: actions/upload-artifact@v4
3030
if: always()
3131
with:
32-
path: core/target/coverage-report
32+
path: core/build/reports
3333
name: coverage report
3434

3535
- uses: actions/upload-artifact@v4
3636
if: always()
3737
with:
38-
path: core/target/surefire-reports
38+
path: core/build/reports/tests
3939
name: unit test report
4040

4141
- name: Check shading(core)
4242
run: |
43-
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
44-
code=0
45-
for path in $(jar tf "core/target/core-$VERSION.jar" | grep -E -v '^((com/solarwinds|META))')
46-
do
47-
PACKAGE=$(echo "$path" | awk -F/ '{print $2}')
48-
if [ -n "$PACKAGE" ]; then
49-
echo "Package ($path) is not shaded"
50-
code=1
51-
fi
52-
done
53-
exit $code
54-
55-
- name: Check shading(metric)
56-
run: |
57-
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
43+
VERSION=$(grep 'val projectVersion' build.gradle.kts | sed 's/.*"\(.*\)".*/\1/')
5844
code=0
59-
for path in $(jar tf "metrics/target/metrics-$VERSION.jar" | grep -E -v '^((com/solarwinds|META))')
45+
for path in $(jar tf "core/build/libs/core-$VERSION.jar" | grep -E -v '^((com/solarwinds|META))')
6046
do
6147
PACKAGE=$(echo "$path" | awk -F/ '{print $2}')
6248
if [ -n "$PACKAGE" ]; then
@@ -68,9 +54,9 @@ jobs:
6854
6955
- name: Check shading(sampling)
7056
run: |
71-
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
57+
VERSION=$(grep 'val projectVersion' build.gradle.kts | sed 's/.*"\(.*\)".*/\1/')
7258
code=0
73-
for path in $(jar tf "sampling/target/sampling-$VERSION.jar" | grep -E -v '^((com/solarwinds|META))')
59+
for path in $(jar tf "sampling/build/libs/sampling-$VERSION.jar" | grep -E -v '^((com/solarwinds|META))')
7460
do
7561
PACKAGE=$(echo "$path" | awk -F/ '{print $2}')
7662
if [ -n "$PACKAGE" ]; then
@@ -85,20 +71,22 @@ jobs:
8571
steps:
8672
- uses: actions/checkout@v4
8773

88-
- name: Set up JDK 8
74+
- name: Set up JDK
8975
uses: actions/setup-java@v4
9076
with:
91-
java-version: 8.0.302
77+
java-version: 17
9278
distribution: 'temurin'
9379

80+
- name: Setup Gradle
81+
uses: gradle/actions/setup-gradle@v4
82+
9483
- name: Deploy snapshot
9584
run: |
96-
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
85+
VERSION=$(grep 'val projectVersion' build.gradle.kts | sed 's/.*"\(.*\)".*/\1/')
9786
BRANCH=$(echo -n "${GITHUB_REF_NAME}" | sed -e 's/[^0-9a-zA-Z\._\-]/./g' | tr '[:upper:]' '[:lower:]')
9887
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
99-
88+
10089
NEW_VERSION=${VERSION%%-SNAPSHOT}-$BRANCH-$GIT_HASH-SNAPSHOT
101-
mvn versions:set -DnewVersion=$NEW_VERSION
102-
mvn -s .github/m2/settings.xml -T 8 deploy -DskipTests
90+
./gradlew publish -Pversion=$NEW_VERSION
10391
env:
10492
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
packages: write
8+
contents: write
9+
id-token: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up JDK
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: 17
21+
distribution: 'temurin'
22+
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v4
25+
26+
- name: Set version env
27+
run: |
28+
VERSION=$(grep 'val projectVersion' build.gradle.kts | sed 's/.*"\(.*\)".*/\1/')
29+
RELEASE_VERSION=${VERSION%%-SNAPSHOT}
30+
echo "RELEASE_VERSION=v$RELEASE_VERSION" >> $GITHUB_ENV
31+
echo "VERSION_NUMBER=$RELEASE_VERSION" >> $GITHUB_ENV
32+
33+
- name: Publish package
34+
run: ./gradlew publish -Pversion=${{ env.VERSION_NUMBER }}
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
out/
1010
**/.flattened-pom.xml
1111
.spotless/
12+
.gradle
13+
**/build

build.gradle.kts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import com.diffplug.gradle.spotless.SpotlessExtension
2+
3+
plugins {
4+
`java-library`
5+
id("com.diffplug.spotless") version "6.25.0" apply false
6+
id("io.freefair.lombok") version "8.13" apply false
7+
id("com.gradleup.shadow") version "8.3.9" apply false
8+
}
9+
10+
val projectVersion = findProperty("version")?.toString()?.takeIf { it != "unspecified" }
11+
?: "10.0.27-SNAPSHOT"
12+
13+
allprojects {
14+
group = "com.solarwinds.joboe"
15+
version = projectVersion
16+
}
17+
18+
subprojects {
19+
apply(plugin = "java-library")
20+
apply(plugin = "io.freefair.lombok")
21+
apply(plugin = "com.diffplug.spotless")
22+
apply(plugin = "maven-publish")
23+
24+
configure<JavaPluginExtension> {
25+
toolchain {
26+
languageVersion.set(JavaLanguageVersion.of(8))
27+
}
28+
withSourcesJar()
29+
}
30+
31+
dependencies {
32+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
33+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
34+
testImplementation("org.junit-pioneer:junit-pioneer:1.9.1")
35+
testImplementation("org.mockito:mockito-core:3.12.4")
36+
testImplementation("org.mockito:mockito-junit-jupiter:3.12.4")
37+
testImplementation("org.mockito:mockito-inline:3.12.4")
38+
}
39+
40+
tasks {
41+
withType<Test>().configureEach {
42+
useJUnitPlatform()
43+
testLogging {
44+
events("passed", "skipped", "failed")
45+
}
46+
}
47+
}
48+
49+
configure<SpotlessExtension> {
50+
java {
51+
googleJavaFormat()
52+
removeUnusedImports()
53+
trimTrailingWhitespace()
54+
endWithNewline()
55+
}
56+
}
57+
58+
configure<PublishingExtension> {
59+
repositories {
60+
maven {
61+
name = "GitHubPackages"
62+
url = uri("https://maven.pkg.github.com/solarwinds/joboe")
63+
credentials {
64+
username = System.getenv("GITHUB_ACTOR") ?: property("gpr.user") as String?
65+
password = System.getenv("GITHUB_TOKEN") ?: property("gpr.key") as String?
66+
}
67+
}
68+
}
69+
70+
publications {
71+
create<MavenPublication>("maven") {
72+
from(components["java"])
73+
}
74+
}
75+
}
76+
}

config/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
description = "config"
2+
3+
dependencies {
4+
api(project(":logging"))
5+
api("org.json:json:20250517")
6+
}

config/pom.xml

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

0 commit comments

Comments
 (0)