Skip to content

Commit 1c19b6b

Browse files
authored
Merge pull request #167 from Hc747/master
Modernise/update Gradle configuration and misc. polishing.
2 parents 229109d + 85f38c2 commit 1c19b6b

8 files changed

+140
-54
lines changed

.github/workflows/master.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ jobs:
1313
MAVEN_CENTRAL_PGP_KEY: ${{ secrets.MAVEN_CENTRAL_PGP_KEY }}
1414

1515
steps:
16-
- uses: actions/checkout@v1
17-
- uses: gradle/wrapper-validation-action@v1
16+
- uses: actions/checkout@v4
17+
- uses: gradle/actions/wrapper-validation@v3
1818
- name: Set up JDK 11
19-
uses: actions/setup-java@v1
19+
uses: actions/setup-java@v4
2020
with:
21-
java-version: '11.0.23'
21+
java-version: '11'
22+
distribution: 'temurin'
23+
check-latest: true
24+
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
25+
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@v4
2228
- name: build test and publish
2329
run: ./gradlew assemble && ./gradlew check --info && ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -x check --info --stacktrace
30+
env:
31+
CI: true

.github/workflows/pull_request.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ jobs:
1313
buildAndTest:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v1
17-
- uses: gradle/wrapper-validation-action@v1
16+
- uses: actions/checkout@v4
17+
- uses: gradle/actions/wrapper-validation@v3
1818
- name: Set up JDK 11
19-
uses: actions/setup-java@v1
19+
uses: actions/setup-java@v4
2020
with:
21-
java-version: '11.0.23'
21+
java-version: '11'
22+
distribution: 'temurin'
23+
check-latest: true
24+
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
25+
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@v4
2228
- name: build and test
2329
run: ./gradlew assemble && ./gradlew check --info --stacktrace
30+
env:
31+
CI: true

.github/workflows/release.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ jobs:
1717
RELEASE_VERSION: ${{ github.event.inputs.version }}
1818

1919
steps:
20-
- uses: actions/checkout@v1
21-
- uses: gradle/wrapper-validation-action@v1
20+
- uses: actions/checkout@v4
21+
- uses: gradle/actions/wrapper-validation@v3
2222
- name: Set up JDK 11
23-
uses: actions/setup-java@v1
23+
uses: actions/setup-java@v4
2424
with:
25-
java-version: '11.0.23'
25+
java-version: '11'
26+
distribution: 'temurin'
27+
check-latest: true
28+
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
29+
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
30+
- name: Setup Gradle
31+
uses: gradle/actions/setup-gradle@v4
2632
- name: build test and publish
2733
run: ./gradlew assemble && ./gradlew check --info && ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -x check --info --stacktrace
34+
env:
35+
CI: true

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Latest Release](https://maven-badges.herokuapp.com/maven-central/com.graphql-java/java-dataloader/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.graphql-java/java-dataloader/)
55
[![Apache licensed](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/graphql-java/java-dataloader/blob/master/LICENSE)
66

7-
This small and simple utility library is a pure Java 8 port of [Facebook DataLoader](https://github.com/facebook/dataloader).
7+
This small and simple utility library is a pure Java 11 port of [Facebook DataLoader](https://github.com/facebook/dataloader).
88

99
It can serve as integral part of your application's data layer to provide a
1010
consistent API over various back-ends and reduce message communication overhead through batching and caching.
@@ -15,7 +15,7 @@ are resolved independently and, with a true graph of objects, you may be fetchin
1515
A naive implementation of graphql data fetchers can easily lead to the dreaded "n+1" fetch problem.
1616

1717
Most of the code is ported directly from Facebook's reference implementation, with one IMPORTANT adaptation to make
18-
it work for Java 8. ([more on this below](#manual-dispatching)).
18+
it work for Java 11. ([more on this below](#manual-dispatching)).
1919

2020
Before reading on, be sure to take a short dive into the
2121
[original documentation](https://github.com/facebook/dataloader/blob/master/README.md) provided by Lee Byron (@leebyron)
@@ -774,10 +774,10 @@ This library was originally written for use within a [VertX world](http://vertx.
774774
itself. All the heavy lifting has been done by this project : [vertx-dataloader](https://github.com/engagingspaces/vertx-dataloader)
775775
including the extensive testing (which itself came from Facebook).
776776

777-
This particular port was done to reduce the dependency on Vertx and to write a pure Java 8 implementation with no dependencies and also
777+
This particular port was done to reduce the dependency on Vertx and to write a pure Java 11 implementation with no dependencies and also
778778
to use the more normative Java CompletableFuture.
779779

780-
[vertx-core](http://vertx.io/docs/vertx-core/java/) is not a lightweight library by any means so having a pure Java 8 implementation is
780+
[vertx-core](http://vertx.io/docs/vertx-core/java/) is not a lightweight library by any means so having a pure Java 11 implementation is
781781
very desirable.
782782

783783

build.gradle

+50-36
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import java.text.SimpleDateFormat
33
plugins {
44
id 'java'
55
id 'java-library'
6+
id 'jvm-test-suite'
67
id 'maven-publish'
78
id 'signing'
8-
id "biz.aQute.bnd.builder" version "6.2.0"
9-
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
9+
id 'groovy'
10+
id 'biz.aQute.bnd.builder' version '6.2.0'
11+
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
12+
id 'com.github.ben-manes.versions' version '0.51.0'
1013
}
1114

1215
java {
@@ -53,60 +56,65 @@ repositories {
5356
mavenLocal()
5457
}
5558

56-
apply plugin: 'groovy'
57-
5859
jar {
5960
manifest {
6061
attributes('Automatic-Module-Name': 'org.dataloader',
61-
'-exportcontents': 'org.dataloader.*',
62-
'-removeheaders': 'Private-Package')
62+
'-exportcontents': 'org.dataloader.*',
63+
'-removeheaders': 'Private-Package')
6364
}
6465
}
6566

66-
def slf4jVersion = '1.7.30'
67-
def reactiveStreamsVersion = '1.0.3'
68-
6967
dependencies {
70-
api 'org.slf4j:slf4j-api:' + slf4jVersion
71-
api 'org.reactivestreams:reactive-streams:' + reactiveStreamsVersion
72-
73-
testImplementation 'org.slf4j:slf4j-simple:' + slf4jVersion
74-
testImplementation 'org.awaitility:awaitility:2.0.0'
75-
testImplementation "org.hamcrest:hamcrest:2.2"
76-
testImplementation 'io.projectreactor:reactor-core:3.6.6'
77-
testImplementation 'com.github.ben-manes.caffeine:caffeine:2.9.0'
78-
testImplementation platform('org.junit:junit-bom:5.10.2')
79-
testImplementation 'org.junit.jupiter:junit-jupiter-api'
80-
testImplementation 'org.junit.jupiter:junit-jupiter-params'
81-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
82-
testImplementation 'io.projectreactor:reactor-core:3.6.6'
68+
api "org.slf4j:slf4j-api:$slf4j_version"
69+
api "org.reactivestreams:reactive-streams:$reactive_streams_version"
8370
}
8471

8572
task sourcesJar(type: Jar) {
8673
dependsOn classes
87-
classifier 'sources'
74+
archiveClassifier.set('sources')
8875
from sourceSets.main.allSource
8976
}
9077

91-
task javadocJar(type: Jar, dependsOn: javadoc) {
92-
classifier = 'javadoc'
93-
from javadoc.destinationDir
94-
}
95-
9678
javadoc {
9779
options.encoding = 'UTF-8'
9880
}
9981

82+
task javadocJar(type: Jar, dependsOn: javadoc) {
83+
archiveClassifier.set('javadoc')
84+
from javadoc.destinationDir
85+
}
86+
10087
artifacts {
10188
archives sourcesJar
10289
archives javadocJar
10390
}
10491

105-
test {
106-
testLogging {
107-
exceptionFormat = 'full'
92+
testing {
93+
suites {
94+
test {
95+
useJUnitJupiter(junit_version)
96+
dependencies {
97+
// Testing dependencies
98+
implementation platform("org.junit:junit-bom:$junit_version")
99+
implementation 'org.junit.jupiter:junit-jupiter-api'
100+
implementation 'org.junit.jupiter:junit-jupiter-params'
101+
implementation 'org.junit.jupiter:junit-jupiter-engine'
102+
implementation "org.slf4j:slf4j-simple:$slf4j_version"
103+
implementation "org.awaitility:awaitility:$awaitility_version"
104+
implementation "org.hamcrest:hamcrest:$hamcrest_version"
105+
implementation "io.projectreactor:reactor-core:$reactor_core_version"
106+
implementation "com.github.ben-manes.caffeine:caffeine:$caffeine_version"
107+
}
108+
109+
targets.configureEach {
110+
testTask.configure {
111+
testLogging {
112+
exceptionFormat = 'full'
113+
}
114+
}
115+
}
116+
}
108117
}
109-
useJUnitPlatform()
110118
}
111119

112120
publishing {
@@ -180,9 +188,15 @@ tasks.withType(PublishToMavenRepository) {
180188
dependsOn build
181189
}
182190

183-
184-
task myWrapper(type: Wrapper) {
185-
gradleVersion = '6.6.1'
186-
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
191+
def isNonStable = { String version ->
192+
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
193+
def regex = /^[0-9,.v-]+(-r)?$/
194+
return !stableKeyword && !(version ==~ regex)
187195
}
188196

197+
// https://github.com/ben-manes/gradle-versions-plugin
198+
tasks.named("dependencyUpdates").configure {
199+
rejectVersionIf {
200+
isNonStable(it.candidate.version)
201+
}
202+
}

gradle.properties

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1+
# Project-wide Gradle settings.
2+
3+
# For more details on how to configure your build environment visit
4+
# http://www.gradle.org/docs/current/userguide/build_environment.html
5+
6+
# Specifies the JVM arguments used for the daemon process.
7+
# The setting is particularly useful for tweaking memory settings.
8+
org.gradle.jvmargs=-Xmx4096m
9+
10+
# When configured, Gradle will run in parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
org.gradle.parallel=true
14+
org.gradle.caching=true
15+
16+
# Bespoke settings.
117
projectTitle = Java Dataloader
2-
projectDescription = Port of Facebook Dataloader for Java
18+
projectDescription = Port of Facebook Dataloader for Java
19+
20+
# Dependency versions.
21+
junit_version=5.11.3
22+
hamcrest_version=2.2
23+
slf4j_version=1.7.30
24+
awaitility_version=2.0.0
25+
reactor_core_version=3.6.6
26+
caffeine_version=3.1.8
27+
reactive_streams_version=1.0.3
+3-1
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-7.3.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

settings.gradle

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
id 'com.gradle.develocity' version '3.19'
3+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
4+
}
5+
6+
develocity {
7+
buildScan {
8+
final def isCI = System.getenv('CI') != null;
9+
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
10+
termsOfUseAgree = "yes"
11+
publishing.onlyIf { true }
12+
tag(isCI ? 'CI' : 'Local')
13+
uploadInBackground = !isCI
14+
}
15+
}
16+
17+
dependencyResolutionManagement {
18+
repositories {
19+
mavenCentral()
20+
}
21+
}

0 commit comments

Comments
 (0)