Skip to content

Commit 8e6444b

Browse files
authored
build: Add CI configuration and extend gradle tasks. (#7)
1 parent bcda085 commit 8e6444b

File tree

9 files changed

+234
-20
lines changed

9 files changed

+234
-20
lines changed

.circleci/config.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/[email protected]
5+
6+
workflows:
7+
test:
8+
jobs:
9+
- build-linux
10+
- test-linux:
11+
name: Java 8 - Linux - OpenJDK
12+
docker-image: cimg/openjdk:8.0
13+
requires:
14+
- build-linux
15+
- test-linux:
16+
name: Java 11 - Linux - OpenJDK
17+
docker-image: cimg/openjdk:11.0
18+
requires:
19+
- build-linux
20+
- test-linux:
21+
# current LTS version
22+
name: Java 17 - Linux - OpenJDK
23+
docker-image: cimg/openjdk:17.0
24+
with-coverage: true
25+
requires:
26+
- build-linux
27+
- test-linux:
28+
name: Java 19 - Linux - OpenJDK
29+
docker-image: cimg/openjdk:19.0
30+
requires:
31+
- build-linux
32+
- packaging:
33+
requires:
34+
- build-linux
35+
36+
jobs:
37+
build-linux:
38+
docker:
39+
- image: cimg/openjdk:8.0
40+
steps:
41+
- checkout
42+
- run: java -version
43+
- run: ./gradlew dependencies
44+
- run: ./gradlew jar
45+
- persist_to_workspace:
46+
root: build
47+
paths:
48+
- classes
49+
50+
test-linux:
51+
parameters:
52+
docker-image:
53+
type: string
54+
with-coverage:
55+
type: boolean
56+
default: false
57+
docker:
58+
- image: <<parameters.docker-image>>
59+
steps:
60+
- checkout
61+
- attach_workspace:
62+
at: build
63+
- run: java -version
64+
- run:
65+
name: Run tests
66+
command: ./gradlew test
67+
- run:
68+
name: Save test results
69+
command: |
70+
mkdir -p ~/junit/
71+
find . -type f -regex ".*/build/test-results/test/.*xml" -exec cp {} ~/junit/ \;
72+
when: always
73+
74+
- store_test_results:
75+
path: ~/junit
76+
- store_artifacts:
77+
path: ~/junit
78+
- store_artifacts:
79+
path: ./build/reports/jacoco/test/html
80+
destination: coverage
81+
82+
packaging:
83+
docker:
84+
- image: cimg/openjdk:8.0
85+
steps:
86+
- run: java -version
87+
- run: sudo apt-get install make -y -q
88+
- checkout
89+
- attach_workspace:
90+
at: build
91+
- run:
92+
name: checkstyle/javadoc
93+
command: ./gradlew javadoc checkstyleMain
94+
- run:
95+
name: Publish to local maven
96+
command: ./gradlew publishToMavenLocal

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,20 @@ This version of the LaunchDarkly provider works with Java 8 and above.
2020

2121
### Installation
2222

23-
TODO: Implement
23+
First, install the LaunchDarkly OpenFeature provider for the Server-Side SDK for Java as a dependency in your application using your application's dependency manager.
24+
25+
```xml
26+
<dependency>
27+
<groupId>com.launchdarkly</groupId>
28+
<artifactId>launchdarkly-openfeature-serverprovider</artifactId>
29+
<version>0.1.0</version> <!-- use current version number -->
30+
</dependency>
31+
```
32+
33+
```groovy
34+
implementation group: 'com.launchdarkly', name: 'launchdarkly-openfeature-serverprovider', version: '0.1.0'
35+
// Use current version number in place of 0.1.0.
36+
```
2437

2538
### Usage
2639

build.gradle

Lines changed: 91 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,93 @@
1-
/*
2-
* This build file was generated by the Gradle 'init' task.
3-
*
4-
* This generated file contains a sample Java Library project to get you started.
5-
* For more details take a look at the Java Libraries chapter in the Gradle
6-
* user guide available at https://docs.gradle.org/4.4.1/userguide/java_library_plugin.html
7-
*/
8-
9-
// Apply the java-library plugin to add support for Java Library
10-
apply plugin: 'java-library'
11-
12-
// In this section you declare where to find the dependencies of your project
1+
2+
plugins {
3+
id "java"
4+
id "java-library"
5+
id "checkstyle"
6+
id "jacoco"
7+
id "signing"
8+
id "com.github.johnrengelman.shadow" version "7.1.2"
9+
id "maven-publish"
10+
id "io.github.gradle-nexus.publish-plugin" version '1.2.0'
11+
id "idea"
12+
}
13+
14+
java {
15+
withJavadocJar()
16+
withSourcesJar()
17+
}
18+
1319
repositories {
14-
// Use jcenter for resolving your dependencies.
15-
// You can declare any Maven/Ivy/file repository here.
16-
jcenter()
20+
mavenLocal()
21+
mavenCentral()
22+
}
23+
24+
test {
25+
testLogging {
26+
events "passed", "skipped", "failed", "standardOut", "standardError"
27+
showStandardStreams = true
28+
exceptionFormat = 'full'
29+
}
30+
dependsOn 'cleanTest'
31+
finalizedBy jacocoTestReport // report is always generated after tests run
32+
}
33+
34+
jacocoTestReport {
35+
dependsOn test // tests are required to run before generating the report
36+
}
37+
38+
checkstyle {
39+
toolVersion = "9.3"
40+
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
41+
checkstyleTest.enabled = false
42+
}
43+
44+
publishing {
45+
publications {
46+
mavenJava(MavenPublication) { publication ->
47+
from components.java
48+
49+
artifactId = 'launchdarkly-openfeature-serverprovider'
50+
51+
pom {
52+
name = 'LaunchDarkly OpenFeature provider for the Server-Side SDK for Java'
53+
packaging = 'jar'
54+
url = 'https://github.com/launchdarkly/openfeature-java-server'
55+
56+
licenses {
57+
license {
58+
name = 'The Apache License, Version 2.0'
59+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
60+
}
61+
}
62+
63+
developers {
64+
developer {
65+
name = 'LaunchDarkly SDK Team'
66+
67+
}
68+
}
69+
70+
scm {
71+
connection = 'scm:git:git://github.com/launchdarkly/openfeature-java-server'
72+
developerConnection = 'scm:git:ssh:[email protected]:launchdarkly/openfeature-java-server.git'
73+
url = 'https://github.com/launchdarkly/openfeature-java-server'
74+
}
75+
}
76+
}
77+
}
78+
repositories {
79+
mavenLocal()
80+
}
81+
}
82+
83+
nexusPublishing {
84+
clientTimeout = java.time.Duration.ofMinutes(2) // we've seen extremely long delays in creating repositories
85+
repositories {
86+
sonatype {
87+
username = ossrhUsername
88+
password = ossrhPassword
89+
}
90+
}
1791
}
1892

1993
dependencies {
@@ -23,8 +97,8 @@ dependencies {
2397
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
2498
implementation 'com.google.guava:guava:23.0'
2599

26-
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '6.0.0'
27-
implementation 'dev.openfeature:sdk:1.2.0'
100+
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '6.+'
101+
implementation 'dev.openfeature:sdk:[1.2.0,2.0.0)'
28102

29103
// Use JUnit test framework
30104
testImplementation 'junit:junit:4.12'

config/checkstyle/checkstyle.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
<module name="Checker">
6+
<module name="JavadocPackage"/>
7+
<module name="TreeWalker">
8+
<module name="JavadocMethod">
9+
<property name="accessModifiers" value="public"/>
10+
</module>
11+
<module name="JavadocType">
12+
<property name="scope" value="public"/>
13+
</module>
14+
</module>
15+
</module>

gradle.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
group = com.launchdarkly
2+
version = 0.1.0-alpha.1
3+
signing.keyId=
4+
signing.password=
5+
signing.secretKeyRingFile=
6+
ossrhUsername=
7+
ossrhPassword=

gradle/wrapper/gradle-wrapper.jar

3.82 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ include 'api'
1515
include 'services:webservice'
1616
*/
1717

18-
rootProject.name = 'openfeature-java-server'
18+
rootProject.name = 'launchdarkly-openfeature-serverprovider'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Main package for the LaunchDarkly OpenFeature provider for the Server-Side SDK for Java, containing the provider
3+
* and configuration classes.
4+
* <p>
5+
* You will most often use {@link com.launchdarkly.openfeature.serverprovider.Provider} (the provider) and
6+
* {@link com.launchdarkly.openfeature.serverprovider.ProviderConfiguration} (configuration options for the provider).
7+
* <p>
8+
*/
9+
package com.launchdarkly.openfeature.serverprovider;

0 commit comments

Comments
 (0)