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

Commit 6433c20

Browse files
authored
Merge pull request #94 from launchdarkly/dr/2.2.4
2.2.4
2 parents a72f4d0 + eb37aee commit 6433c20

File tree

9 files changed

+75
-24
lines changed

9 files changed

+75
-24
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@
1313
.gradle/
1414
build/
1515
bin/
16-
gradle.properties
1716

1817
classes/

build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ apply plugin: 'org.ajoberstar.github-pages'
44
apply plugin: 'signing'
55
apply plugin: 'idea'
66
apply plugin: 'com.github.johnrengelman.shadow'
7+
apply plugin: 'io.codearte.nexus-staging'
78

89
configurations.all {
910
// check for updates every build for dependencies with: 'changing: true'
@@ -19,7 +20,7 @@ repositories {
1920

2021
allprojects {
2122
group = 'com.launchdarkly'
22-
version = "2.2.3"
23+
version = "{$version}"
2324
sourceCompatibility = 1.7
2425
targetCompatibility = 1.7
2526
}
@@ -60,6 +61,7 @@ buildscript {
6061
dependencies {
6162
classpath 'org.ajoberstar:gradle-git:1.5.0-rc.1'
6263
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
64+
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.8.0"
6365
}
6466
}
6567

@@ -186,6 +188,10 @@ idea {
186188
}
187189
}
188190

191+
nexusStaging {
192+
packageGroup = "com.launchdarkly"
193+
}
194+
189195
uploadArchives {
190196
repositories {
191197
mavenDeployer {

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version=2.2.3
2+
ossrhUsername=
3+
ossrhPassword=

scripts/release.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
# This script updates the version for the java-client library and releases the artifact + javadoc
3+
# It will only work if you have the proper credentials set up in ~/.gradle/gradle.properties
4+
5+
# It takes exactly one argument: the new version.
6+
# It should be run from the root of this git repo like this:
7+
# ./scripts/release.sh 4.0.9
8+
9+
# When done you should commit and push the changes made.
10+
11+
set -uxe
12+
echo "Starting java-client release."
13+
14+
VERSION=$1
15+
16+
#Update version in gradle.properties file:
17+
sed -i '' "s/^version.*$/version=${VERSION}/" gradle.properties
18+
./gradlew clean test install sourcesJar javadocJar uploadArchives closeAndReleaseRepository
19+
./gradlew publishGhPages
20+
echo "Finished java-client release."

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ class FeatureFlag {
1616
private static final Type mapType = new TypeToken<Map<String, FeatureFlag>>() {
1717
}.getType();
1818

19-
private final String key;
20-
private final int version;
21-
private final boolean on;
22-
private final List<Prerequisite> prerequisites;
23-
private final String salt;
24-
private final List<Target> targets;
25-
private final List<Rule> rules;
26-
private final VariationOrRollout fallthrough;
27-
private final Integer offVariation; //optional
28-
private final List<JsonElement> variations;
29-
private final boolean deleted;
19+
private String key;
20+
private int version;
21+
private boolean on;
22+
private List<Prerequisite> prerequisites;
23+
private String salt;
24+
private List<Target> targets;
25+
private List<Rule> rules;
26+
private VariationOrRollout fallthrough;
27+
private Integer offVariation; //optional
28+
private List<JsonElement> variations;
29+
private boolean deleted;
3030

3131
static FeatureFlag fromJson(String json) {
3232
return LDConfig.gson.fromJson(json, FeatureFlag.class);
@@ -36,6 +36,9 @@ static Map<String, FeatureFlag> fromJsonMap(String json) {
3636
return LDConfig.gson.fromJson(json, mapType);
3737
}
3838

39+
// We need this so Gson doesn't complain in certain java environments that restrict unsafe allocation
40+
FeatureFlag() {}
41+
3942
FeatureFlag(String key, int version, boolean on, List<Prerequisite> prerequisites, String salt, List<Target> targets, List<Rule> rules, VariationOrRollout fallthrough, Integer offVariation, List<JsonElement> variations, boolean deleted) {
4043
this.key = key;
4144
this.version = version;

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.launchdarkly.client;
22

33
class Prerequisite {
4-
private final String key;
5-
private final int variation;
4+
private String key;
5+
private int variation;
6+
7+
// We need this so Gson doesn't complain in certain java environments that restrict unsafe allocation
8+
Prerequisite() {}
69

710
Prerequisite(String key, int variation) {
811
this.key = key;

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
* Invariant: one of the variation or rollout must be non-nil.
99
*/
1010
class Rule extends VariationOrRollout {
11-
private final List<Clause> clauses;
11+
private List<Clause> clauses;
12+
13+
// We need this so Gson doesn't complain in certain java environments that restrict unsafe allocation
14+
Rule() {
15+
super();
16+
}
1217

1318
Rule(List<Clause> clauses, Integer variation, Rollout rollout) {
1419
super(variation, rollout);

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
import java.util.List;
44

55
class Target {
6-
private final List<String> values;
7-
private final int variation;
6+
private List<String> values;
7+
private int variation;
8+
9+
// We need this so Gson doesn't complain in certain java environments that restrict unsafe allocation
10+
Target() {}
811

912
Target(List<String> values, int variation) {
1013
this.values = values;

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
class VariationOrRollout {
1414
private static final float long_scale = (float) 0xFFFFFFFFFFFFFFFL;
1515

16-
private final Integer variation;
17-
private final Rollout rollout;
16+
private Integer variation;
17+
private Rollout rollout;
18+
19+
// We need this so Gson doesn't complain in certain java environments that restrict unsafe allocation
20+
VariationOrRollout() {}
1821

1922
VariationOrRollout(Integer variation, Rollout rollout) {
2023
this.variation = variation;
@@ -56,8 +59,11 @@ private float bucketUser(LDUser user, String key, String attr, String salt) {
5659
}
5760

5861
static class Rollout {
59-
private final List<WeightedVariation> variations;
60-
private final String bucketBy;
62+
private List<WeightedVariation> variations;
63+
private String bucketBy;
64+
65+
// We need this so Gson doesn't complain in certain java environments that restrict unsafe allocation
66+
Rollout() {}
6167

6268
Rollout(List<WeightedVariation> variations, String bucketBy) {
6369
this.variations = variations;
@@ -66,8 +72,11 @@ static class Rollout {
6672
}
6773

6874
static class WeightedVariation {
69-
private final int variation;
70-
private final int weight;
75+
private int variation;
76+
private int weight;
77+
78+
// We need this so Gson doesn't complain in certain java environments that restrict unsafe allocation
79+
WeightedVariation() {}
7180

7281
WeightedVariation(int variation, int weight) {
7382
this.variation = variation;

0 commit comments

Comments
 (0)