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

Commit fc104d7

Browse files
prepare 4.13.0 release (#189)
1 parent deb4186 commit fc104d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1789
-500
lines changed

build.gradle

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ plugins {
1515
id "java-library"
1616
id "checkstyle"
1717
id "signing"
18-
id "com.github.johnrengelman.shadow" version "4.0.4"
18+
id "com.github.johnrengelman.shadow" version "5.2.0"
1919
id "maven-publish"
2020
id "de.marcphilipp.nexus-publish" version "0.3.0"
2121
id "io.codearte.nexus-staging" version "0.21.2"
@@ -38,13 +38,13 @@ configurations.all {
3838
allprojects {
3939
group = 'com.launchdarkly'
4040
version = "${version}"
41+
archivesBaseName = 'launchdarkly-java-server-sdk'
4142
sourceCompatibility = 1.7
4243
targetCompatibility = 1.7
4344
}
4445

4546
ext {
4647
sdkBasePackage = "com.launchdarkly.client"
47-
sdkBaseName = "launchdarkly-java-server-sdk"
4848

4949
// List any packages here that should be included in OSGi imports for the SDK, if they cannot
5050
// be discovered by looking in our explicit dependencies.
@@ -53,23 +53,34 @@ ext {
5353

5454
ext.libraries = [:]
5555

56+
ext.versions = [
57+
"commonsCodec": "1.10",
58+
"gson": "2.7",
59+
"guava": "19.0",
60+
"jodaTime": "2.9.3",
61+
"okhttpEventsource": "1.11.0",
62+
"slf4j": "1.7.21",
63+
"snakeyaml": "1.19",
64+
"jedis": "2.9.0"
65+
]
66+
5667
// Add dependencies to "libraries.internal" that are not exposed in our public API. These
5768
// will be completely omitted from the "thin" jar, and will be embedded with shaded names
5869
// in the other two SDK jars.
5970
libraries.internal = [
60-
"commons-codec:commons-codec:1.10",
61-
"com.google.guava:guava:19.0",
62-
"joda-time:joda-time:2.9.3",
63-
"com.launchdarkly:okhttp-eventsource:1.10.2",
64-
"org.yaml:snakeyaml:1.19",
65-
"redis.clients:jedis:2.9.0"
71+
"commons-codec:commons-codec:${versions.commonsCodec}",
72+
"com.google.guava:guava:${versions.guava}",
73+
"joda-time:joda-time:${versions.jodaTime}",
74+
"com.launchdarkly:okhttp-eventsource:${versions.okhttpEventsource}",
75+
"org.yaml:snakeyaml:${versions.snakeyaml}",
76+
"redis.clients:jedis:${versions.jedis}"
6677
]
6778

6879
// Add dependencies to "libraries.external" that are exposed in our public API, or that have
6980
// global state that must be shared between the SDK and the caller.
7081
libraries.external = [
71-
"com.google.code.gson:gson:2.7",
72-
"org.slf4j:slf4j-api:1.7.21"
82+
"com.google.code.gson:gson:${versions.gson}",
83+
"org.slf4j:slf4j-api:${versions.slf4j}"
7384
]
7485

7586
// Add dependencies to "libraries.test" that are used only in unit tests.
@@ -84,25 +95,26 @@ libraries.test = [
8495

8596
dependencies {
8697
implementation libraries.internal
87-
compileClasspath libraries.external
88-
runtime libraries.internal, libraries.external
98+
api libraries.external
8999
testImplementation libraries.test, libraries.internal, libraries.external
90100

91101
// Unlike what the name might suggest, the "shadow" configuration specifies dependencies that
92102
// should *not* be shaded by the Shadow plugin when we build our shaded jars.
93103
shadow libraries.external
94104
}
95105

96-
task wrapper(type: Wrapper) {
97-
gradleVersion = '4.10.2'
106+
configurations {
107+
// We need to define "internal" as a custom configuration that contains the same things as
108+
// "implementation", because "implementation" has special behavior in Gradle that prevents us
109+
// from referencing it the way we do in shadeDependencies().
110+
internal.extendsFrom implementation
98111
}
99112

100113
checkstyle {
101114
configFile file("${project.rootDir}/checkstyle.xml")
102115
}
103116

104117
jar {
105-
baseName = sdkBaseName
106118
// thin classifier means that the non-shaded non-fat jar is still available
107119
// but is opt-in since users will have to specify it.
108120
classifier = 'thin'
@@ -118,8 +130,6 @@ jar {
118130
// This builds the default uberjar that contains all of our dependencies except Gson and
119131
// SLF4j, in shaded form. The user is expected to provide Gson and SLF4j.
120132
shadowJar {
121-
baseName = sdkBaseName
122-
123133
// No classifier means that the shaded jar becomes the default artifact
124134
classifier = ''
125135

@@ -141,12 +151,11 @@ shadowJar {
141151
// This builds the "-all"/"fat" jar, which is the same as the default uberjar except that
142152
// Gson and SLF4j are bundled and exposed (unshaded).
143153
task shadowJarAll(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
144-
baseName = sdkBaseName
145154
classifier = 'all'
146155
group = "shadow"
147156
description = "Builds a Shaded fat jar including SLF4J"
148157
from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)
149-
configurations = [project.configurations.runtime]
158+
configurations = [project.configurations.runtimeClasspath]
150159
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
151160

152161
// doFirst causes the following steps to be run during Gradle's execution phase rather than the
@@ -228,7 +237,7 @@ def shadeDependencies(jarTask) {
228237
def excludePackages = getAllSdkPackages() +
229238
configurations.shadow.collectMany { getPackagesInDependencyJar(it)}
230239
def topLevelPackages =
231-
configurations.runtime.collectMany {
240+
configurations.internal.collectMany {
232241
getPackagesInDependencyJar(it).collect { it.contains(".") ? it.substring(0, it.indexOf(".")) : it }
233242
}.
234243
unique()
@@ -325,7 +334,6 @@ test {
325334
idea {
326335
module {
327336
downloadJavadoc = true
328-
329337
downloadSources = true
330338
}
331339
}
@@ -367,7 +375,6 @@ publishing {
367375
shadow(MavenPublication) { publication ->
368376
project.shadow.component(publication)
369377

370-
artifactId = sdkBaseName
371378
artifact jar
372379
artifact sourcesJar
373380
artifact javadocJar
@@ -422,7 +429,7 @@ tasks.withType(Sign) {
422429
// dependencies of the SDK, so they can be put on the classpath as needed during tests.
423430
task exportDependencies(type: Copy, dependsOn: compileJava) {
424431
into "packaging-test/temp/dependencies-all"
425-
from configurations.runtime.resolvedConfiguration.resolvedArtifacts.collect { it.file }
432+
from configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.collect { it.file }
426433
}
427434

428435
gitPublish {

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
version=4.12.1
1+
version=4.12.2
22
# The following empty ossrh properties are used by LaunchDarkly's internal integration testing framework
33
# and should not be needed for typical development purposes (including by third-party developers).
44
ossrhUsername=
55
ossrhPassword=
6+
7+
# See https://github.com/gradle/gradle/issues/11308 regarding the following property
8+
systemProp.org.gradle.internal.publish.checksums.insecure=true

gradle/wrapper/gradle-wrapper.jar

1.43 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
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.2.2-bin.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip

packaging-test/Makefile

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,31 @@ SDK_DEFAULT_JAR=$(SDK_JARS_DIR)/launchdarkly-java-server-sdk-$(SDK_VERSION).jar
1818
SDK_ALL_JAR=$(SDK_JARS_DIR)/launchdarkly-java-server-sdk-$(SDK_VERSION)-all.jar
1919
SDK_THIN_JAR=$(SDK_JARS_DIR)/launchdarkly-java-server-sdk-$(SDK_VERSION)-thin.jar
2020

21-
TEMP_DIR=$(BASE_DIR)/temp
22-
TEMP_OUTPUT=$(TEMP_DIR)/test.out
21+
export TEMP_DIR=$(BASE_DIR)/temp
22+
export TEMP_OUTPUT=$(TEMP_DIR)/test.out
2323

2424
# Build product of the project in ./test-app; can be run as either a regular app or an OSGi bundle
2525
TEST_APP_JAR=$(TEMP_DIR)/test-app.jar
2626

27-
# SLF4j implementation - we need to download this separately because it's not in the SDK dependencies
28-
SLF4J_SIMPLE_JAR=$(TEMP_DIR)/test-slf4j-simple.jar
29-
SLF4J_SIMPLE_JAR_URL=https://oss.sonatype.org/content/groups/public/org/slf4j/slf4j-simple/1.7.21/slf4j-simple-1.7.21.jar
30-
3127
# Felix OSGi container
32-
FELIX_ARCHIVE=org.apache.felix.main.distribution-6.0.3.tar.gz
33-
FELIX_ARCHIVE_URL=http://mirrors.ibiblio.org/apache//felix/$(FELIX_ARCHIVE)
34-
FELIX_DIR=$(TEMP_DIR)/felix
35-
FELIX_JAR=$(FELIX_DIR)/bin/felix.jar
36-
TEMP_BUNDLE_DIR=$(TEMP_DIR)/bundles
28+
export FELIX_DIR=$(TEMP_DIR)/felix
29+
export FELIX_JAR=$(FELIX_DIR)/lib/felix.jar
30+
export FELIX_BASE_BUNDLE_DIR=$(FELIX_DIR)/base-bundles
31+
export TEMP_BUNDLE_DIR=$(FELIX_DIR)/app-bundles
3732

3833
# Lists of jars to use as a classpath (for the non-OSGi runtime test) or to install as bundles (for
3934
# the OSGi test). Note that we're assuming that all of the SDK's dependencies have built-in support
4035
# for OSGi, which is currently true; if that weren't true, we would have to do something different
4136
# to put them on the system classpath in the OSGi test.
42-
RUN_JARS_test-all-jar=$(TEST_APP_JAR) $(SDK_ALL_JAR) \
43-
$(SLF4J_SIMPLE_JAR)
37+
RUN_JARS_test-all-jar=$(TEST_APP_JAR) $(SDK_ALL_JAR)
4438
RUN_JARS_test-default-jar=$(TEST_APP_JAR) $(SDK_DEFAULT_JAR) \
45-
$(shell ls $(TEMP_DIR)/dependencies-external/*.jar) \
46-
$(SLF4J_SIMPLE_JAR)
39+
$(shell ls $(TEMP_DIR)/dependencies-external/*.jar)
4740
RUN_JARS_test-thin-jar=$(TEST_APP_JAR) $(SDK_THIN_JAR) \
4841
$(shell ls $(TEMP_DIR)/dependencies-internal/*.jar) \
49-
$(shell ls $(TEMP_DIR)/dependencies-external/*.jar) \
50-
$(SLF4J_SIMPLE_JAR)
42+
$(shell ls $(TEMP_DIR)/dependencies-external/*.jar)
5143

5244
# The test-app displays this message on success
53-
SUCCESS_MESSAGE="@@@ successfully created LD client @@@"
45+
export SUCCESS_MESSAGE=@@@ successfully created LD client @@@
5446

5547
classes_prepare=echo " checking $(1)..." && jar tf $(1) | grep '\.class$$' >$(TEMP_OUTPUT)
5648
classes_should_contain=echo " should contain $(2)" && grep $(1) $(TEMP_OUTPUT) >/dev/null
@@ -73,21 +65,12 @@ clean:
7365
# SECONDEXPANSION is needed so we can use "$@" inside a variable in the prerequisite list of the test targets
7466
.SECONDEXPANSION:
7567

76-
test-all-jar test-default-jar test-thin-jar: $$(RUN_JARS_$$@) $(TEST_APP_JAR) $(FELIX_JAR) get-sdk-dependencies $$@-classes
68+
test-all-jar test-default-jar test-thin-jar: $$@-classes get-sdk-dependencies $$(RUN_JARS_$$@) $(TEST_APP_JAR) $(FELIX_DIR)
7769
@$(call caption,$@)
78-
@echo " non-OSGi runtime test"
79-
@java -classpath $(shell echo "$(RUN_JARS_$@)" | sed -e 's/ /:/g') testapp.TestApp | tee $(TEMP_OUTPUT)
80-
@grep $(SUCCESS_MESSAGE) $(TEMP_OUTPUT) >/dev/null
70+
./run-non-osgi-test.sh $(RUN_JARS_$@)
8171
# Can't currently run the OSGi test for the thin jar, because some of our dependencies aren't available as OSGi bundles.
8272
@if [ "$@" != "test-thin-jar" ]; then \
83-
echo ""; \
84-
echo " OSGi runtime test"; \
85-
rm -rf $(TEMP_BUNDLE_DIR); \
86-
mkdir -p $(TEMP_BUNDLE_DIR); \
87-
cp $(RUN_JARS_$@) $(FELIX_DIR)/bundle/*.jar $(TEMP_BUNDLE_DIR); \
88-
rm -rf $(FELIX_DIR)/felix-cache; \
89-
cd $(FELIX_DIR) && echo "sleep 3;exit 0" | java -jar $(FELIX_JAR) -b $(TEMP_BUNDLE_DIR) | tee $(TEMP_OUTPUT); \
90-
grep $(SUCCESS_MESSAGE) $(TEMP_OUTPUT) >/dev/null; \
73+
./run-osgi-test.sh $(RUN_JARS_$@); \
9174
fi
9275

9376
test-all-jar-classes: $(SDK_ALL_JAR) $(TEMP_DIR)
@@ -144,13 +127,21 @@ $(TEMP_DIR)/dependencies-internal: $(TEMP_DIR)/dependencies-all
144127
cp $(TEMP_DIR)/dependencies-all/*.jar $@
145128
rm $@/gson*.jar $@/slf4j*.jar
146129

147-
$(SLF4J_SIMPLE_JAR): | $(TEMP_DIR)
148-
curl -f -L $(SLF4J_SIMPLE_JAR_URL) >$@
149-
150-
$(FELIX_JAR): | $(TEMP_DIR)
151-
curl -f -L $(FELIX_ARCHIVE_URL) >$(TEMP_DIR)/$(FELIX_ARCHIVE)
152-
cd $(TEMP_DIR) && tar xfz $(FELIX_ARCHIVE) && rm $(FELIX_ARCHIVE)
153-
cd $(TEMP_DIR) && mv `ls -d felix*` felix
130+
$(FELIX_JAR): $(FELIX_DIR)
131+
132+
$(FELIX_DIR):
133+
mkdir -p $(FELIX_DIR)
134+
mkdir -p $(FELIX_DIR)/lib
135+
mkdir -p $(FELIX_BASE_BUNDLE_DIR)
136+
cd test-app && ../../gradlew createOsgi
137+
@# createOsgi is a target provided by the osgi-run Gradle plugin; it downloads the Felix container and
138+
@# puts it in build/osgi along with related bundles and a config file.
139+
cp -r test-app/build/osgi/conf $(FELIX_DIR)
140+
echo "felix.shutdown.hook=false" >>$(FELIX_DIR)/conf/config.properties
141+
@# setting felix.shutdown.hook to false allows our test app to use System.exit()
142+
cp test-app/build/osgi/system-libs/org.apache.felix.main-*.jar $(FELIX_JAR)
143+
cp test-app/build/osgi/bundle/* $(FELIX_BASE_BUNDLE_DIR)
144+
cd $(FELIX_BASE_BUNDLE_DIR) && rm -f launchdarkly-*.jar gson-*.jar
154145

155146
$(TEMP_DIR):
156147
[ -d $@ ] || mkdir -p $@
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
echo ""
4+
echo " non-OSGi runtime test"
5+
java -classpath $(echo "$@" | sed -e 's/ /:/g') testapp.TestApp | tee ${TEMP_OUTPUT}
6+
grep "${SUCCESS_MESSAGE}" ${TEMP_OUTPUT} >/dev/null

packaging-test/run-osgi-test.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
echo ""
4+
echo " OSGi runtime test"
5+
rm -rf ${TEMP_BUNDLE_DIR}
6+
mkdir -p ${TEMP_BUNDLE_DIR}
7+
cp $@ ${FELIX_BASE_BUNDLE_DIR}/* ${TEMP_BUNDLE_DIR}
8+
rm -rf ${FELIX_DIR}/felix-cache
9+
rm -f ${TEMP_OUTPUT}
10+
touch ${TEMP_OUTPUT}
11+
12+
cd ${FELIX_DIR} && java -jar ${FELIX_JAR} -b ${TEMP_BUNDLE_DIR} | tee ${TEMP_OUTPUT}
13+
14+
grep "${SUCCESS_MESSAGE}" ${TEMP_OUTPUT} >/dev/null
Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
apply plugin: "java"
2-
apply plugin: "osgi"
1+
2+
buildscript {
3+
repositories {
4+
jcenter()
5+
mavenCentral()
6+
}
7+
}
8+
9+
plugins {
10+
id "java"
11+
id "java-library"
12+
id "biz.aQute.bnd.builder" version "5.0.1"
13+
id "com.athaydes.osgi-run" version "1.6.0"
14+
}
315

416
repositories {
517
mavenCentral()
@@ -8,32 +20,26 @@ repositories {
820
allprojects {
921
group = "com.launchdarkly"
1022
version = "1.0.0"
23+
archivesBaseName = 'test-app-bundle'
1124
sourceCompatibility = 1.7
1225
targetCompatibility = 1.7
1326
}
1427

1528
dependencies {
1629
// Note, the SDK build must have already been run before this, since we're using its product as a dependency
17-
compileClasspath fileTree(dir: "../../build/libs", include: "launchdarkly-java-server-sdk-*-thin.jar")
18-
compileClasspath "com.google.code.gson:gson:2.7"
19-
compileClasspath "org.slf4j:slf4j-api:1.7.21"
20-
compileClasspath "org.osgi:osgi_R4_core:1.0"
30+
implementation fileTree(dir: "../../build/libs", include: "launchdarkly-java-server-sdk-*-thin.jar")
31+
implementation "com.google.code.gson:gson:2.7"
32+
implementation "org.slf4j:slf4j-api:1.7.22"
33+
implementation "org.osgi:osgi_R4_core:1.0"
34+
osgiRuntime "org.slf4j:slf4j-simple:1.7.22"
2135
}
2236

2337
jar {
24-
baseName = 'test-app-bundle'
25-
manifest {
26-
instruction 'Bundle-Activator', 'testapp.TestAppOsgiEntryPoint'
27-
}
28-
}
29-
30-
task wrapper(type: Wrapper) {
31-
gradleVersion = '4.10.2'
38+
bnd(
39+
'Bundle-Activator': 'testapp.TestAppOsgiEntryPoint'
40+
)
3241
}
3342

34-
buildscript {
35-
repositories {
36-
jcenter()
37-
mavenCentral()
38-
}
43+
runOsgi {
44+
bundles = [ ] // we don't need a CLI or anything like that - just the SLF4j dependency shown above
3945
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'test-app-bundle'

packaging-test/test-app/src/main/java/testapp/TestAppOsgiEntryPoint.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ public void start(BundleContext context) throws Exception {
88
System.out.println("@@@ starting test bundle @@@");
99

1010
TestApp.main(new String[0]);
11+
12+
System.exit(0);
1113
}
1214

1315
public void stop(BundleContext context) throws Exception {
14-
System.out.println("@@@ stopping test bundle @@@");
1516
}
1617
}

0 commit comments

Comments
 (0)