Skip to content

Commit ad463a2

Browse files
committed
feat: add android-sdk-framework module
Add the android-sdk-framework module — a library-independent base layer for the Eppo Android SDK. Provides: - AndroidBaseClient<ConfigurationType, JsonFlagType>: generic client extending BaseEppoClient with Android lifecycle, polling, caching - CachingConfigurationStore<C>: extends AbstractConfigurationStore with ByteStore + ConfigurationCodec persistence - ConfigurationCodec<C>: serialization interface (default: Java serialization) - ByteStore / FileBackedByteStore: async byte I/O for app-private storage - FileBackedConfigStore: convenience wrapper Depends on eppo-sdk-framework 0.1.0 (2-param generics from sdk-common-jdk #243, AbstractConfigurationStore from #248).
1 parent d717515 commit ad463a2

21 files changed

Lines changed: 5487 additions & 5 deletions

.github/workflows/publish-snapshot.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish SDK Snapshot artifact
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, 'snapshot/**']
66

77
env:
88
CI: true
@@ -28,10 +28,14 @@ jobs:
2828
java-version: 17
2929
distribution: 'adopt'
3030

31-
- name: Stage snapshot artifact
32-
run: ./gradlew eppo:assemble eppo:publish -Psnapshot
31+
- name: Stage snapshot artifacts
32+
run: ./gradlew android-sdk-framework:assemble android-sdk-framework:publish eppo:assemble eppo:publish -Psnapshot
3333

34-
- name: Publish Snapshot to Maven Central Portal
34+
- name: Publish framework snapshot to Maven Central Portal
35+
working-directory: android-sdk-framework
36+
run: ../gradlew publishAllPublicationsToMavenCentralRepository -Psnapshot --no-daemon --stacktrace
37+
38+
- name: Publish SDK snapshot to Maven Central Portal
3539
working-directory: eppo
3640
run: ../gradlew publishAllPublicationsToMavenCentralRepository -Psnapshot --no-daemon --stacktrace
3741

android-sdk-framework/build.gradle

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'maven-publish'
4+
id "com.vanniktech.maven.publish" version "0.32.0"
5+
id 'signing'
6+
id "com.diffplug.spotless" version "8.0.0"
7+
}
8+
9+
group = "cloud.eppo"
10+
version = "0.1.0-SNAPSHOT"
11+
12+
android {
13+
namespace "cloud.eppo.android.framework"
14+
compileSdk 34
15+
16+
buildFeatures.buildConfig true
17+
18+
defaultConfig {
19+
minSdk 26
20+
targetSdk 34
21+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
22+
}
23+
24+
buildTypes {
25+
def FRAMEWORK_VERSION = "FRAMEWORK_VERSION"
26+
def EPPO_VERSION = "EPPO_VERSION"
27+
release {
28+
minifyEnabled false
29+
buildConfigField "String", FRAMEWORK_VERSION, "\"${project.version}\""
30+
buildConfigField "String", EPPO_VERSION, "\"${project.version}\""
31+
}
32+
debug {
33+
minifyEnabled false
34+
buildConfigField "String", FRAMEWORK_VERSION, "\"${project.version}\""
35+
buildConfigField "String", EPPO_VERSION, "\"${project.version}\""
36+
}
37+
}
38+
39+
compileOptions {
40+
sourceCompatibility JavaVersion.VERSION_1_8
41+
targetCompatibility JavaVersion.VERSION_1_8
42+
}
43+
44+
testOptions {
45+
unitTests.returnDefaultValues = true
46+
}
47+
}
48+
49+
dependencies {
50+
api 'cloud.eppo:eppo-sdk-framework:0.1.0'
51+
52+
api 'com.google.code.gson:gson:2.10.1'
53+
api 'org.slf4j:slf4j-android:1.7.36'
54+
compileOnly 'org.jetbrains:annotations:24.0.0'
55+
56+
testImplementation 'cloud.eppo:sdk-common-jvm:4.0.0'
57+
testImplementation 'junit:junit:4.13.2'
58+
testImplementation 'org.mockito:mockito-core:5.14.2'
59+
testImplementation 'org.robolectric:robolectric:4.12.1'
60+
61+
androidTestImplementation 'junit:junit:4.13.2'
62+
androidTestImplementation 'org.mockito:mockito-android:5.14.2'
63+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
64+
androidTestImplementation 'androidx.test:core:1.6.1'
65+
androidTestImplementation 'androidx.test:runner:1.6.2'
66+
androidTestImplementation 'com.fasterxml.jackson.core:jackson-databind:2.19.1'
67+
}
68+
69+
spotless {
70+
format 'misc', {
71+
target '*.gradle', '.gitattributes', '.gitignore'
72+
73+
trimTrailingWhitespace()
74+
leadingTabsToSpaces(2)
75+
endWithNewline()
76+
}
77+
java {
78+
target '**/*.java'
79+
80+
googleJavaFormat()
81+
formatAnnotations()
82+
}
83+
}
84+
85+
signing {
86+
if (System.getenv("GPG_PRIVATE_KEY") && System.getenv("GPG_PASSPHRASE")) {
87+
useInMemoryPgpKeys(System.env.GPG_PRIVATE_KEY, System.env.GPG_PASSPHRASE)
88+
}
89+
90+
sign publishing.publications
91+
}
92+
93+
tasks.withType(Sign) {
94+
onlyIf {
95+
(System.getenv("GPG_PRIVATE_KEY") && System.getenv("GPG_PASSPHRASE")) ||
96+
(project.hasProperty('signing.keyId') &&
97+
project.hasProperty('signing.password') &&
98+
project.hasProperty('signing.secretKeyRingFile'))
99+
}
100+
}
101+
102+
mavenPublishing {
103+
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
104+
signAllPublications()
105+
coordinates("cloud.eppo", "android-sdk-framework", project.version)
106+
107+
pom {
108+
name = 'Eppo Android SDK Framework'
109+
description = 'Android SDK Framework for Eppo - Library-independent EppoClient and PrecomputedEppoClient (abstracts JSON, HTTP, storage)'
110+
url = 'https://github.com/Eppo-exp/android-sdk'
111+
licenses {
112+
license {
113+
name = 'MIT License'
114+
url = 'http://www.opensource.org/licenses/mit-license.php'
115+
}
116+
}
117+
developers {
118+
developer {
119+
name = 'Eppo'
120+
email = 'https://www.geteppo.com'
121+
}
122+
}
123+
scm {
124+
connection = 'scm:git:git://github.com/Eppo-exp/android-sdk.git'
125+
developerConnection = 'scm:git:ssh://github.com/Eppo-exp/android-sdk.git'
126+
url = 'https://github.com/Eppo-exp/android-sdk/tree/main'
127+
}
128+
}
129+
}
130+
131+
task checkVersion {
132+
doLast {
133+
if (!project.hasProperty('release') && !project.hasProperty('snapshot')) {
134+
throw new GradleException("You must specify either -Prelease or -Psnapshot")
135+
}
136+
if (project.hasProperty('release') && project.version.endsWith('SNAPSHOT')) {
137+
throw new GradleException("You cannot specify -Prelease with a SNAPSHOT version")
138+
}
139+
if (project.hasProperty('snapshot') && !project.version.endsWith('SNAPSHOT')) {
140+
throw new GradleException("You cannot specify -Psnapshot with a non-SNAPSHOT version")
141+
}
142+
project.ext.shouldPublish = true
143+
}
144+
}
145+
146+
tasks.named('publish').configure {
147+
dependsOn checkVersion
148+
}
149+
150+
tasks.withType(PublishToMavenRepository) {
151+
onlyIf {
152+
project.ext.has('shouldPublish') && project.ext.shouldPublish
153+
}
154+
}

0 commit comments

Comments
 (0)