11import aQute.bnd.gradle.Bundle
2- import org.gradle.internal.os.OperatingSystem
32
43plugins {
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
1614def jarVersion = " 0.2.3"
1715group = ' io.synadia'
1816
19- def isMerge = System . getenv(" BUILD_EVENT" ) == " push"
2017def 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
2530java {
2631 sourceCompatibility = JavaVersion . VERSION_1_8
27- targetCompatibility = JavaVersion . VERSION_1_8
32+ targetCompatibility = targetCompat
2833}
2934
3035repositories {
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
4041dependencies {
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
5453sourceSets {
@@ -70,14 +69,14 @@ tasks.register('bundle', Bundle) {
7069}
7170
7271jar {
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
8382test {
@@ -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
11094tasks. 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+
132120jacoco {
133- toolVersion = " 0.8.6 "
121+ toolVersion = " 0.8.12 "
134122}
135123
136124jacocoTestReport {
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-
153137nexusPublishing {
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 {
0 commit comments