Skip to content

Commit 048eadf

Browse files
authored
chore: Initial commit with RAC and UFC DTOs (#1)
* initial DTO commit * formatting * formatting * add missing getters * minor tweaks * spotless and github workflows * fix for spotless * add test * fix json parsing errors * minor cleanup * use jitpack * version bump * remove duplicated code
1 parent 383f229 commit 048eadf

File tree

70 files changed

+3568
-41
lines changed

Some content is hidden

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

70 files changed

+3568
-41
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test and lint
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/*'
7+
8+
jobs:
9+
lint-test-sdk:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
java-version: ['8', '11', '17'] # Define the Java versions to test against
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up JDK ${{ matrix.java-version }}
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: ${{ matrix.java-version }}
23+
distribution: 'adopt'
24+
25+
- name: Run tests
26+
run: ./gradlew check

.github/workflows/publish-sdk.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish sdk to the Maven Central Repository
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- name: Set up Maven Central Repository
12+
uses: actions/setup-java@v4
13+
with:
14+
java-version: '8'
15+
distribution: 'temurin'
16+
server-id: ossrh
17+
server-username: MAVEN_USERNAME
18+
server-password: MAVEN_PASSWORD
19+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
20+
gpg-passphrase: GPG_PASSPHRASE
21+
22+
- name: Download test data
23+
run: make test-data
24+
25+
- name: Publish package with debug logging
26+
run: mvn --batch-mode deploy -X
27+
env:
28+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
29+
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
30+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
31+
32+
- name: Release the staging repository
33+
run: mvn nexus-staging:release -X
34+
env:
35+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
36+
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
37+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.gitignore

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,43 @@
1-
# Compiled class file
2-
*.class
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
36

4-
# Log file
5-
*.log
7+
### IntelliJ IDEA ###
8+
.idea/modules.xml
9+
.idea/jarRepositories.xml
10+
.idea/compiler.xml
11+
.idea/libraries/
12+
*.iws
13+
*.iml
14+
*.ipr
15+
out/
16+
!**/src/main/**/out/
17+
!**/src/test/**/out/
618

7-
# BlueJ files
8-
*.ctxt
19+
### Eclipse ###
20+
.apt_generated
21+
.classpath
22+
.factorypath
23+
.project
24+
.settings
25+
.springBeans
26+
.sts4-cache
27+
bin/
28+
!**/src/main/**/bin/
29+
!**/src/test/**/bin/
930

10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
31+
### NetBeans ###
32+
/nbproject/private/
33+
/nbbuild/
34+
/dist/
35+
/nbdist/
36+
/.nb-gradle/
1237

13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
38+
### VS Code ###
39+
.vscode/
2140

22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
24-
replay_pid*
41+
### Mac OS ###
42+
.DS_Store
43+
.idea/

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
# java-sdk-common
1+
# Eppo JVM common SDK
2+
3+
This is the common SDK for the Eppo JVM. It provides a set of classes and interfaces that are used by the Eppo JVM to
4+
interact with the Eppo API.

build.gradle

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
plugins {
2+
id 'java-library'
3+
id 'maven-publish'
4+
id 'signing'
5+
id "com.diffplug.spotless" version "6.13.0"
6+
}
7+
8+
group = 'cloud.eppo'
9+
version = '1.0.0-SNAPSHOT'
10+
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
11+
12+
dependencies {
13+
// TODO: Consolidate these into a single JSON parsing dependency
14+
// For RAC DTOs
15+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.1'
16+
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.1'
17+
implementation 'com.fasterxml.jackson.module:jackson-module-parameter-names:2.17.1'
18+
// For UFC DTOs
19+
implementation 'commons-codec:commons-codec:1.17.0'
20+
implementation "com.google.code.gson:gson:2.9.1"
21+
implementation 'org.slf4j:slf4j-api:2.0.13'
22+
testImplementation platform('org.junit:junit-bom:5.10.0')
23+
testImplementation 'org.junit.jupiter:junit-jupiter'
24+
testImplementation 'org.skyscreamer:jsonassert:1.5.1'
25+
testImplementation 'commons-io:commons-io:2.11.0'
26+
testImplementation "com.google.truth:truth:1.4.2"
27+
}
28+
29+
test {
30+
useJUnitPlatform()
31+
}
32+
33+
spotless {
34+
ratchetFrom 'origin/main'
35+
36+
format 'misc', {
37+
// define the files to apply `misc` to
38+
target '*.gradle', '.gitattributes', '.gitignore'
39+
40+
// define the steps to apply to those files
41+
trimTrailingWhitespace()
42+
indentWithSpaces(2) // or spaces. Takes an integer argument if you don't like 4
43+
endWithNewline()
44+
}
45+
java {
46+
// apply a specific flavor of google-java-format
47+
googleJavaFormat('1.7')
48+
// fix formatting of type annotations
49+
formatAnnotations()
50+
}
51+
}
52+
53+
java {
54+
withJavadocJar()
55+
withSourcesJar()
56+
}
57+
58+
publishing {
59+
publications {
60+
mavenJava(MavenPublication) {
61+
artifactId = 'sdk-common-jvm'
62+
from components.java
63+
versionMapping {
64+
usage('java-api') {
65+
fromResolutionOf('runtimeClasspath')
66+
}
67+
usage('java-runtime') {
68+
fromResolutionResult()
69+
}
70+
}
71+
pom {
72+
name = 'Eppo JVM SDK'
73+
description = 'Eppo SDK for JVM'
74+
url = 'https://github.com/Eppo-exp/sdk-common-jvm'
75+
licenses {
76+
license {
77+
name = 'MIT License'
78+
url = 'http://www.opensource.org/licenses/mit-license.php'
79+
}
80+
}
81+
developers {
82+
developer {
83+
name = 'Eppo'
84+
email = 'https://geteppo.com'
85+
}
86+
}
87+
scm {
88+
connection = 'scm:git:git://example.com/my-library.git'
89+
developerConnection = 'scm:git:ssh://example.com/my-library.git'
90+
url = 'http://example.com/my-library/'
91+
}
92+
}
93+
}
94+
}
95+
repositories {
96+
maven {
97+
// change URLs to point to your repos, e.g. http://my.org/repo
98+
def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
99+
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
100+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
101+
credentials {
102+
username = System.getenv("MAVEN_USERNAME") ? "$MAVEN_USERNAME" : ""
103+
password = System.getenv("MAVEN_PASSWORD") ? "$MAVEN_PASSWORD" : ""
104+
}
105+
}
106+
}
107+
}
108+
109+
signing {
110+
// only sign release versions
111+
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
112+
sign publishing.publications.mavenJava
113+
}
114+
115+
116+
javadoc {
117+
if (JavaVersion.current().isJava9Compatible()) {
118+
options.addBooleanOption('html5', true)
119+
}
120+
}

gradle.properties

Whitespace-only changes.

gradle/wrapper/gradle-wrapper.jar

59.3 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Thu Jun 06 13:59:33 PDT 2024
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)