Skip to content

Commit af77818

Browse files
authored
Merge pull request #31 from synadia-io/bp-upgrade-gradle
Upgrade Gradle
2 parents 3fd106c + 3e1346f commit af77818

File tree

10 files changed

+313
-232
lines changed

10 files changed

+313
-232
lines changed

.github/workflows/bp-main.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ jobs:
1818
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
1919
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
2020
steps:
21-
- name: Set up JDK 8
22-
uses: actions/setup-java@v3
21+
- name: Set up JDK
22+
uses: actions/setup-java@v5
2323
with:
24-
java-version: '8'
25-
distribution: 'adopt'
24+
java-version: '21'
25+
distribution: 'temurin'
2626
- name: Install Nats Server
2727
run: |
28-
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh
29-
sudo mv nats-server /usr/local/bin
28+
pkill -9 nats-server 2>/dev/null || true
29+
mkdir -p ~/.local/bin
30+
cd $GITHUB_WORKSPACE
31+
git clone https://github.com/nats-io/nats-server.git
32+
cd nats-server
33+
go build -o ~/.local/bin/nats-server
3034
nats-server -v
3135
- name: Check out code
32-
uses: actions/checkout@v3
36+
uses: actions/checkout@v4
3337
- name: Compile and Test
3438
run: |
3539
pushd batch-publish
@@ -45,3 +49,6 @@ jobs:
4549
pushd batch-publish
4650
./gradlew -i publishToSonatype
4751
popd
52+
- name: Clean up
53+
if: always()
54+
run: pkill -9 nats-server 2>/dev/null || true

.github/workflows/bp-pr.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,23 @@ jobs:
1717
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
1818
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
1919
steps:
20-
- name: Set up JDK 8
21-
uses: actions/setup-java@v3
20+
- name: Set up JDK
21+
uses: actions/setup-java@v5
2222
with:
23-
java-version: '8'
24-
distribution: 'adopt'
23+
java-version: '21'
24+
distribution: 'temurin'
2525
- name: Install Nats Server
2626
run: |
27-
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh
28-
sudo mv nats-server /usr/local/bin
27+
pkill -9 nats-server 2>/dev/null || true
28+
mkdir -p ~/.local/bin
29+
cd $GITHUB_WORKSPACE
30+
git clone https://github.com/nats-io/nats-server.git
31+
cd nats-server
32+
go build -o ~/.local/bin/nats-server
2933
nats-server -v
3034
- name: Check out code
31-
uses: actions/checkout@v3
32-
- name: Compile and Test
35+
uses: actions/checkout@v4
36+
- name: Build and Test
3337
run: |
3438
pushd batch-publish
3539
chmod +x gradlew && ./gradlew clean test
@@ -39,3 +43,6 @@ jobs:
3943
pushd batch-publish
4044
./gradlew javadoc
4145
popd
46+
- name: Clean up
47+
if: always()
48+
run: pkill -9 nats-server 2>/dev/null || true

.github/workflows/bp-release.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@ jobs:
1515
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
1616
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
1717
steps:
18-
- name: Set up JDK 8
19-
uses: actions/setup-java@v3
18+
- name: Set up JDK
19+
uses: actions/setup-java@v5
2020
with:
21-
java-version: '8'
22-
distribution: 'adopt'
21+
java-version: '21'
22+
distribution: 'temurin'
2323
- name: Install Nats Server
2424
run: |
25-
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@main | PREFIX=. sh
26-
sudo mv nats-server /usr/local/bin
25+
pkill -9 nats-server 2>/dev/null || true
26+
mkdir -p ~/.local/bin
27+
cd $GITHUB_WORKSPACE
28+
git clone https://github.com/nats-io/nats-server.git
29+
cd nats-server
30+
go build -o ~/.local/bin/nats-server
2731
nats-server -v
2832
- name: Check out code
29-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
3034
- name: Compile and Test
3135
run: |
3236
pushd batch-publish
@@ -35,5 +39,8 @@ jobs:
3539
- name: Verify, Sign and Publish Release
3640
run: |
3741
pushd batch-publish
38-
./gradlew -i signArchives signMavenJavaPublication publishToSonatype closeAndReleaseSonatypeStagingRepository
42+
./gradlew -i publishToSonatype closeAndReleaseSonatypeStagingRepository
3943
popd
44+
- name: Clean up
45+
if: always()
46+
run: pkill -9 nats-server 2>/dev/null || true

batch-publish/build.gradle

Lines changed: 40 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,53 @@
11
import aQute.bnd.gradle.Bundle
2-
import org.gradle.internal.os.OperatingSystem
32

43
plugins {
5-
id 'java'
6-
id 'java-library'
7-
id 'maven-publish'
8-
id 'jacoco'
9-
id 'com.github.kt3k.coveralls' version '2.12.0'
10-
id 'biz.aQute.bnd.builder' version '5.1.2'
11-
id "org.gradle.test-retry" version "1.1.9"
12-
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
13-
id 'signing'
4+
id("java")
5+
id("java-library")
6+
id("maven-publish")
7+
id("jacoco")
8+
id("biz.aQute.bnd.builder") version "7.1.0"
9+
id("org.gradle.test-retry") version "1.6.4"
10+
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
11+
id("signing")
1412
}
1513

1614
def jarVersion = "0.2.3"
1715
group = 'io.synadia'
1816

19-
def isMerge = System.getenv("BUILD_EVENT") == "push"
2017
def isRelease = System.getenv("BUILD_EVENT") == "release"
2118

22-
// version is the variable the build actually uses.
23-
version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT"
19+
def tc = System.getenv("TARGET_COMPATIBILITY");
20+
def targetCompat = tc == "21" ? JavaVersion.VERSION_21 : (tc == "17" ? JavaVersion.VERSION_17 : JavaVersion.VERSION_1_8)
21+
def jarEnd = tc == "21" ? "-jdk21" : (tc == "17" ? "-jdk17" : "")
22+
def jarAndArtifactName = "batch-publish" + jarEnd
23+
24+
version = isRelease ? jarVersion : jarVersion + "-SNAPSHOT" // version is the variable the build actually uses.
25+
26+
System.out.println("Java: " + System.getProperty("java.version"))
27+
System.out.println("Target Compatibility: " + targetCompat)
28+
System.out.println(group + ":" + jarAndArtifactName + ":" + version)
2429

2530
java {
2631
sourceCompatibility = JavaVersion.VERSION_1_8
27-
targetCompatibility = JavaVersion.VERSION_1_8
32+
targetCompatibility = targetCompat
2833
}
2934

3035
repositories {
3136
mavenCentral()
32-
maven {
33-
url "https://repo1.maven.org/maven2/"
34-
}
35-
maven {
36-
url "https://central.sonatype.com/repository/maven-snapshots/"
37-
}
37+
maven { url="https://repo1.maven.org/maven2/" }
38+
maven { url="https://central.sonatype.com/repository/maven-snapshots/" }
3839
}
3940

4041
dependencies {
4142
implementation 'io.nats:jnats:2.24.0'
4243
implementation 'org.jspecify:jspecify:1.0.0'
4344

4445
testImplementation 'io.nats:jnats-server-runner:1.2.8'
45-
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
4646
testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1'
47-
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.12.3'
48-
}
47+
testImplementation 'nl.jqno.equalsverifier:equalsverifier:4.2.3'
4948

50-
configurations.configureEach {
51-
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
49+
testImplementation 'org.junit.jupiter:junit-jupiter:5.14.1'
50+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
5251
}
5352

5453
sourceSets {
@@ -70,14 +69,14 @@ tasks.register('bundle', Bundle) {
7069
}
7170

7271
jar {
73-
manifest {
74-
attributes('Automatic-Module-Name': 'io.synadia.batch.publish')
72+
bundle {
73+
bnd("Bundle-Name": "io.synadia.batch.publish",
74+
"Bundle-Vendor": "synadia.io",
75+
"Bundle-Description": "JetStream Distributed Counters",
76+
"Bundle-DocURL": "https://github.com/synadia-io/orbit.java/tree/main/counters",
77+
"Target-Compatibility": "Java " + targetCompat
78+
)
7579
}
76-
bnd (['Implementation-Title': 'Batch Publish',
77-
'Implementation-Version': jarVersion,
78-
'Implementation-Vendor': 'synadia.io']
79-
)
80-
exclude("io/synadia/examples/**")
8180
}
8281

8382
test {
@@ -90,21 +89,6 @@ javadoc {
9089
source = sourceSets.main.allJava
9190
title = "Synadia Communications Inc. Batch Publish"
9291
classpath = sourceSets.main.runtimeClasspath
93-
doLast {
94-
if (!OperatingSystem.current().isWindows()) {
95-
exec {
96-
println "Updating favicon on all html files"
97-
workingDir 'build/docs/javadoc'
98-
// Only on linux, mac at this point
99-
commandLine 'find', '.', '-name', '*.html', '-exec', 'sed', '-i', '-e', 's#<head>#<head><link rel="icon" type="image/ico" href="favicon.ico">#', '{}', ';'
100-
}
101-
copy {
102-
println "Copying images to javadoc folder"
103-
from 'src/main/javadoc/images'
104-
into 'build/docs/javadoc'
105-
}
106-
}
107-
}
10892
}
10993

11094
tasks.register('examplesJar', Jar) {
@@ -129,14 +113,18 @@ tasks.register('sourcesJar', Jar) {
129113
from sourceSets.main.allSource
130114
}
131115

116+
artifacts {
117+
archives javadocJar, sourcesJar, examplesJar
118+
}
119+
132120
jacoco {
133-
toolVersion = "0.8.6"
121+
toolVersion = "0.8.12"
134122
}
135123

136124
jacocoTestReport {
137125
reports {
138-
xml.enabled = true // coveralls plugin depends on xml format report
139-
html.enabled = true
126+
xml.required = true // coveralls plugin depends on xml format report
127+
html.required = true
140128
}
141129
afterEvaluate { // only report on main library not examples
142130
classDirectories.setFrom(files(classDirectories.files.collect {
@@ -146,10 +134,6 @@ jacocoTestReport {
146134
}
147135
}
148136

149-
artifacts {
150-
archives javadocJar, sourcesJar, examplesJar
151-
}
152-
153137
nexusPublishing {
154138
repositories {
155139
sonatype {
@@ -169,10 +153,10 @@ publishing {
169153
artifact examplesJar
170154
artifact javadocJar
171155
pom {
172-
name = 'batch-publish'
156+
name = jarAndArtifactName
173157
packaging = 'jar'
174158
groupId = group
175-
artifactId = archivesBaseName
159+
artifactId = jarAndArtifactName
176160
description = 'Synadia Communications Inc. Batch Publish'
177161
url = 'https://github.com/synadia-io/orbit.java'
178162
licenses {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3+
4+
[versions]
5+
commons-math3 = "3.6.1"
6+
guava = "33.4.5-jre"
7+
junit-jupiter = "5.12.1"
8+
9+
[libraries]
10+
commons-math3 = { module = "org.apache.commons:commons-math3", version.ref = "commons-math3" }
11+
guava = { module = "com.google.guava:guava", version.ref = "guava" }
12+
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
-14.6 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)