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

Commit 80ce491

Browse files
prepare 5.6.7 release (#256)
1 parent 7fab163 commit 80ce491

23 files changed

+241
-122
lines changed

.circleci/config.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ workflows:
1717
docker-image: cimg/openjdk:11.0
1818
requires:
1919
- build-linux
20+
- test-linux:
21+
name: Java 17 - Linux - OpenJDK
22+
docker-image: cimg/openjdk:17.0
23+
with-coverage: true
24+
requires:
25+
- build-linux
2026
- packaging:
2127
requires:
2228
- build-linux
@@ -25,6 +31,10 @@ workflows:
2531
- build-linux
2632
- build-test-windows:
2733
name: Java 11 - Windows - OpenJDK
34+
openjdk-version: 11.0.2.01
35+
- build-test-windows:
36+
name: Java 17 - Windows - OpenJDK
37+
openjdk-version: 17.0.1
2838

2939
jobs:
3040
build-linux:
@@ -85,6 +95,9 @@ jobs:
8595
path: coverage
8696

8797
build-test-windows:
98+
parameters:
99+
openjdk-version:
100+
type: string
88101
executor:
89102
name: win/vs2019
90103
shell: powershell.exe
@@ -94,8 +107,8 @@ jobs:
94107
name: install OpenJDK
95108
command: |
96109
$ProgressPreference = "SilentlyContinue" # prevents console errors from CircleCI host
97-
iwr -outf openjdk.msi https://developers.redhat.com/download-manager/file/java-11-openjdk-11.0.5.10-2.windows.redhat.x86_64.msi
98-
Start-Process msiexec.exe -Wait -ArgumentList '/I openjdk.msi /quiet'
110+
choco install openjdk --version <<parameters.openjdk-version>> --allow-downgrade
111+
- run: java -version
99112
- run:
100113
name: build and test
101114
command: |

benchmarks/build.gradle

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
buildscript {
33
repositories {
4-
jcenter()
54
mavenCentral()
65
}
76
}
@@ -21,15 +20,19 @@ ext.versions = [
2120
]
2221

2322
dependencies {
24-
compile files("lib/launchdarkly-java-server-sdk-all.jar")
25-
compile files("lib/launchdarkly-java-server-sdk-test.jar")
26-
compile "com.google.code.gson:gson:2.8.9"
27-
compile "com.google.guava:guava:${versions.guava}" // required by SDK test code
28-
compile "com.squareup.okhttp3:mockwebserver:3.12.10"
29-
compile "org.openjdk.jmh:jmh-core:1.21"
30-
compile "org.openjdk.jmh:jmh-generator-annprocess:${versions.jmh}"
23+
implementation files("lib/launchdarkly-java-server-sdk-all.jar")
24+
implementation files("lib/launchdarkly-java-server-sdk-test.jar")
25+
implementation "com.google.code.gson:gson:2.8.9"
26+
implementation "com.google.guava:guava:${versions.guava}" // required by SDK test code
27+
implementation "com.squareup.okhttp3:mockwebserver:3.12.10"
28+
implementation "org.openjdk.jmh:jmh-core:1.21"
29+
implementation "org.openjdk.jmh:jmh-generator-annprocess:${versions.jmh}"
3130
}
3231

32+
// need to set duplicatesStrategy because otherwise some non-class files with
33+
// duplicate names in our dependencies will cause an error
34+
tasks.getByName('jmhJar').doFirst() {duplicatesStrategy(DuplicatesStrategy.EXCLUDE)}
35+
3336
jmh {
3437
iterations = 10 // Number of measurement iterations to do.
3538
benchmarkMode = ['avgt'] // "average time" - reports execution time as ns/op and allocations as B/op.

build.gradle

+6-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plugins {
1919
id "checkstyle"
2020
id "jacoco"
2121
id "signing"
22-
id "com.github.johnrengelman.shadow" version "5.2.0"
22+
id "com.github.johnrengelman.shadow" version "7.1.2"
2323
id "maven-publish"
2424
id "de.marcphilipp.nexus-publish" version "0.3.0"
2525
id "io.codearte.nexus-staging" version "0.21.2"
@@ -72,7 +72,7 @@ ext.versions = [
7272
"gson": "2.8.9",
7373
"guava": "30.1-jre",
7474
"jackson": "2.11.2",
75-
"launchdarklyJavaSdkCommon": "1.2.1",
75+
"launchdarklyJavaSdkCommon": "1.2.2",
7676
"okhttp": "4.8.1", // specify this for the SDK build instead of relying on the transitive dependency from okhttp-eventsource
7777
"okhttpEventsource": "2.3.2",
7878
"slf4j": "1.7.21",
@@ -196,7 +196,6 @@ dependencies {
196196

197197
checkstyle {
198198
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
199-
configDir file("${project.rootDir}/config/checkstyle")
200199
}
201200

202201
task generateJava(type: Copy) {
@@ -224,7 +223,7 @@ jar {
224223
// configuration phase; this is necessary because it accesses the build products
225224
doFirst {
226225
// In OSGi, the "thin" jar has to import all of its dependencies.
227-
addOsgiManifest(project.tasks.jar, [ configurations.runtime ], [])
226+
addOsgiManifest(project.tasks.jar, [ configurations.runtimeClasspath ], [])
228227
}
229228
}
230229

@@ -534,9 +533,9 @@ test {
534533

535534
jacocoTestReport { // code coverage report
536535
reports {
537-
xml.enabled
538-
csv.enabled true
539-
html.enabled true
536+
xml.required = true
537+
csv.required = true
538+
html.required = true
540539
}
541540
}
542541

gradle/wrapper/gradle-wrapper.jar

508 Bytes
Binary file not shown.
+1-1
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-6.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

+4-18
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
5454
set JAVA_HOME=%JAVA_HOME:"=%
5555
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,28 +64,14 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

8570
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8671

72+
8773
@rem Execute Gradle
88-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
8975

9076
:end
9177
@rem End local scope for the variables with windows NT shell

packaging-test/test-app/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
buildscript {
33
repositories {
4-
jcenter()
54
mavenCentral()
65
}
76
}

src/main/java/com/launchdarkly/sdk/server/DefaultEventProcessor.java

+12-7
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,18 @@ private void processEvent(Event e, SimpleLRUCache<String, String> userKeys, Even
401401
if (!addFullEvent || !eventsConfig.inlineUsersInEvents) {
402402
LDUser user = e.getUser();
403403
if (user != null && user.getKey() != null) {
404-
boolean isIndexEvent = e instanceof Event.Identify;
405-
String key = user.getKey();
406-
// Add to the set of users we've noticed
407-
boolean alreadySeen = (userKeys.put(key, key) != null);
408-
addIndexEvent = !isIndexEvent & !alreadySeen;
409-
if (!isIndexEvent & alreadySeen) {
410-
deduplicatedUsers++;
404+
if (e instanceof Event.FeatureRequest || e instanceof Event.Custom) {
405+
String key = user.getKey();
406+
// Add to the set of users we've noticed
407+
boolean alreadySeen = (userKeys.put(key, key) != null);
408+
if (alreadySeen) {
409+
deduplicatedUsers++;
410+
} else {
411+
addIndexEvent = true;
412+
}
413+
} else if (e instanceof Event.Identify) {
414+
String key = user.getKey();
415+
userKeys.put(key, key); // just mark that we've seen it
411416
}
412417
}
413418
}

src/main/java/com/launchdarkly/sdk/server/EvaluatorOperators.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import com.launchdarkly.sdk.LDValue;
44

5-
import java.time.ZonedDateTime;
5+
import java.time.Instant;
66
import java.util.regex.Pattern;
77

88
import static com.launchdarkly.sdk.server.EvaluatorTypeConversion.valueToDateTime;
@@ -120,11 +120,11 @@ private static boolean compareDate(
120120
) {
121121
// If preprocessed is non-null, it means we've already tried to parse the clause value as a date/time,
122122
// in which case if preprocessed.parsedDate is null it was not a valid date/time.
123-
ZonedDateTime clauseDate = preprocessed == null ? valueToDateTime(clauseValue) : preprocessed.parsedDate;
123+
Instant clauseDate = preprocessed == null ? valueToDateTime(clauseValue) : preprocessed.parsedDate;
124124
if (clauseDate == null) {
125125
return false;
126126
}
127-
ZonedDateTime userDate = valueToDateTime(userValue);
127+
Instant userDate = valueToDateTime(userValue);
128128
if (userDate == null) {
129129
return false;
130130
}

src/main/java/com/launchdarkly/sdk/server/EvaluatorPreprocessing.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import com.launchdarkly.sdk.server.DataModel.Segment;
1212
import com.launchdarkly.sdk.server.DataModel.SegmentRule;
1313

14-
import java.time.ZonedDateTime;
14+
import java.time.Instant;
1515
import java.util.ArrayList;
1616
import java.util.List;
1717
import java.util.Set;
@@ -40,11 +40,11 @@ static final class ClauseExtra {
4040
}
4141

4242
static final class ValueExtra {
43-
final ZonedDateTime parsedDate;
43+
final Instant parsedDate;
4444
final Pattern parsedRegex;
4545
final SemanticVersion parsedSemVer;
4646

47-
ValueExtra(ZonedDateTime parsedDate, Pattern parsedRegex, SemanticVersion parsedSemVer) {
47+
ValueExtra(Instant parsedDate, Pattern parsedRegex, SemanticVersion parsedSemVer) {
4848
this.parsedDate = parsedDate;
4949
this.parsedRegex = parsedRegex;
5050
this.parsedSemVer = parsedSemVer;

src/main/java/com/launchdarkly/sdk/server/EvaluatorTypeConversion.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
import com.launchdarkly.sdk.LDValue;
44

55
import java.time.Instant;
6-
import java.time.ZoneOffset;
76
import java.time.ZonedDateTime;
87
import java.util.regex.Pattern;
98
import java.util.regex.PatternSyntaxException;
109

1110
abstract class EvaluatorTypeConversion {
1211
private EvaluatorTypeConversion() {}
1312

14-
static ZonedDateTime valueToDateTime(LDValue value) {
13+
static Instant valueToDateTime(LDValue value) {
1514
if (value.isNumber()) {
16-
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(value.longValue()), ZoneOffset.UTC);
15+
return Instant.ofEpochMilli(value.longValue());
1716
} else if (value.isString()) {
1817
try {
19-
return ZonedDateTime.parse(value.stringValue());
18+
return ZonedDateTime.parse(value.stringValue()).toInstant();
2019
} catch (Throwable t) {
2120
return null;
2221
}

src/main/java/com/launchdarkly/sdk/server/EventFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Event.AliasEvent newAliasEvent(LDUser user, LDUser previousUser) {
206206
}
207207
}
208208

209-
private static boolean isExperiment(DataModel.FeatureFlag flag, EvaluationReason reason) {
209+
static boolean isExperiment(DataModel.FeatureFlag flag, EvaluationReason reason) {
210210
if (reason == null) {
211211
// doesn't happen in real life, but possible in testing
212212
return false;

0 commit comments

Comments
 (0)