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

Commit 0e95b1a

Browse files
prepare 4.12.1 release (#188)
1 parent c65f94a commit 0e95b1a

File tree

16 files changed

+353
-164
lines changed

16 files changed

+353
-164
lines changed

.ldrelease/publish-docs.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ue
4+
5+
# Publish to Github Pages
6+
echo "Publishing to Github Pages"
7+
./gradlew gitPublishPush

.ldrelease/publish.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ue
4+
5+
# Publish to Sonatype
6+
echo "Publishing to Sonatype"
7+
./gradlew publishToSonatype closeAndReleaseRepository || { echo "Gradle publish/release failed" >&2; exit 1; }

build.gradle

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
apply plugin: 'java'
2-
apply plugin: 'checkstyle'
3-
apply plugin: 'maven-publish'
4-
apply plugin: 'org.ajoberstar.github-pages'
5-
apply plugin: 'signing'
6-
apply plugin: 'idea'
7-
apply plugin: 'com.github.johnrengelman.shadow'
8-
apply plugin: 'io.codearte.nexus-staging'
91

10-
configurations.all {
11-
// check for updates every build for dependencies with: 'changing: true'
12-
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
2+
buildscript {
3+
repositories {
4+
mavenCentral()
5+
mavenLocal()
6+
}
7+
dependencies {
8+
classpath "org.eclipse.virgo.util:org.eclipse.virgo.util.osgi.manifest:3.5.0.RELEASE"
9+
classpath "org.osgi:osgi_R4_core:1.0"
10+
}
11+
}
12+
13+
plugins {
14+
id "java"
15+
id "java-library"
16+
id "checkstyle"
17+
id "signing"
18+
id "com.github.johnrengelman.shadow" version "4.0.4"
19+
id "maven-publish"
20+
id "de.marcphilipp.nexus-publish" version "0.3.0"
21+
id "io.codearte.nexus-staging" version "0.21.2"
22+
id "org.ajoberstar.git-publish" version "2.1.3"
23+
id "idea"
1324
}
1425

1526
repositories {
@@ -19,6 +30,11 @@ repositories {
1930
mavenCentral()
2031
}
2132

33+
configurations.all {
34+
// check for updates every build for dependencies with: 'changing: true'
35+
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
36+
}
37+
2238
allprojects {
2339
group = 'com.launchdarkly'
2440
version = "${version}"
@@ -44,7 +60,7 @@ libraries.internal = [
4460
"commons-codec:commons-codec:1.10",
4561
"com.google.guava:guava:19.0",
4662
"joda-time:joda-time:2.9.3",
47-
"com.launchdarkly:okhttp-eventsource:1.10.0",
63+
"com.launchdarkly:okhttp-eventsource:1.10.2",
4864
"org.yaml:snakeyaml:1.19",
4965
"redis.clients:jedis:2.9.0"
5066
]
@@ -58,7 +74,8 @@ libraries.external = [
5874

5975
// Add dependencies to "libraries.test" that are used only in unit tests.
6076
libraries.test = [
61-
"com.squareup.okhttp3:mockwebserver:3.10.0",
77+
"com.squareup.okhttp3:mockwebserver:3.12.10",
78+
"com.squareup.okhttp3:okhttp-tls:3.12.10",
6279
"org.hamcrest:hamcrest-all:1.3",
6380
"org.easymock:easymock:3.4",
6481
"junit:junit:4.12",
@@ -80,21 +97,6 @@ task wrapper(type: Wrapper) {
8097
gradleVersion = '4.10.2'
8198
}
8299

83-
buildscript {
84-
repositories {
85-
jcenter()
86-
mavenCentral()
87-
mavenLocal()
88-
}
89-
dependencies {
90-
classpath 'org.ajoberstar:gradle-git:1.5.0-rc.1'
91-
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
92-
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.8.0"
93-
classpath "org.eclipse.virgo.util:org.eclipse.virgo.util.osgi.manifest:3.5.0.RELEASE"
94-
classpath "org.osgi:osgi_R4_core:1.0"
95-
}
96-
}
97-
98100
checkstyle {
99101
configFile file("${project.rootDir}/checkstyle.xml")
100102
}
@@ -188,17 +190,6 @@ if (JavaVersion.current().isJava8Compatible()) {
188190
}
189191
}
190192

191-
githubPages {
192-
repoUri = 'https://github.com/launchdarkly/java-server-sdk.git'
193-
pages {
194-
from javadoc
195-
}
196-
credentials {
197-
username = githubUser
198-
password = githubPassword
199-
}
200-
}
201-
202193
// Returns the names of all Java packages defined in this library - not including
203194
// enclosing packages like "com" that don't have any classes in them.
204195
def getAllSdkPackages() {
@@ -341,6 +332,7 @@ idea {
341332

342333
nexusStaging {
343334
packageGroup = "com.launchdarkly"
335+
numberOfRetries = 40 // we've seen extremely long delays in closing repositories
344336
}
345337

346338
def pomConfig = {
@@ -405,14 +397,15 @@ publishing {
405397
}
406398
repositories {
407399
mavenLocal()
408-
maven {
409-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
410-
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
411-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
412-
credentials {
413-
username ossrhUsername
414-
password ossrhPassword
415-
}
400+
}
401+
}
402+
403+
nexusPublishing {
404+
clientTimeout = java.time.Duration.ofMinutes(2) // we've seen extremely long delays in creating repositories
405+
repositories {
406+
sonatype {
407+
username = ossrhUsername
408+
password = ossrhPassword
416409
}
417410
}
418411
}
@@ -431,3 +424,12 @@ task exportDependencies(type: Copy, dependsOn: compileJava) {
431424
into "packaging-test/temp/dependencies-all"
432425
from configurations.runtime.resolvedConfiguration.resolvedArtifacts.collect { it.file }
433426
}
427+
428+
gitPublish {
429+
repoUri = '[email protected]:launchdarkly/java-server-sdk.git'
430+
branch = 'gh-pages'
431+
contents {
432+
from javadoc
433+
}
434+
commitMessage = 'publishing javadocs'
435+
}

src/main/java/com/launchdarkly/client/Clause.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.slf4j.Logger;
77
import org.slf4j.LoggerFactory;
88

9+
import java.util.Collection;
910
import java.util.List;
1011

1112
import static com.launchdarkly.client.VersionedDataKind.SEGMENTS;
@@ -28,6 +29,22 @@ public Clause(String attribute, Operator op, List<LDValue> values, boolean negat
2829
this.negate = negate;
2930
}
3031

32+
String getAttribute() {
33+
return attribute;
34+
}
35+
36+
Operator getOp() {
37+
return op;
38+
}
39+
40+
Collection<LDValue> getValues() {
41+
return values;
42+
}
43+
44+
boolean isNegate() {
45+
return negate;
46+
}
47+
3148
boolean matchesUserNoSegments(LDUser user) {
3249
LDValue userValue = user.getValueForEvaluation(attribute);
3350
if (userValue.isNull()) {

src/main/java/com/launchdarkly/client/FeatureFlag.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ private EvaluationDetail<LDValue> evaluate(LDUser user, FeatureStore featureStor
8383
// Check to see if targets match
8484
if (targets != null) {
8585
for (Target target: targets) {
86-
for (String v : target.getValues()) {
87-
if (v.equals(user.getKey().stringValue())) {
88-
return getVariation(target.getVariation(), EvaluationReason.targetMatch());
89-
}
86+
if (target.getValues().contains(user.getKey().stringValue())) {
87+
return getVariation(target.getVariation(), EvaluationReason.targetMatch());
9088
}
9189
}
9290
}

0 commit comments

Comments
 (0)