Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit d5e529c

Browse files
prepare 1.2.1 release (#7)
1 parent 12dea4d commit d5e529c

File tree

20 files changed

+367
-214
lines changed

20 files changed

+367
-214
lines changed

.circleci/config.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,12 @@ workflows:
1010
- build-linux
1111
- test-linux:
1212
name: Java 8 - Linux - OpenJDK
13-
docker-image: circleci/openjdk:8
14-
requires:
15-
- build-linux
16-
- test-linux:
17-
name: Java 9 - Linux - OpenJDK
18-
docker-image: circleci/openjdk:9
19-
requires:
20-
- build-linux
21-
- test-linux:
22-
name: Java 10 - Linux - OpenJDK
23-
docker-image: circleci/openjdk:10
13+
docker-image: cimg/openjdk:8.0
2414
requires:
2515
- build-linux
2616
- test-linux:
2717
name: Java 11 - Linux - OpenJDK
28-
docker-image: circleci/openjdk:11
18+
docker-image: cimg/openjdk:11.0
2919
with-coverage: true
3020
requires:
3121
- build-linux
@@ -37,7 +27,7 @@ workflows:
3727
jobs:
3828
build-linux:
3929
docker:
40-
- image: circleci/openjdk:8u131-jdk # To match the version pre-installed in Ubuntu 16 and used by Jenkins for releasing
30+
- image: cimg/openjdk:8.0
4131
steps:
4232
- checkout
4333
- run: cp gradle.properties.example gradle.properties

.ldrelease/config.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: 2
2+
13
repo:
24
public: java-sdk-common
35
private: java-sdk-common-private
@@ -8,8 +10,11 @@ publications:
810
- url: https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-sdk-common
911
description: documentation (javadoc.io)
1012

11-
template:
12-
name: gradle
13+
jobs:
14+
- docker:
15+
image: gradle:6.8.3-jdk11
16+
template:
17+
name: gradle
1318

1419
documentation:
15-
githubPages: true
20+
gitHubPages: true

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to the LaunchDarkly SDK Java Common Code
22

3-
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this project.
3+
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this project.
44

55
## Submitting bug reports and feature requests
66

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ See [Contributing](https://github.com/launchdarkly/dotnet-sdk-common/blob/master
2020
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
2121
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
2222
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
23-
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list.
23+
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
2424
* Explore LaunchDarkly
2525
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
2626
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides

build-android.gradle

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ repositories {
2424
google()
2525
}
2626

27-
apply from: 'build-shared.gradle'
27+
allprojects {
28+
group = ProjectValues.groupId
29+
version = "${version}" // from gradle.properties
30+
archivesBaseName = ProjectValues.artifactId
31+
}
2832

2933
android {
3034
compileSdkVersion 26
@@ -59,16 +63,14 @@ android {
5963
}
6064
}
6165

62-
dependencies {
63-
// See note in build-shared.gradle on the purpose of "privateImplementation". The
64-
// Android Gradle plugin doesn't seem to have a good way to customize the classpath
65-
// of the compile and test tasks, but since we're not actually publishing any
66-
// Android artifacts from this project (we use this build only for CI testing), we
67-
// can simply copy the dependencies from "privateImplementation" into the standard
68-
// "implementation" for the Android build.
69-
implementation configurations.privateImplementation
70-
71-
androidTestImplementation "junit:junit:4.12"
72-
androidTestImplementation "org.hamcrest:hamcrest-library:1.3"
73-
androidTestImplementation "com.android.support.test:runner:1.0.2"
66+
dependencies { // see Dependencies.kt in buildSrc
67+
// See note in Dependencies.kt in buildSrc on the purpose of "privateImplementation".
68+
// The Android Gradle plugin doesn't seem to have a good way to customize the classpath
69+
// of the compile and test tasks, but since we're not actually publishing any Android
70+
// artifacts from this project (we use this build only for CI testing), we can simply
71+
// copy the dependencies from "privateImplementation" into the standard "implementation"
72+
// for the Android build.
73+
Libs.privateImplementation.each { implementation(it) }
74+
Libs.javaTestImplementation.each { testImplementation(it) }
75+
Libs.androidTestImplementation.each { androidTestImplementation(it) }
7476
}

build-shared.gradle

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

build.gradle.kts

Lines changed: 38 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import java.time.Duration
2-
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
3-
import org.gradle.external.javadoc.CoreJavadocOptions
42

53
// These values come from gradle.properties
64
val ossrhUsername: String by project
@@ -13,16 +11,9 @@ buildscript {
1311
}
1412
}
1513

16-
plugins {
17-
java
18-
"java-library"
19-
checkstyle
20-
signing
21-
"maven-publish"
22-
idea
23-
jacoco
24-
id("de.marcphilipp.nexus-publish") version "0.3.0"
25-
id("io.codearte.nexus-staging") version "0.30.0"
14+
plugins { // see Dependencies.kt in buildSrc
15+
Libs.javaBuiltInGradlePlugins.forEach { id(it) }
16+
Libs.javaExtGradlePlugins.forEach { (n, v) -> id(n) version v }
2617
}
2718

2819
repositories {
@@ -32,139 +23,71 @@ repositories {
3223
mavenCentral()
3324
}
3425

35-
apply { from("build-shared.gradle") }
26+
configurations.all {
27+
// check for updates every build for dependencies with: 'changing: true'
28+
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
29+
}
30+
31+
base {
32+
group = ProjectValues.groupId
33+
archivesBaseName = ProjectValues.artifactId
34+
version = version
35+
}
3636

3737
java {
3838
withJavadocJar()
3939
withSourcesJar()
40+
sourceCompatibility = JavaVersion.VERSION_1_7
41+
targetCompatibility = JavaVersion.VERSION_1_7
42+
}
43+
44+
// See Dependencies.kt in buildSrc for the purpose of "privateImplementation"
45+
val privateImplementation by configurations.creating
46+
47+
dependencies { // see Dependencies.kt in buildSrc
48+
Libs.privateImplementation.forEach { privateImplementation(it)}
49+
Libs.javaTestImplementation.forEach { testImplementation(it) }
4050
}
4151

4252
checkstyle {
4353
configFile = file("${project.rootDir}/checkstyle.xml")
4454
}
4555

4656
tasks.compileJava {
47-
// See note in build-shared.gradle on the purpose of "privateImplementation"
48-
classpath = configurations["privateImplementation"]
49-
}
50-
51-
tasks.javadoc.configure {
52-
// Force the Javadoc build to fail if there are any Javadoc warnings. See: https://discuss.gradle.org/t/javadoc-fail-on-warning/18141/3
53-
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
54-
// for information about the -Xwerror option.
55-
(options as CoreJavadocOptions).addStringOption("Xwerror")
56-
57-
// See note in build-shared.gradle on the purpose of "privateImplementation"
57+
// See note in Dependencies.kt in buildSrc on "privateImplementation"
5858
classpath = configurations["privateImplementation"]
5959
}
6060

61-
tasks.test.configure {
62-
testLogging {
63-
events("passed", "skipped", "failed", "standardOut", "standardError")
64-
showStandardStreams = true
65-
exceptionFormat = TestExceptionFormat.FULL
66-
}
67-
}
68-
69-
tasks.jacocoTestReport.configure {
70-
reports {
71-
xml.isEnabled = true
72-
csv.isEnabled = true
73-
html.isEnabled = true
74-
}
75-
}
61+
helpers.Javadoc.configureTask(tasks.javadoc, configurations["privateImplementation"]) // see Javadoc.kt in buildSrc
7662

77-
tasks.jacocoTestCoverageVerification.configure {
78-
// See notes in CONTRIBUTING.md on code coverage. Unfortunately we can't configure line-by-line code
79-
// coverage overrides within the source code itself, because Jacoco operates on bytecode.
80-
violationRules {
81-
val knownMissedLinesForMethods = mapOf(
82-
"EvaluationReason.error(com.launchdarkly.sdk.EvaluationReason.ErrorKind)" to 1,
83-
"EvaluationReasonTypeAdapter.parse(com.google.gson.stream.JsonReader)" to 1,
84-
"LDValue.equals(java.lang.Object)" to 1,
85-
"LDValueTypeAdapter.read(com.google.gson.stream.JsonReader)" to 1,
86-
"json.JsonSerialization.getDeserializableClasses()" to -1,
87-
"json.LDGson.LDTypeAdapter.write(com.google.gson.stream.JsonWriter, java.lang.Object)" to 1,
88-
"json.LDJackson.GsonReaderToJacksonParserAdapter.peekInternal()" to 3
89-
)
90-
91-
knownMissedLinesForMethods.forEach { (signature, maxMissedLines) ->
92-
if (maxMissedLines > 0) { // < 0 means skip entire method
93-
rule {
94-
element = "METHOD"
95-
includes = listOf("com.launchdarkly.sdk." + signature)
96-
limit {
97-
counter = "LINE"
98-
value = "MISSEDCOUNT"
99-
maximum = maxMissedLines.toBigDecimal()
100-
}
101-
}
102-
}
103-
}
104-
105-
// General rule that we should expect 100% test coverage; exclude any methods that have overrides above
106-
rule {
107-
element = "METHOD"
108-
limit {
109-
counter = "LINE"
110-
value = "MISSEDCOUNT"
111-
maximum = 0.toBigDecimal()
112-
}
113-
excludes = knownMissedLinesForMethods.map { (signature, maxMissedLines) ->
114-
"com.launchdarkly.sdk." + signature }
115-
}
116-
}
117-
}
63+
helpers.Test.configureTask(tasks.compileTestJava, tasks.test,
64+
configurations["privateImplementation"]) // see Test.kt in buildSrc
11865

119-
idea {
120-
module {
121-
isDownloadJavadoc = true
122-
isDownloadSources = true
123-
}
124-
}
66+
helpers.Jacoco.configureTasks( // see Jacoco.kt in buildSrc
67+
tasks.jacocoTestReport,
68+
tasks.jacocoTestCoverageVerification
69+
)
12570

126-
nexusStaging {
127-
packageGroup = "com.launchdarkly"
128-
numberOfRetries = 40 // we've seen extremely long delays in closing repositories
129-
}
71+
helpers.Idea.configure(idea)
13072

13173
publishing {
13274
publications {
13375
create<MavenPublication>("mavenJava") {
13476
from(components["java"])
13577

136-
groupId = "com.launchdarkly"
137-
artifactId = "launchdarkly-java-sdk-common"
138-
139-
pom {
140-
name.set("launchdarkly-java-sdk-common")
141-
description.set("LaunchDarkly SDK Java Common Classes")
142-
url.set("https://github.com/launchdarkly/java-sdk-common")
143-
licenses {
144-
license {
145-
name.set("The Apache License, Version 2.0")
146-
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
147-
}
148-
}
149-
developers {
150-
developer {
151-
name.set("LaunchDarkly")
152-
email.set("[email protected]")
153-
}
154-
}
155-
scm {
156-
connection.set("scm:git:git://github.com/launchdarkly/java-sdk-common.git")
157-
developerConnection.set("scm:git:ssh:[email protected]:launchdarkly/java-sdk-common.git")
158-
url.set("https://github.com/launchdarkly/java-sdk-common")
159-
}
160-
}
78+
helpers.Pom.standardPom(pom) // see Pom.kt in buildSrc
16179
}
16280
}
16381
repositories {
16482
mavenLocal()
16583
}
16684
}
16785

86+
nexusStaging {
87+
packageGroup = ProjectValues.groupId
88+
numberOfRetries = 40 // we've seen extremely long delays in closing repositories
89+
}
90+
16891
nexusPublishing {
16992
clientTimeout.set(Duration.ofMinutes(2)) // we've seen extremely long delays in creating repositories
17093
repositories {

buildSrc/build.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
// This build script controls the building of the shared Gradle code in
3+
// buildSrc. Putting code under buildSrc allows us to break it up for better
4+
// clarity, leaving a much simpler build script at the top level of the repo.
5+
6+
// For the java-sdk-common project, this also allows us to share some values
7+
// between build.gradle.kts and build-android.gradle in a clearer way than
8+
// the old method of including a shared build script.
9+
10+
// Things that are specific to this project, like dependencies, are in
11+
// buildSrc/src/main/kotlin. Reusable helper code that isn't specific to this
12+
// project is in buildSrc/src/main/kotlin/helpers.
13+
14+
plugins {
15+
`kotlin-dsl`
16+
}
17+
18+
repositories {
19+
jcenter()
20+
}

0 commit comments

Comments
 (0)