Skip to content

Commit a88e967

Browse files
authored
Merge pull request #1 from formbricks/feat/v0.0.1
feat: android sdk
2 parents b0356d4 + acb7be7 commit a88e967

Some content is hidden

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

66 files changed

+3449
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# .github/workflows/publish-to-maven-central.yml
2+
3+
name: Publish to Maven Central
4+
on:
5+
release:
6+
types: [released]
7+
8+
jobs:
9+
publish-release:
10+
name: Release build and publish
11+
runs-on: macOS-latest
12+
steps:
13+
# 1. Checkout code
14+
- name: Check out code
15+
uses: actions/checkout@v4
16+
17+
# 2. Set up JDK 21
18+
19+
- name: Set up JDK 21
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: "zulu"
23+
java-version: 21
24+
25+
# 3. Publish to Maven Central
26+
27+
- name: Publish to MavenCentral
28+
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
29+
env:
30+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
31+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
32+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
33+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
34+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/
5+
.DS_Store
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
.cxx
10+
local.properties

android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

android/build.gradle.kts

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import com.vanniktech.maven.publish.SonatypeHost
2+
3+
plugins {
4+
id("com.android.library")
5+
kotlin("android")
6+
kotlin("kapt")
7+
kotlin("plugin.serialization") version "2.1.0"
8+
id("org.jetbrains.dokka") version "1.9.10"
9+
id("jacoco")
10+
id("com.vanniktech.maven.publish") version "0.31.0"
11+
}
12+
13+
version = "0.0.5"
14+
val groupId = "com.formbricks"
15+
val artifactId = "android"
16+
17+
android {
18+
namespace = "com.formbricks.android"
19+
compileSdk = 35
20+
21+
defaultConfig {
22+
minSdk = 24
23+
24+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
25+
consumerProguardFiles("consumer-rules.pro")
26+
}
27+
28+
buildTypes {
29+
getByName("debug") {
30+
enableAndroidTestCoverage = true
31+
}
32+
release {
33+
isMinifyEnabled = true
34+
proguardFiles(
35+
getDefaultProguardFile("proguard-android-optimize.txt"),
36+
"proguard-rules.pro"
37+
)
38+
}
39+
}
40+
41+
packaging {
42+
resources {
43+
excludes += "META-INF/library_release.kotlin_module"
44+
excludes += "classes.dex"
45+
excludes += "**.**"
46+
pickFirsts += "**/DataBinderMapperImpl.java"
47+
pickFirsts += "**/DataBinderMapperImpl.class"
48+
pickFirsts += "**/formbrickssdk/DataBinderMapperImpl.java"
49+
pickFirsts += "**/formbrickssdk/DataBinderMapperImpl.class"
50+
}
51+
}
52+
buildFeatures {
53+
dataBinding = true
54+
viewBinding = true
55+
}
56+
compileOptions {
57+
sourceCompatibility = JavaVersion.VERSION_11
58+
targetCompatibility = JavaVersion.VERSION_11
59+
}
60+
kotlinOptions {
61+
jvmTarget = "11"
62+
}
63+
}
64+
65+
tasks.withType<Test>().configureEach {
66+
extensions.configure<JacocoTaskExtension> {
67+
isIncludeNoLocationClasses = true
68+
excludes = listOf(
69+
"jdk.internal.*",
70+
)
71+
}
72+
}
73+
74+
dependencies {
75+
implementation(libs.androidx.core.ktx)
76+
implementation(libs.androidx.annotation)
77+
implementation(libs.androidx.appcompat)
78+
79+
implementation(libs.gson)
80+
implementation(libs.retrofit)
81+
implementation(libs.retrofit.converter.gson)
82+
implementation(libs.retrofit.converter.scalars)
83+
implementation(libs.okhttp3.logging.interceptor)
84+
85+
implementation(libs.material)
86+
87+
implementation(libs.kotlinx.serialization.json)
88+
implementation(libs.androidx.legacy.support.v4)
89+
implementation(libs.androidx.lifecycle.livedata.ktx)
90+
implementation(libs.androidx.lifecycle.viewmodel.ktx)
91+
implementation(libs.androidx.fragment.ktx)
92+
implementation(libs.androidx.databinding.common)
93+
94+
testImplementation(libs.junit)
95+
androidTestImplementation(libs.androidx.junit)
96+
androidTestImplementation(libs.androidx.espresso.core)
97+
}
98+
99+
mavenPublishing {
100+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
101+
102+
signAllPublications()
103+
104+
coordinates(groupId, artifactId, version.toString())
105+
106+
pom {
107+
name = "Formbricks Android SDK"
108+
description = "Formbricks anroid SDK"
109+
url = "https://github.com/formbricks/android"
110+
licenses {
111+
license {
112+
name = "MIT License"
113+
url = "https://opensource.org/licenses/MIT"
114+
}
115+
}
116+
developers {
117+
developer {
118+
id = "formbricks"
119+
name = "Formbricks"
120+
121+
}
122+
}
123+
scm {
124+
connection = "scm:git:git://github.com/formbricks/android.git"
125+
developerConnection = "scm:git:ssh://github.com:formbricks/android.git"
126+
url = "https://github.com/formbricks/android"
127+
}
128+
}
129+
}

android/consumer-rules.pro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-keep class com.formbricks.android.DataBinderMapperImpl { *; }
2+
-keep class com.formbricks.android.Formbricks { *; }
3+
-keep class com.formbricks.android.helper.FormbricksConfig { *; }
4+
-keep class com.formbricks.android.model.error.SDKError { *; }
5+
-keep interface com.formbricks.android.FormbricksCallback { *; }

android/proguard-rules.pro

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
-keeppackagenames com.formbricks.**
9+
10+
-keep class com.formbricks.** { *; }
11+
12+
-keepclassmembers,allowobfuscation class * {
13+
@com.google.gson.annotations.SerializedName <fields>;
14+
}
15+
16+
-keepattributes SourceFile,LineNumberTable,Exceptions,InnerClasses,Signature,Deprecated,*Annotation*,EnclosingMethod
17+
18+
# add all known-to-be-safely-shrinkable classes to the beginning of line below
19+
-keep class !androidx.legacy.**,!com.google.android.**,!androidx.** { *; }
20+
-keep class android.support.v4.app.** { *; }
21+
22+
# Retrofit
23+
-dontwarn okio.**
24+
-keep class com.squareup.okhttp.** { *; }
25+
-keep interface com.squareup.okhttp.** { *; }
26+
-keep class retrofit.** { *; }
27+
-dontwarn com.squareup.okhttp.**
28+
29+
-keep class retrofit.** { *; }
30+
-keepclasseswithmembers class * {
31+
@retrofit.http.* <methods>;
32+
}
33+
34+
-keep class com.formbricks.android.DataBinderMapperImpl { *; }
35+
-keep class com.formbricks.android.Formbricks { *; }
36+
-keep class com.formbricks.android.helper.FormbricksConfig { *; }
37+
-keep class com.formbricks.android.model.error.SDKError { *; }
38+
-keep interface com.formbricks.android.FormbricksCallback { *; }
39+
40+
# Keep StringConcatFactory and related classes
41+
-keep class java.lang.invoke.StringConcatFactory { *; }
42+
-keep class java.lang.invoke.MethodHandles { *; }
43+
-keep class java.lang.invoke.MethodHandle { *; }
44+
-keep class java.lang.invoke.MethodType { *; }
45+
-dontwarn java.lang.invoke.StringConcatFactory
46+
47+
# Keep DataBinding classes
48+
-keep class androidx.databinding.** { *; }

0 commit comments

Comments
 (0)