Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 153 additions & 0 deletions eppo-android-common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
plugins {
id 'com.android.library'
id 'maven-publish'
id "com.vanniktech.maven.publish" version "0.32.0"
id 'signing'
id "com.diffplug.spotless" version "8.0.0"
}

group = "cloud.eppo"
version = "4.12.1"

android {
buildFeatures.buildConfig false
compileSdk 34

defaultConfig {
// Use a different namespace to avoid conflicts with the framework module
// The code still uses cloud.eppo.android packages, but the Android namespace is different
namespace "cloud.eppo.android.common"
minSdk 26
targetSdk 34
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
matchingFallbacks = ['release']
}

debug {
minifyEnabled false
matchingFallbacks = ['debug']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests.returnDefaultValues = true
}
packagingOptions {
resources {
excludes += "META-INF/**"
}
}
}

dependencies {
// API dependency on framework (for compilation)
api project(':eppo')

// These will be added in PR4 when we add default implementations
// implementation 'cloud.eppo:eppo-sdk-common:4.0.0-SNAPSHOT'
// implementation "com.squareup.okhttp3:okhttp:4.12.0"
// implementation "com.fasterxml.jackson.core:jackson-databind:2.19.1"
}

spotless {
format 'misc', {
target '*.gradle', '.gitattributes', '.gitignore'

trimTrailingWhitespace()
leadingTabsToSpaces(2)
endWithNewline()
}
java {
target '**/*.java'

googleJavaFormat()
formatAnnotations()
}
}

signing {
if (System.getenv("GPG_PRIVATE_KEY") && System.getenv("GPG_PASSPHRASE")) {
// Use in-memory keys for CI builds
useInMemoryPgpKeys(System.env.GPG_PRIVATE_KEY, System.env.GPG_PASSPHRASE)
}

sign publishing.publications // Sign all Maven publications
}

// Make sure signing tasks only run if configured correctly
tasks.withType(Sign) {
onlyIf {
(System.getenv("GPG_PRIVATE_KEY") && System.getenv("GPG_PASSPHRASE")) ||
(project.hasProperty('signing.keyId') &&
project.hasProperty('signing.password') &&
project.hasProperty('signing.secretKeyRingFile'))
}
}

// For backward compatibility, keep same artifact ID
mavenPublishing {
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
coordinates("cloud.eppo", "android-sdk", project.version)

pom {
name = 'Eppo Android'
description = 'Eppo Android SDK - batteries-included with OkHttp and Jackson'
url = 'https://github.com/Eppo-exp/android-sdk'
licenses {
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
name = 'Eppo'
email = 'https://www.geteppo.com'
}
}
scm {
connection = 'scm:git:git://github.com/Eppo-exp/android-sdk.git'
developerConnection = 'scm:git:ssh://github.com/Eppo-exp/android-sdk.git'
url = 'https://github.com/Eppo-exp/android-sdk/tree/main'
}
}
}

// Custom task to ensure we can conditionally publish either a release or snapshot artifact
// based on a command line switch. See github workflow files for more details on usage.
task checkVersion {
doLast {
if (!project.hasProperty('release') && !project.hasProperty('snapshot')) {
throw new GradleException("You must specify either -Prelease or -Psnapshot")
}
if (project.hasProperty('release') && project.version.endsWith('SNAPSHOT')) {
throw new GradleException("You cannot specify -Prelease with a SNAPSHOT version")
}
if (project.hasProperty('snapshot') && !project.version.endsWith('SNAPSHOT')) {
throw new GradleException("You cannot specify -Psnapshot with a non-SNAPSHOT version")
}
project.ext.shouldPublish = true
}
}

// Ensure checkVersion runs before publishing
tasks.named('publish').configure {
dependsOn checkVersion
}

// Conditionally enable or disable publishing tasks
tasks.withType(PublishToMavenRepository) {
onlyIf {
project.ext.has('shouldPublish') && project.ext.shouldPublish
}
}
2 changes: 2 additions & 0 deletions eppo-android-common/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Consumer ProGuard rules for eppo-android-common (batteries-included)
# These rules are included in apps that use this library
3 changes: 3 additions & 0 deletions eppo-android-common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
6 changes: 3 additions & 3 deletions eppo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ tasks.withType(Sign) {
mavenPublishing {
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
coordinates("cloud.eppo", "android-sdk", project.version)
coordinates("cloud.eppo", "android-sdk-framework", project.version)

pom {
name = 'Eppo Android'
description = 'Eppo Android SDK'
name = 'Eppo Android Framework'
description = 'Eppo Android SDK Framework - requires HTTP and parser implementations'
url = 'https://github.com/Eppo-exp/android-sdk'
licenses {
license {
Expand Down
2 changes: 1 addition & 1 deletion example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
implementation project(path: ':eppo')
implementation project(path: ':eppo-android-common')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ dependencyResolutionManagement {
rootProject.name = "Eppo SDK"
include ':example'
include ':eppo'
include ':eppo-android-common'
Loading