Skip to content

Commit 06e5ffd

Browse files
authored
chore: migrating java-sdk-common to this repo (#15)
This PR copies existing java-sdk-common code from the private repo and takes the same approach as the java-server-sdk-otel package for having it use github actions and release-please for CICD. I made a separate commit for the code copy to make that easier to verify. All code in lib/shared/common should be identical to the [existing repo ](https://github.com/launchdarkly/java-sdk-common-private) with no changes intended.
1 parent 635693c commit 06e5ffd

File tree

108 files changed

+11013
-6
lines changed

Some content is hidden

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

108 files changed

+11013
-6
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request for the java-sdk-common package
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: 'package: java-sdk-common, enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context about the feature request here.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: 'Bug report for the java-sdk-common package'
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'package: java-sdk-common, bug'
6+
assignees: ''
7+
---
8+
9+
**Is this a support request?**
10+
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the code in this library. If you're not sure whether the problem you are having is specifically related to this library, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/) and clicking "submit a request", or by emailing [email protected].
11+
12+
Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.
13+
14+
**Describe the bug**
15+
A clear and concise description of what the bug is.
16+
17+
**To reproduce**
18+
Steps to reproduce the behavior.
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Logs**
24+
If applicable, add any log output related to your problem.
25+
26+
**SDK version**
27+
The version of this SDK that you are using.
28+
29+
**Language version, developer tools**
30+
For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too.
31+
32+
**OS/platform**
33+
For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version.
34+
35+
**Additional context**
36+
Add any other context about the problem here.

.github/workflows/java-sdk-common.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: java-sdk-common
2+
3+
on:
4+
push:
5+
branches: [main, 'feat/**']
6+
paths-ignore:
7+
- '**.md' #Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [main, 'feat/**']
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
build-test-java-sdk-common:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Shared CI Steps
20+
uses: ./.github/actions/ci
21+
with:
22+
workspace_path: 'lib/shared/common'
23+
java_version: 8

.github/workflows/manual-publish-docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
type: choice
88
options:
99
- lib/java-server-sdk-otel
10+
- lib/shared/common
1011
dry_run:
1112
description: 'Is this a dry run. If so no docs will be published.'
1213
type: boolean

.github/workflows/manual-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
type: choice
99
options:
1010
- lib/java-server-sdk-otel
11+
- lib/shared/common
1112
prerelease:
1213
description: 'Is this a prerelease.'
1314
type: boolean

.github/workflows/release-please.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111

1212
outputs:
1313
package-server-sdk-otel-released: ${{ steps.release.outputs['lib/java-server-sdk-otel--release_created'] }}
14+
package-sdk-common-released: ${{ steps.release.outputs['lib/java-sdk-common--release_created'] }}
1415

1516
steps:
1617
- uses: google-github-actions/release-please-action@v4
@@ -43,8 +44,42 @@ jobs:
4344
- uses: ./.github/actions/full-release
4445
with:
4546
workspace_path: lib/java-server-sdk-otel
46-
dry_run: true #TODO make this false
47-
prerelease: true #TODO make this false
47+
dry_run: false
48+
prerelease: false
49+
code_signing_keyring: 'code-signing-keyring.gpg'
50+
signing_key_id: ${{ env.SIGNING_KEY_ID }}
51+
signing_key_passphrase: ${{ env.SIGNING_KEY_PASSPHRASE }}
52+
sonatype_username: ${{ env.SONATYPE_USER_NAME }}
53+
sonatype_password: ${{ env.SONATYPE_PASSWORD }}
54+
aws_role: ${{ vars.AWS_ROLE_ARN }}
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
57+
release-sdk-common:
58+
runs-on: ubuntu-latest
59+
needs: release-please
60+
permissions:
61+
id-token: write
62+
contents: write
63+
pull-requests: write
64+
if: ${{ needs.release-please.outputs.package-sdk-common-released == 'true'}}
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- uses: launchdarkly/gh-actions/actions/[email protected]
69+
name: Get secrets
70+
with:
71+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
72+
ssm_parameter_pairs: '/production/common/releasing/sonatype/username = SONATYPE_USER_NAME,
73+
/production/common/releasing/sonatype/password = SONATYPE_PASSWORD,
74+
/production/common/releasing/android_code_signing/private_key_id = SIGNING_KEY_ID,
75+
/production/common/releasing/android_code_signing/private_key_passphrase = SIGNING_KEY_PASSPHRASE'
76+
s3_path_pairs: 'launchdarkly-releaser/android/code-signing-keyring.gpg = code-signing-keyring.gpg'
77+
78+
- uses: ./.github/actions/full-release
79+
with:
80+
workspace_path: lib/shared/common
81+
dry_run: true #TODO make this false after testing
82+
prerelease: true #TODO make this false after testing
4883
code_signing_keyring: 'code-signing-keyring.gpg'
4984
signing_key_id: ${{ env.SIGNING_KEY_ID }}
5085
signing_key_passphrase: ${{ env.SIGNING_KEY_PASSPHRASE }}

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"lib/java-server-sdk-otel": "0.1.0"
2+
"lib/java-server-sdk-otel": "0.1.0",
3+
"lib/shared/common": "2.1.1"
34
}

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@ This includes shared libraries, used by SDKs and other tools, as well as SDKs.
55

66
## Packages
77

8+
| Shared Packages | API Docs | maven | issues | tests |
9+
| ---------------------------------------------------------------- |--------------------------------------------------------------------| ---------------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------- |
10+
| [@launchdarkly/java-sdk-common](lib/shared/common/README.md) | [![Documentation][sdk-common-docs-badge]][sdk-common-docs-link] | [![maven][sdk-common-maven-badge]][sdk-common-maven-link] | [Issues][sdk-common-issues] | [![Actions Status][sdk-common-ci-badge]][sdk-common-ci-link] |
11+
812
| Telemetry Packages | API Docs | maven | issues | tests |
913
| ---------------------------------------------------------------------------- |--------------------------------------------------------------| ---------------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------- |
10-
| [@launchdarkly/java-server-sdk-otel](lib/java-server-sdk-otel/README.md) | [![Documentation][api-docs-badge]][server-otel-docs-link] | [![maven][server-otel-maven-badge]][server-otel-maven-link] | [Issues][java-otel-issues] | [![Actions Status][server-otel-ci-badge]][server-otel-ci-link] |
14+
| [@launchdarkly/java-server-sdk-otel](lib/java-server-sdk-otel/README.md) | [![Documentation][server-otel-docs-badge]][server-otel-docs-link] | [![maven][server-otel-maven-badge]][server-otel-maven-link] | [Issues][server-otel-issues] | [![Actions Status][server-otel-ci-badge]][server-otel-ci-link] |
1115

1216
## Organization
1317

1418
`lib` Top level directory containing package implementations.
1519

20+
`lib/shared` Packages which are primarily intended for consumption by LaunchDarkly and are used in other packages types.
21+
1622
## LaunchDarkly overview
1723

1824
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today!
@@ -43,11 +49,19 @@ We encourage pull requests and other contributions from the community. Check out
4349
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates
4450

4551
[//]: # 'java-server-sdk-otel'
46-
[java-otel-issues]: https://github.com/launchdarkly/java-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+java-server-sdk-otel%22+
52+
[server-otel-issues]: https://github.com/launchdarkly/java-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+java-server-sdk-otel%22+
4753
[server-otel-maven-badge]: https://img.shields.io/maven-central/v/com.launchdarkly/launchdarkly-java-server-sdk-otel
4854
[server-otel-maven-link]: https://central.sonatype.com/artifact/com.launchdarkly/launchdarkly-java-server-sdk-otel
4955
[server-otel-ci-badge]: https://github.com/launchdarkly/java-core/actions/workflows/java-server-sdk-otel.yml/badge.svg
5056
[server-otel-ci-link]: https://github.com/launchdarkly/java-core/actions/workflows/java-server-sdk-otel.yml
57+
[server-otel-docs-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
5158
[server-otel-docs-link]: https://launchdarkly.github.io/java-core/lib/java-server-sdk-otel/
5259

53-
[api-docs-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
60+
[//]: # 'java-sdk-common'
61+
[sdk-common-issues]: https://github.com/launchdarkly/java-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+java-sdk-common%22+
62+
[sdk-common-maven-badge]: https://img.shields.io/maven-central/v/com.launchdarkly/launchdarkly-java-sdk-common
63+
[sdk-common-maven-link]: https://central.sonatype.com/artifact/com.launchdarkly/launchdarkly-java-sdk-common
64+
[sdk-common-ci-badge]: https://github.com/launchdarkly/java-core/actions/workflows/java-sdk-common.yml/badge.svg
65+
[sdk-common-ci-link]: https://github.com/launchdarkly/java-core/actions/workflows/java-sdk-common.yml
66+
[sdk-common-docs-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
67+
[sdk-common-docs-link]: https://launchdarkly.github.io/java-core/lib/shared/common/
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/[email protected]
5+
android: circleci/[email protected]
6+
7+
workflows:
8+
test:
9+
jobs:
10+
- build-linux
11+
- test-linux:
12+
name: Java 8 - Linux - OpenJDK
13+
docker-image: cimg/openjdk:8.0
14+
requires:
15+
- build-linux
16+
- test-linux:
17+
name: Java 11 - Linux - OpenJDK
18+
docker-image: cimg/openjdk:11.0
19+
requires:
20+
- build-linux
21+
- test-linux:
22+
# current LTS version
23+
name: Java 17 - Linux - OpenJDK
24+
docker-image: cimg/openjdk:17.0
25+
with-coverage: true
26+
requires:
27+
- build-linux
28+
- test-linux:
29+
name: Java 19 - Linux - OpenJDK
30+
docker-image: cimg/openjdk:19.0
31+
requires:
32+
- build-linux
33+
# Windows Java 11 build is temporarily disabled - see story 171428
34+
# - test-windows:
35+
# name: Java 11 - Windows - OpenJDK
36+
# openjdk-version: 11.0.2.01
37+
- build-test-windows:
38+
name: Java 17 - Windows - OpenJDK
39+
openjdk-version: 17.0.1
40+
- build-test-android:
41+
name: Android
42+
43+
jobs:
44+
build-linux:
45+
docker:
46+
- image: cimg/openjdk:8.0
47+
steps:
48+
- checkout
49+
- run: cp gradle.properties.example gradle.properties
50+
- run: java -version
51+
- run: ./gradlew dependencies
52+
- run: ./gradlew jar
53+
- run: ./gradlew javadoc
54+
- run: ./gradlew checkstyleMain
55+
- persist_to_workspace:
56+
root: build
57+
paths:
58+
- classes
59+
60+
test-linux:
61+
parameters:
62+
docker-image:
63+
type: string
64+
with-coverage:
65+
type: boolean
66+
default: false
67+
docker:
68+
- image: <<parameters.docker-image>>
69+
steps:
70+
- checkout
71+
- run: cp gradle.properties.example gradle.properties
72+
- attach_workspace:
73+
at: build
74+
- run: java -version
75+
- run: ./gradlew test
76+
- when:
77+
condition: <<parameters.with-coverage>>
78+
steps:
79+
- run:
80+
name: Generate test coverage report
81+
command: |
82+
./gradlew jacocoTestReport
83+
mkdir -p coverage/
84+
cp -r build/reports/jacoco/test/* ./coverage
85+
- run:
86+
name: Enforce test coverage
87+
command: ./gradlew jacocoTestCoverageVerification
88+
- run:
89+
name: Save test results
90+
command: |
91+
mkdir -p ~/junit/;
92+
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
93+
when: always
94+
- store_test_results:
95+
path: ~/junit
96+
- store_artifacts:
97+
path: ~/junit
98+
- when:
99+
condition: <<parameters.with-coverage>>
100+
steps:
101+
- store_artifacts:
102+
path: coverage
103+
104+
build-test-windows:
105+
parameters:
106+
openjdk-version:
107+
type: string
108+
executor:
109+
name: win/vs2019
110+
shell: powershell.exe
111+
steps:
112+
- checkout
113+
- run:
114+
name: uninstall previous openjdk
115+
command: choco uninstall openjdk
116+
- run:
117+
name: install OpenJDK
118+
command: choco install openjdk --version <<parameters.openjdk-version>>
119+
- run:
120+
name: build and test
121+
command: |
122+
cp gradle.properties.example gradle.properties
123+
.\gradlew.bat --no-daemon test # must use --no-daemon because CircleCI in Windows will hang if there's a daemon running
124+
- run:
125+
name: save test results
126+
command: |
127+
mkdir .\junit
128+
cp build/test-results/test/*.xml junit
129+
- store_test_results:
130+
path: .\junit
131+
- store_artifacts:
132+
path: .\junit
133+
134+
build-test-android:
135+
executor:
136+
name: android/android-machine
137+
resource-class: large
138+
139+
steps:
140+
- checkout
141+
142+
# What we want to do here is somewhat unusual: we want Android to run all of our tests from
143+
# src/test/java, but run them in the Android emulator (to prove that we're only using Java
144+
# APIs that our minimum Android API version supports). Normally, only tests in
145+
# src/androidTest/java would be run that way. Also, Android needs a different JUnit test
146+
# runner annotation on all of the test classes. So we can't just run the test code as-is.
147+
#
148+
# This step copies all the code from src/test/java into src/androidTest/java, except for the
149+
# base class BaseTest.java, which is already defined in src/androidTest/java to provide the
150+
# necessary test runner annotation.
151+
- run:
152+
name: Copy tests
153+
command: rsync -r ./src/test/java/ ./src/androidTest/java/ --exclude='BaseTest.java'
154+
155+
- android/start-emulator-and-run-tests:
156+
system-image: system-images;android-21;default;x86
157+
max-tries: 1
158+
post-emulator-launch-assemble-command: ./gradlew -b build-android.gradle :assembleAndroidTest
159+
test-command: ./gradlew -b build-android.gradle :connectedAndroidTest
160+
161+
- store_test_results:
162+
path: ./build/outputs/androidTest-results

lib/shared/common/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Eclipse project files
2+
.classpath
3+
.project
4+
.settings
5+
6+
# Intellij project files
7+
*.iml
8+
*.ipr
9+
*.iws
10+
.idea/
11+
12+
#Gradle
13+
.gradletasknamecache
14+
.gradle/
15+
build/
16+
bin/
17+
out/
18+
classes/
19+
20+
# Test code that gets temporarily copied by our Android CI build
21+
src/androidTest/java/com/launchdarkly/sdk/**/*.java
22+
!src/androidTest/java/com/launchdarkly/sdk/BaseTest.java

0 commit comments

Comments
 (0)