Skip to content

Commit 41b324a

Browse files
committed
chore: Migrate java-test-helpers to java-core.
1 parent 650dfbe commit 41b324a

File tree

455 files changed

+25512
-0
lines changed

Some content is hidden

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

455 files changed

+25512
-0
lines changed

.github/workflows/release-please.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
outputs:
1313
package-sdk-common-released: ${{ steps.release.outputs['lib/shared/common--release_created'] }}
1414
package-sdk-internal-released: ${{ steps.release.outputs['lib/shared/internal--release_created'] }}
15+
package-test-helpers-released: ${{ steps.release.outputs['lib/shared/test-helpers--release_created'] }}
1516
package-server-sdk-released: ${{ steps.release.outputs['lib/sdk/server--release_created'] }}
1617
package-server-sdk-otel-released: ${{ steps.release.outputs['lib/java-server-sdk-otel--release_created'] }}
1718
package-server-sdk-redis-store-released: ${{ steps.release.outputs['lib/java-server-sdk-redis-store--release_created'] }}
@@ -188,3 +189,36 @@ jobs:
188189
sonatype_password: ${{ env.SONATYPE_PASSWORD }}
189190
aws_role: ${{ vars.AWS_ROLE_ARN }}
190191
token: ${{ secrets.GITHUB_TOKEN }}
192+
193+
release-test-helpers:
194+
runs-on: ubuntu-latest
195+
needs: release-please
196+
permissions:
197+
id-token: write
198+
contents: write
199+
pull-requests: write
200+
if: ${{ needs.release-please.outputs.package-test-helpers-released == 'true'}}
201+
steps:
202+
- uses: actions/checkout@v4
203+
204+
- uses: launchdarkly/gh-actions/actions/[email protected]
205+
name: Get secrets
206+
with:
207+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
208+
ssm_parameter_pairs: '/production/common/releasing/sonatype/central/username = SONATYPE_USER_NAME,
209+
/production/common/releasing/sonatype/central/password = SONATYPE_PASSWORD,
210+
/production/common/releasing/java/keyId = SIGNING_KEY_ID'
211+
s3_path_pairs: 'launchdarkly-releaser/java/code-signing-keyring.gpg = code-signing-keyring.gpg'
212+
213+
- uses: ./.github/actions/full-release
214+
with:
215+
workspace_path: lib/shared/test-helpers
216+
dry_run: false
217+
prerelease: false
218+
code_signing_keyring: ${{ github.workspace }}/code-signing-keyring.gpg
219+
signing_key_id: ${{ env.SIGNING_KEY_ID }}
220+
signing_key_passphrase: ''
221+
sonatype_username: ${{ env.SONATYPE_USER_NAME }}
222+
sonatype_password: ${{ env.SONATYPE_PASSWORD }}
223+
aws_role: ${{ vars.AWS_ROLE_ARN }}
224+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-helpers.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: test-helpers
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-helpers:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
java-version: [8, 11, 17, 19]
19+
os: [ubuntu-latest]
20+
include:
21+
- java-version: 11
22+
os: windows-latest
23+
- java-version: 17
24+
os: windows-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Shared CI Steps
29+
uses: ./.github/actions/ci
30+
with:
31+
workspace_path: 'lib/shared/test-helpers'
32+
java_version: ${{ matrix.java-version }}

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"lib/java-server-sdk-redis-store": "3.0.1",
44
"lib/shared/common": "2.1.2",
55
"lib/shared/internal": "1.5.1",
6+
"lib/shared/test-helpers": "2.0.2",
67
"lib/sdk/server": "7.10.2"
78
}

lib/shared/test-helpers/.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
Lines changed: 43 additions & 0 deletions
Lines changed: 39 additions & 0 deletions

lib/shared/test-helpers/LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2021 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.

lib/shared/test-helpers/NOTICE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
java-test-helpers
2+
Copyright 2021 Catamorphic, Co.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
================================================================================
17+
18+
This project bundles the following dependencies under the BSD 3-Clause License.
19+
See bundled license files for details.
20+
21+
- NanoHttpd (core module)
22+
https://github.com/NanoHttpd/nanohttpd
23+
Copyright (c) 2012-2013 by Paul S. Hawke, 2001, 2005-2013 by Jarno Elonen, 2010 by Konstantinos Togias
24+
Files: com.launchdarkly.testhelpers.httptest.nanohttpd.*

lib/shared/test-helpers/README.md

Lines changed: 28 additions & 0 deletions
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import java.time.Duration
2+
import org.gradle.external.javadoc.CoreJavadocOptions
3+
4+
buildscript {
5+
repositories {
6+
mavenCentral()
7+
mavenLocal()
8+
}
9+
}
10+
11+
plugins { // see Dependencies.kt in buildSrc
12+
Libs.javaBuiltInGradlePlugins.forEach { id(it) }
13+
Libs.javaExtGradlePlugins.forEach { (n, v) -> id(n) version v }
14+
}
15+
16+
repositories {
17+
mavenLocal()
18+
// Before LaunchDarkly release artifacts get synced to Maven Central they are here along with snapshots:
19+
maven { url = uri("https://oss.sonatype.org/content/groups/public/") }
20+
mavenCentral()
21+
}
22+
23+
configurations.all {
24+
// check for updates every build for dependencies with: 'changing: true'
25+
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
26+
}
27+
28+
base {
29+
group = ProjectValues.groupId
30+
archivesBaseName = ProjectValues.artifactId
31+
version = version
32+
}
33+
34+
java {
35+
withJavadocJar()
36+
withSourcesJar()
37+
sourceCompatibility = JavaVersion.VERSION_1_8
38+
targetCompatibility = JavaVersion.VERSION_1_8
39+
}
40+
41+
dependencies { // see Dependencies.kt in buildSrc
42+
Libs.implementation.forEach { implementation(it) }
43+
Libs.javaTestImplementation.forEach { testImplementation(it) }
44+
}
45+
46+
checkstyle {
47+
toolVersion = "9.3"
48+
configFile = file("${project.rootDir}/checkstyle.xml")
49+
}
50+
51+
tasks.checkstyleMain {
52+
// Exclude embedded nanohttpd code from checkstyle
53+
exclude("com/launchdarkly/testhelpers/httptest/nanohttpd/**")
54+
}
55+
56+
tasks.jar {
57+
manifest {
58+
attributes(mapOf("Implementation-Version" to project.version))
59+
}
60+
// Include NOTICE file in binary distribution
61+
from(".") {
62+
include("NOTICE")
63+
into("META-INF")
64+
}
65+
// Include nanohttpd license in binary distribution per BSD 3-Clause requirements
66+
from("src/main/java/com/launchdarkly/testhelpers/httptest/nanohttpd") {
67+
include("LICENSE.md")
68+
into("META-INF/licenses/nanohttpd")
69+
}
70+
}
71+
72+
tasks.javadoc {
73+
// Force the Javadoc build to fail if there are any Javadoc warnings.
74+
(options as CoreJavadocOptions).addStringOption("Xwerror")
75+
76+
// Exclude embedded nanohttpd code from Javadoc generation
77+
exclude("com/launchdarkly/testhelpers/httptest/nanohttpd/**")
78+
}
79+
80+
helpers.Test.configureTask(tasks.compileTestJava, tasks.test, configurations["testRuntimeClasspath"])
81+
82+
helpers.Jacoco.configureTasks(
83+
tasks.jacocoTestReport,
84+
tasks.jacocoTestCoverageVerification
85+
)
86+
87+
helpers.Idea.configure(idea)
88+
89+
publishing {
90+
publications {
91+
create<MavenPublication>("mavenJava") {
92+
from(components["java"])
93+
94+
helpers.Pom.standardPom(pom) // see Pom.kt in buildSrc
95+
}
96+
}
97+
repositories {
98+
mavenLocal()
99+
}
100+
}
101+
102+
nexusPublishing {
103+
clientTimeout.set(Duration.ofMinutes(2)) // we've seen extremely long delays in creating repositories
104+
repositories {
105+
sonatype{
106+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
107+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
108+
}
109+
}
110+
}
111+
112+
signing {
113+
setRequired({ findProperty("skipSigning") != "true" })
114+
sign(publishing.publications["mavenJava"])
115+
}

0 commit comments

Comments
 (0)