Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
db568d4
initial implementation of Java common SDK code (#1)
eli-darkly Mar 20, 2020
374e08e
stick with Java 7 for Android compatibility (#2)
eli-darkly Apr 15, 2020
f1b9cb4
add getters to EvaluationReason and hide its subclasses
eli-darkly Apr 20, 2020
e86ced3
completely remove EvaluationReason subclasses
eli-darkly Apr 20, 2020
a8d1a91
Merge pull request #3 from launchdarkly/eb/ch74282/hide-reason-subcla…
eli-darkly Apr 20, 2020
0ff060b
Merge pull request #4 from launchdarkly/eb/ch74282/remove-reason-subc…
eli-darkly Apr 20, 2020
d440fd0
add JSON helpers, better serialization logic, and Gson adapter
eli-darkly Apr 20, 2020
04eaf1a
javadoc fixes
eli-darkly Apr 21, 2020
433a1e7
remove @since tags, misc doc fixes, add note about changelogging
eli-darkly Apr 21, 2020
55e3c1b
Merge branch 'eb/ch74370/javadoc-since' into eb/ch73994/gson-interop
eli-darkly Apr 21, 2020
fe6f0eb
fix sample code
eli-darkly Apr 22, 2020
97a8fa3
rename Gson adapter, use factory method
eli-darkly Apr 22, 2020
2c5cc2b
Merge pull request #5 from launchdarkly/eb/ch74370/javadoc-since
eli-darkly Apr 22, 2020
511c9e2
improve and rigorously test equals() for all immutable types
eli-darkly Apr 24, 2020
525daa6
simplifying
eli-darkly Apr 24, 2020
3e222c3
simplifying
eli-darkly Apr 24, 2020
d003179
make EvaluationDetail non-nullable + use boolean singletons
eli-darkly Apr 24, 2020
b810cd7
hide Gson in pom
eli-darkly Apr 24, 2020
129d5b6
doc additions
eli-darkly Apr 24, 2020
0ab6d7c
Merge pull request #8 from launchdarkly/eb/ch74915/non-null-index
eli-darkly Apr 27, 2020
36d3fba
Merge pull request #6 from launchdarkly/eb/ch73994/gson-interop
eli-darkly Apr 27, 2020
939b879
Merge branch 'master' into eb/ch68094/test-equals
eli-darkly Apr 27, 2020
6136698
javadoc fixes
eli-darkly Apr 27, 2020
fa2dd6c
Merge branch 'master' into eb/ch68094/test-equals
eli-darkly Apr 27, 2020
9bd6dbb
Merge pull request #7 from launchdarkly/eb/ch68094/test-equals
eli-darkly Apr 28, 2020
5458738
add Jackson adapter (#9)
eli-darkly Apr 28, 2020
5635a1d
more predictable exception behavior for LDValue.parse()
eli-darkly Apr 28, 2020
4ac7396
Merge pull request #11 from launchdarkly/eb/ch73994/parse-exception
eli-darkly Apr 28, 2020
21e9167
fix the JSON behavior of EvaluationDetail (#10)
eli-darkly Apr 28, 2020
7c29e7b
maximize and enforce test coverage (#12)
eli-darkly Apr 28, 2020
7a2aa77
build and test in Android! (#13)
eli-darkly Apr 29, 2020
aa9f794
Merge branch 'master' of github.com:launchdarkly/java-sdk-common
eli-darkly Apr 29, 2020
d5c3b0d
ensure real nulls can't be stored in an LDValue
eli-darkly May 23, 2020
9e200fb
clean up some unnecessary coverage warnings
eli-darkly May 23, 2020
08f2b21
Merge pull request #15 from launchdarkly/eb/ch77641/null-safety
eli-darkly May 27, 2020
8fbc7a0
more convenient location for coverage reports
eli-darkly May 27, 2020
fbe209b
remove rc1 from changelog
eli-darkly Jun 1, 2020
7f83233
Merge branch 'master' of github.com:launchdarkly/java-sdk-common
eli-darkly Jun 2, 2020
ac4a2cd
Removed the guides link
bwoskow-ld Feb 3, 2021
1cad8c5
Use Android machine image for CircleCI Android tests. (#17)
gwhelanLD Mar 30, 2021
17f0b0b
improve Gson integration using reader/writer delegation + add LDValue…
eli-darkly Mar 30, 2021
96931b3
add LDValue.arrayOf() + misc javadoc fixes
eli-darkly Mar 30, 2021
99c51e9
Merge pull request #19 from launchdarkly/eb/ch104357/array-of
eli-darkly Mar 30, 2021
41058b9
Add inExperiment attribute to FALLTHROUGH and RULE_MATCH reasons
robertjneal Apr 3, 2021
0ea70c9
fix javadoc
robertjneal Apr 3, 2021
532fa70
Update src/main/java/com/launchdarkly/sdk/EvaluationReason.java
robertjneal Apr 6, 2021
7526a58
Update src/main/java/com/launchdarkly/sdk/EvaluationReason.java
robertjneal Apr 6, 2021
e3c06ec
Update src/main/java/com/launchdarkly/sdk/EvaluationReason.java
robertjneal Apr 6, 2021
0b6aef3
Update src/main/java/com/launchdarkly/sdk/EvaluationReason.java
robertjneal Apr 6, 2021
6e1b358
respond to review comments
robertjneal Apr 6, 2021
76533ce
fix test
robertjneal Apr 6, 2021
a9c82c7
Merge pull request #20 from launchdarkly/rneal/ch101658/add-inExperim…
robertjneal Apr 6, 2021
b468c4e
javadoc fix
eli-darkly Apr 8, 2021
fede11e
Merge branch 'master' into exp-alloc
eli-darkly Apr 8, 2021
a5abd08
add validation of javadoc build in CI
eli-darkly Apr 8, 2021
1e11684
add another Eclipse metadata exclusion to .gitignore
eli-darkly Apr 8, 2021
bceedef
Merge pull request #21 from launchdarkly/eb/ch105283/check-javadoc
eli-darkly Apr 8, 2021
3a8aa98
partially revert ch103941 fix that doesn't work in the Java SDK
eli-darkly Apr 14, 2021
3f02d6d
Merge pull request #22 from launchdarkly/eb/ch103941/revert-gson-adapter
eli-darkly Apr 14, 2021
7dee1cf
Merge branch 'master' into exp-alloc
eli-darkly Apr 14, 2021
36fe80f
unrevert some JSON improvements from previous revert
eli-darkly Apr 16, 2021
cfdece2
Merge pull request #23 from launchdarkly/eb/ch103941/json-partial-unr…
eli-darkly Apr 17, 2021
9d50c7e
improve Gson integration using reader/writer delegation - take 2
eli-darkly Apr 19, 2021
df89903
Merge pull request #24 from launchdarkly/eb/ch103941/gson-adapter-fix
eli-darkly Apr 21, 2021
b8ace9b
better Jackson adapter + misc JSON test improvements (#18)
eli-darkly Apr 21, 2021
cd9525e
omit redundant method call (this commit was mistakenly left out of th…
eli-darkly Apr 21, 2021
62c6988
merge from public after release
LaunchDarklyCI Apr 22, 2021
f5680a1
Merge branch 'master' of github.com:launchdarkly/java-sdk-common
eli-darkly Apr 22, 2021
08c734f
avoid unnecessarily adding ".0" to JSON numbers (#25)
eli-darkly Apr 22, 2021
3dbe3f2
merge from public after release
LaunchDarklyCI Apr 22, 2021
6a5a5f6
update Gradle to 6.8.3
eli-darkly May 5, 2021
113c27d
Merge pull request #26 from launchdarkly/eb/ch104534/gradle-update
eli-darkly May 5, 2021
b91dd33
Kotlinize main build script
eli-darkly May 5, 2021
9088dff
rm obsolete comments
eli-darkly May 5, 2021
41a846b
Merge pull request #27 from launchdarkly/eb/ch107687/gradle-kotlin
eli-darkly May 6, 2021
b5c338e
bump Jackson compile-time dependency to 2.10.5.1 due to CVE-2020-2564…
eli-darkly Jun 14, 2021
b9116a8
exclude Gson & Jackson from published dependencies in a more correct …
eli-darkly Jun 14, 2021
242a8f5
merge from public after release
LaunchDarklyCI Jun 15, 2021
6589606
Merge branch 'exp-alloc'
eli-darkly Jun 17, 2021
c69e187
merge from public after release
LaunchDarklyCI Jun 17, 2021
2a59948
refactor build scripts using buildSrc (#29)
eli-darkly Jun 29, 2021
03adb77
use Releaser v2 config format + newer CircleCI images (#33)
eli-darkly Sep 14, 2021
979d0de
Updates docs URLs
ember-stevens Sep 26, 2021
dee5dab
Merge pull request #34 from launchdarkly/emberstevens/sc-118589/url-a…
ember-stevens Sep 27, 2021
056ff10
update Gson to 2.8.9
eli-darkly Nov 30, 2021
e494dbc
Merge pull request #35 from launchdarkly/eb/sc-132830/gson-version
eli-darkly Nov 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,12 @@ workflows:
- build-linux
- test-linux:
name: Java 8 - Linux - OpenJDK
docker-image: circleci/openjdk:8
requires:
- build-linux
- test-linux:
name: Java 9 - Linux - OpenJDK
docker-image: circleci/openjdk:9
requires:
- build-linux
- test-linux:
name: Java 10 - Linux - OpenJDK
docker-image: circleci/openjdk:10
docker-image: cimg/openjdk:8.0
requires:
- build-linux
- test-linux:
name: Java 11 - Linux - OpenJDK
docker-image: circleci/openjdk:11
docker-image: cimg/openjdk:11.0
with-coverage: true
requires:
- build-linux
Expand All @@ -37,7 +27,7 @@ workflows:
jobs:
build-linux:
docker:
- image: circleci/openjdk:8u131-jdk # To match the version pre-installed in Ubuntu 16 and used by Jenkins for releasing
- image: cimg/openjdk:8.0
steps:
- checkout
- run: cp gradle.properties.example gradle.properties
Expand Down
11 changes: 8 additions & 3 deletions .ldrelease/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 2

repo:
public: java-sdk-common
private: java-sdk-common-private
Expand All @@ -8,8 +10,11 @@ publications:
- url: https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-sdk-common
description: documentation (javadoc.io)

template:
name: gradle
jobs:
- docker:
image: gradle:6.8.3-jdk11
template:
name: gradle

documentation:
githubPages: true
gitHubPages: true
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to the LaunchDarkly SDK Java Common Code

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.
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.

## Submitting bug reports and feature requests

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ See [Contributing](https://github.com/launchdarkly/dotnet-sdk-common/blob/master
* 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?).
* 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.
* 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.
* 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.
* 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.
* Explore LaunchDarkly
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
Expand Down
28 changes: 15 additions & 13 deletions build-android.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ repositories {
google()
}

apply from: 'build-shared.gradle'
allprojects {
group = ProjectValues.groupId
version = "${version}" // from gradle.properties
archivesBaseName = ProjectValues.artifactId
}

android {
compileSdkVersion 26
Expand Down Expand Up @@ -59,16 +63,14 @@ android {
}
}

dependencies {
// See note in build-shared.gradle on the purpose of "privateImplementation". The
// Android Gradle plugin doesn't seem to have a good way to customize the classpath
// of the compile and test tasks, but since we're not actually publishing any
// Android artifacts from this project (we use this build only for CI testing), we
// can simply copy the dependencies from "privateImplementation" into the standard
// "implementation" for the Android build.
implementation configurations.privateImplementation

androidTestImplementation "junit:junit:4.12"
androidTestImplementation "org.hamcrest:hamcrest-library:1.3"
androidTestImplementation "com.android.support.test:runner:1.0.2"
dependencies { // see Dependencies.kt in buildSrc
// See note in Dependencies.kt in buildSrc on the purpose of "privateImplementation".
// The Android Gradle plugin doesn't seem to have a good way to customize the classpath
// of the compile and test tasks, but since we're not actually publishing any Android
// artifacts from this project (we use this build only for CI testing), we can simply
// copy the dependencies from "privateImplementation" into the standard "implementation"
// for the Android build.
Libs.privateImplementation.each { implementation(it) }
Libs.javaTestImplementation.each { testImplementation(it) }
Libs.androidTestImplementation.each { androidTestImplementation(it) }
}
52 changes: 0 additions & 52 deletions build-shared.gradle

This file was deleted.

153 changes: 38 additions & 115 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import java.time.Duration
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.external.javadoc.CoreJavadocOptions

// These values come from gradle.properties
val ossrhUsername: String by project
Expand All @@ -13,16 +11,9 @@ buildscript {
}
}

plugins {
java
"java-library"
checkstyle
signing
"maven-publish"
idea
jacoco
id("de.marcphilipp.nexus-publish") version "0.3.0"
id("io.codearte.nexus-staging") version "0.30.0"
plugins { // see Dependencies.kt in buildSrc
Libs.javaBuiltInGradlePlugins.forEach { id(it) }
Libs.javaExtGradlePlugins.forEach { (n, v) -> id(n) version v }
}

repositories {
Expand All @@ -32,139 +23,71 @@ repositories {
mavenCentral()
}

apply { from("build-shared.gradle") }
configurations.all {
// check for updates every build for dependencies with: 'changing: true'
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}

base {
group = ProjectValues.groupId
archivesBaseName = ProjectValues.artifactId
version = version
}

java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

// See Dependencies.kt in buildSrc for the purpose of "privateImplementation"
val privateImplementation by configurations.creating

dependencies { // see Dependencies.kt in buildSrc
Libs.privateImplementation.forEach { privateImplementation(it)}
Libs.javaTestImplementation.forEach { testImplementation(it) }
}

checkstyle {
configFile = file("${project.rootDir}/checkstyle.xml")
}

tasks.compileJava {
// See note in build-shared.gradle on the purpose of "privateImplementation"
classpath = configurations["privateImplementation"]
}

tasks.javadoc.configure {
// Force the Javadoc build to fail if there are any Javadoc warnings. See: https://discuss.gradle.org/t/javadoc-fail-on-warning/18141/3
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
// for information about the -Xwerror option.
(options as CoreJavadocOptions).addStringOption("Xwerror")

// See note in build-shared.gradle on the purpose of "privateImplementation"
// See note in Dependencies.kt in buildSrc on "privateImplementation"
classpath = configurations["privateImplementation"]
}

tasks.test.configure {
testLogging {
events("passed", "skipped", "failed", "standardOut", "standardError")
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
}
}

tasks.jacocoTestReport.configure {
reports {
xml.isEnabled = true
csv.isEnabled = true
html.isEnabled = true
}
}
helpers.Javadoc.configureTask(tasks.javadoc, configurations["privateImplementation"]) // see Javadoc.kt in buildSrc

tasks.jacocoTestCoverageVerification.configure {
// See notes in CONTRIBUTING.md on code coverage. Unfortunately we can't configure line-by-line code
// coverage overrides within the source code itself, because Jacoco operates on bytecode.
violationRules {
val knownMissedLinesForMethods = mapOf(
"EvaluationReason.error(com.launchdarkly.sdk.EvaluationReason.ErrorKind)" to 1,
"EvaluationReasonTypeAdapter.parse(com.google.gson.stream.JsonReader)" to 1,
"LDValue.equals(java.lang.Object)" to 1,
"LDValueTypeAdapter.read(com.google.gson.stream.JsonReader)" to 1,
"json.JsonSerialization.getDeserializableClasses()" to -1,
"json.LDGson.LDTypeAdapter.write(com.google.gson.stream.JsonWriter, java.lang.Object)" to 1,
"json.LDJackson.GsonReaderToJacksonParserAdapter.peekInternal()" to 3
)

knownMissedLinesForMethods.forEach { (signature, maxMissedLines) ->
if (maxMissedLines > 0) { // < 0 means skip entire method
rule {
element = "METHOD"
includes = listOf("com.launchdarkly.sdk." + signature)
limit {
counter = "LINE"
value = "MISSEDCOUNT"
maximum = maxMissedLines.toBigDecimal()
}
}
}
}

// General rule that we should expect 100% test coverage; exclude any methods that have overrides above
rule {
element = "METHOD"
limit {
counter = "LINE"
value = "MISSEDCOUNT"
maximum = 0.toBigDecimal()
}
excludes = knownMissedLinesForMethods.map { (signature, maxMissedLines) ->
"com.launchdarkly.sdk." + signature }
}
}
}
helpers.Test.configureTask(tasks.compileTestJava, tasks.test,
configurations["privateImplementation"]) // see Test.kt in buildSrc

idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
helpers.Jacoco.configureTasks( // see Jacoco.kt in buildSrc
tasks.jacocoTestReport,
tasks.jacocoTestCoverageVerification
)

nexusStaging {
packageGroup = "com.launchdarkly"
numberOfRetries = 40 // we've seen extremely long delays in closing repositories
}
helpers.Idea.configure(idea)

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])

groupId = "com.launchdarkly"
artifactId = "launchdarkly-java-sdk-common"

pom {
name.set("launchdarkly-java-sdk-common")
description.set("LaunchDarkly SDK Java Common Classes")
url.set("https://github.com/launchdarkly/java-sdk-common")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
name.set("LaunchDarkly")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/launchdarkly/java-sdk-common.git")
developerConnection.set("scm:git:ssh:[email protected]:launchdarkly/java-sdk-common.git")
url.set("https://github.com/launchdarkly/java-sdk-common")
}
}
helpers.Pom.standardPom(pom) // see Pom.kt in buildSrc
}
}
repositories {
mavenLocal()
}
}

nexusStaging {
packageGroup = ProjectValues.groupId
numberOfRetries = 40 // we've seen extremely long delays in closing repositories
}

nexusPublishing {
clientTimeout.set(Duration.ofMinutes(2)) // we've seen extremely long delays in creating repositories
repositories {
Expand Down
20 changes: 20 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

// This build script controls the building of the shared Gradle code in
// buildSrc. Putting code under buildSrc allows us to break it up for better
// clarity, leaving a much simpler build script at the top level of the repo.

// For the java-sdk-common project, this also allows us to share some values
// between build.gradle.kts and build-android.gradle in a clearer way than
// the old method of including a shared build script.

// Things that are specific to this project, like dependencies, are in
// buildSrc/src/main/kotlin. Reusable helper code that isn't specific to this
// project is in buildSrc/src/main/kotlin/helpers.

plugins {
`kotlin-dsl`
}

repositories {
jcenter()
}
Loading