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

Commit cc5ed78

Browse files
authored
prepare 1.0.0-rc1 release (#1)
1 parent 2c75720 commit cc5ed78

File tree

74 files changed

+6302
-1
lines changed

Some content is hidden

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

74 files changed

+6302
-1
lines changed

.circleci/config.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/[email protected]
5+
6+
workflows:
7+
test:
8+
jobs:
9+
- build-linux
10+
- test-linux:
11+
name: Java 8 - Linux - OpenJDK
12+
docker-image: circleci/openjdk:8
13+
requires:
14+
- build-linux
15+
- test-linux:
16+
name: Java 9 - Linux - OpenJDK
17+
docker-image: circleci/openjdk:9
18+
requires:
19+
- build-linux
20+
- test-linux:
21+
name: Java 10 - Linux - OpenJDK
22+
docker-image: circleci/openjdk:10
23+
requires:
24+
- build-linux
25+
- test-linux:
26+
name: Java 11 - Linux - OpenJDK
27+
docker-image: circleci/openjdk:11
28+
with-coverage: true
29+
requires:
30+
- build-linux
31+
- build-test-windows:
32+
name: Java 11 - Windows - OpenJDK
33+
- build-test-android:
34+
name: Android
35+
36+
jobs:
37+
build-linux:
38+
docker:
39+
- image: circleci/openjdk:8u131-jdk # To match the version pre-installed in Ubuntu 16 and used by Jenkins for releasing
40+
steps:
41+
- checkout
42+
- run: cp gradle.properties.example gradle.properties
43+
- run: java -version
44+
- run: ./gradlew dependencies
45+
- run: ./gradlew jar
46+
- run: ./gradlew checkstyleMain
47+
- persist_to_workspace:
48+
root: build
49+
paths:
50+
- classes
51+
52+
test-linux:
53+
parameters:
54+
docker-image:
55+
type: string
56+
with-coverage:
57+
type: boolean
58+
default: false
59+
docker:
60+
- image: <<parameters.docker-image>>
61+
steps:
62+
- checkout
63+
- run: cp gradle.properties.example gradle.properties
64+
- attach_workspace:
65+
at: build
66+
- run: java -version
67+
- run: ./gradlew test
68+
- when:
69+
condition: <<parameters.with-coverage>>
70+
steps:
71+
- run:
72+
name: Generate test coverage report
73+
command: ./gradlew jacocoTestReport
74+
- run:
75+
name: Enforce test coverage
76+
command: ./gradlew jacocoTestCoverageVerification
77+
- run:
78+
name: Save test results
79+
command: |
80+
mkdir -p ~/junit/;
81+
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
82+
when: always
83+
- store_test_results:
84+
path: ~/junit
85+
- store_artifacts:
86+
path: ~/junit
87+
- when:
88+
condition: <<parameters.with-coverage>>
89+
steps:
90+
- store_artifacts:
91+
path: build/reports/jacoco
92+
93+
build-test-windows:
94+
executor:
95+
name: win/vs2019
96+
shell: powershell.exe
97+
steps:
98+
- checkout
99+
- run:
100+
name: install OpenJDK
101+
command: |
102+
$ProgressPreference = "SilentlyContinue" # prevents console errors from CircleCI host
103+
iwr -outf openjdk.msi https://developers.redhat.com/download-manager/file/java-11-openjdk-11.0.5.10-2.windows.redhat.x86_64.msi
104+
Start-Process msiexec.exe -Wait -ArgumentList '/I openjdk.msi /quiet'
105+
- run:
106+
name: build and test
107+
command: |
108+
cp gradle.properties.example gradle.properties
109+
.\gradlew.bat --no-daemon test # must use --no-daemon because CircleCI in Windows will hang if there's a daemon running
110+
- run:
111+
name: save test results
112+
command: |
113+
mkdir .\junit
114+
cp build/test-results/test/*.xml junit
115+
- store_test_results:
116+
path: .\junit
117+
- store_artifacts:
118+
path: .\junit
119+
120+
build-test-android:
121+
# This is adapted from the CI build for android-client-sdk
122+
macos:
123+
xcode: "10.3.0"
124+
shell: /bin/bash --login -eo pipefail
125+
working_directory: ~/launchdarkly/android-client-sdk-private
126+
environment:
127+
TERM: dumb
128+
QEMU_AUDIO_DRV: none
129+
_JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Xms2048m -Xmx4096m"
130+
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
131+
JVM_OPTS: -Xmx3200m
132+
ANDROID_HOME: "/usr/local/share/android-sdk"
133+
ANDROID_SDK_HOME: "/usr/local/share/android-sdk"
134+
ANDROID_SDK_ROOT: "/usr/local/share/android-sdk"
135+
steps:
136+
- checkout
137+
- run:
138+
name: Install Android tools
139+
command: ./scripts/install-android-tools.sh
140+
- run:
141+
name: Start Android environment
142+
command: ./scripts/start-android-env.sh
143+
background: true
144+
timeout: 1200
145+
no_output_timeout: 20m
146+
- run:
147+
name: Wait for Android environment
148+
command: ./scripts/started-android-env.sh
149+
- run:
150+
name: Run tests
151+
command: ./scripts/run-android-tests.sh
152+
no_output_timeout: 20m
153+
- run:
154+
name: Save test results
155+
command: |
156+
mkdir -p ~/test-results
157+
cp -r ./build/outputs/androidTest-results/* ~/test-results/
158+
when: always
159+
- run:
160+
name: Stop Android environment
161+
command: ./scripts/stop-android-env.sh
162+
when: always
163+
- store_test_results:
164+
path: ~/test-results
165+
- store_artifacts:
166+
path: ~/artifacts

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ bin/
1616
out/
1717
classes/
1818

19-
packaging-test/temp/
19+
# Test code that gets temporarily copied by our Android CI build
20+
src/androidTest/java/com/launchdarkly/sdk/**/*.java
21+
!src/androidTest/java/com/launchdarkly/sdk/BaseTest.java

.ldrelease/config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repo:
2+
public: java-sdk-common
3+
private: java-sdk-common-private
4+
5+
publications:
6+
- url: https://oss.sonatype.org/content/groups/public/com/launchdarkly/launchdarkly-java-sdk-common/
7+
description: Sonatype
8+
- url: https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-sdk-common
9+
description: documentation (javadoc.io)
10+
11+
template:
12+
name: gradle
13+
14+
documentation:
15+
githubPages: true

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

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Change log
2+
3+
All notable changes to the project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
4+
5+
## [1.0.0-rc1] - 2020-04-29
6+
7+
Initial beta release, for the 5.0.0-rc1 release of the Java SDK.

CONTRIBUTING.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Contributing to the LaunchDarkly SDK Java Common Code
2+
3+
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.
4+
5+
## Submitting bug reports and feature requests
6+
7+
The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/java-sdk-common/issues) in the GitHub repository. Bug reports and feature requests specific to this project should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.
8+
9+
## Submitting pull requests
10+
11+
We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days.
12+
13+
## Release notes and `@since`
14+
15+
Since this project is meant to be used from multiple LaunchDarkly SDKs and its Javadoc documentation will also appear in the Javadocs for those SDKs, please use the following conventions:
16+
17+
1. All changes and fixes should be documented in the changelog and release notes for this project as part of the usual release process.
18+
2. They should _also_ be documented in the changelogs and release notes for the next Java/Android SDK releases that incorporate the new `java-sdk-common` release. Users of those should not be expected to monitor this repository; its existence as a separate project is an implementation detail.
19+
3. When adding a new public type or method, include a `@since` tag in its Javadoc comment, in the following format: `@since Java server-side SDK $NEXT_JAVA_VERSION / Android SDK $NEXT_ANDROID_VERSION`, where `$NEXT_JAVA_VERSION` and `$NEXT_ANDROID_VERSION` are the next minor version releases of those SDKs that will incorporate this feature-- even though those have not been released yet.
20+
21+
22+
## Build instructions
23+
24+
### Prerequisites
25+
26+
The project builds with [Gradle](https://gradle.org/) and should be built against Java 8.
27+
28+
### Building
29+
30+
To build the project without running any tests:
31+
```
32+
./gradlew jar
33+
```
34+
35+
If you wish to clean your working directory between builds, you can clean it by running:
36+
```
37+
./gradlew clean
38+
```
39+
40+
If you wish to use your generated SDK artifact by another Maven/Gradle project such as [java-server-sdk](https://github.com/launchdarkly/java-server-sdk), you will likely want to publish the artifact to your local Maven repository so that your other project can access it.
41+
```
42+
./gradlew publishToMavenLocal
43+
```
44+
45+
### Testing
46+
47+
To build the project and run all unit tests:
48+
```
49+
./gradlew test
50+
```
51+
52+
## Note on Java version and Android support
53+
54+
This project is limited to Java 7 because it is used in both the LaunchDarkly server-side Java SDK and the LaunchDarkly Android SDK. Android only supports Java 8 to a limited degree, depending on both the version of the Android developer tools and the Android API version. Since this is a small code base, we have decided to use Java 7 for it despite the minor inconveniences that this causes in terms of syntax.
55+
56+
## Code coverage
57+
58+
It is important to keep unit test coverage as close to 100% as possible in this project, since the SDK projects will not exercise every `java-sdk-common` method in their own unit tests.
59+
60+
Sometimes a gap in coverage is unavoidable, usually because the compiler requires us to provide a code path for some condition that in practice can't happen and can't be tested, or because of a known issue with the code coverage tool. Please handle all such cases as follows:
61+
62+
* Mark the code with an explanatory comment beginning with "COVERAGE:".
63+
* Run the code coverage task with `./gradlew jacocoTestCoverageVerification`. It should fail and indicate how many lines of missed coverage exist in the method you modified.
64+
* Add an item in the `knownMissedLinesForMethods` map in `build.gradle` that specifies that number of missed lines for that method signature.
65+
66+
## Note on dependencies
67+
68+
This project's `build.gradle` contains special logic to exclude dependencies from `pom.xml`. This is because it is meant to be used as part of one of the LaunchDarkly SDKs, and the different SDKs have different strategies for either exposing or embedding these dependencies. Therefore, it is the responsibility of each SDK to provide its own dependency for any module that is actually required in order for `java-sdk-common` to work; currently that is only Gson.

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2020 Catamorphic, Co.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# LaunchDarkly SDK Java Common Code
2+
3+
[![Circle CI](https://circleci.com/gh/launchdarkly/java-sdk-common.svg?style=shield)](https://circleci.com/gh/launchdarkly/java-sdk-common)
4+
[![Javadocs](http://javadoc.io/badge/com.launchdarkly/launchdarkly-java-sdk-common.svg)](http://javadoc.io/doc/com.launchdarkly/launchdarkly-java-sdk-common)
5+
6+
This project contains Java classes and interfaces that are shared between the LaunchDarkly server-side Java SDK and the LaunchDarkly Android SDK. Code that is specific to one or the other is in [java-server-sdk](https://github.com/launchdarkly/java-server-sdk) or [android-client-sdk](https://github.com/launchdarkly/android-client-sdk).
7+
8+
## Supported Java versions
9+
10+
This version of the library works with Java 7 and above.
11+
12+
## Contributing
13+
14+
See [Contributing](https://github.com/launchdarkly/dotnet-sdk-common/blob/master/CONTRIBUTING.md).
15+
16+
## About LaunchDarkly
17+
18+
* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
19+
* Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
20+
* 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?).
21+
* 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.
22+
* 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.
23+
* 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.
24+
* Explore LaunchDarkly
25+
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
26+
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
27+
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
28+
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
29+
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies

build-android.gradle

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
apply plugin: 'com.android.library'
2+
//apply plugin: 'com.github.dcendents.android-maven'
3+
4+
buildscript {
5+
repositories {
6+
mavenCentral()
7+
mavenLocal()
8+
google()
9+
jcenter()
10+
}
11+
dependencies {
12+
classpath 'com.android.tools.build:gradle:3.6.0'
13+
}
14+
}
15+
// This Gradle script is used only when we are running tests in an Android environment to verify
16+
// that the project is Android-compatible. We do not publish an Android build - that is done in
17+
// the android-client-sdk project.
18+
19+
repositories {
20+
mavenLocal()
21+
// Before LaunchDarkly release artifacts get synced to Maven Central they are here along with snapshots:
22+
maven { url "https://oss.sonatype.org/content/groups/public/" }
23+
mavenCentral()
24+
google()
25+
}
26+
27+
apply from: 'build-shared.gradle'
28+
29+
android {
30+
compileSdkVersion 26
31+
buildToolsVersion '28.0.3'
32+
33+
defaultConfig {
34+
minSdkVersion 16
35+
targetSdkVersion 26
36+
versionCode 1
37+
versionName version
38+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
39+
consumerProguardFiles 'consumer-proguard-rules.pro'
40+
41+
// The following argument makes the Android Test Orchestrator run its
42+
// "pm clear" command after each test invocation. This command ensures
43+
// that the app's state is completely cleared between tests.
44+
testInstrumentationRunnerArguments clearPackageData: 'true'
45+
}
46+
47+
compileOptions {
48+
sourceCompatibility JavaVersion.VERSION_1_7
49+
targetCompatibility JavaVersion.VERSION_1_7
50+
}
51+
52+
packagingOptions {
53+
exclude 'META-INF/**'
54+
exclude 'META-INF/**'
55+
}
56+
57+
dexOptions {
58+
javaMaxHeapSize "4g"
59+
}
60+
}
61+
62+
dependencies {
63+
androidTestImplementation "junit:junit:4.12"
64+
androidTestImplementation "org.hamcrest:hamcrest-library:1.3"
65+
androidTestImplementation "com.android.support.test:runner:1.0.2"
66+
}

0 commit comments

Comments
 (0)