Skip to content

Commit

Permalink
Add signing and publication
Browse files Browse the repository at this point in the history
  • Loading branch information
prem-p-simform committed Jun 7, 2024
1 parent 7b986e0 commit ef5fdd4
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 49 deletions.
2 changes: 2 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ app/.idea/

# Temporary API docs
docs/api

artifacts
2 changes: 2 additions & 0 deletions android/bagel/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ app/.idea/

# Temporary API docs
docs/api

*.gpg
97 changes: 48 additions & 49 deletions android/bagel/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,63 @@
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.SonatypeHost

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.kotlinx.serialization)
id("maven-publish")
alias(libs.plugins.vanniktechMavenPublish)
}

android {
namespace = "com.simform.bagel"
compileSdk = libs.versions.compileSdk.get().toInt()
mavenPublishing {
coordinates("com.simform", "bagel", "1.0.0")
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = false)
configure(AndroidSingleVariantLibrary())

publishing {
singleVariant("release") {
withSourcesJar()
pom {
packaging = "aar"
name.set("Bagel")
description.set("Bagel is a little native iOS/Android network debugger")
url.set("https://github.com/mobile-simformsolutions/Bagel.git")
inceptionYear.set("2024")

licenses {
license {
name.set("Apache License Version 2.0, January 2004")
url.set("https://github.com/mobile-simformsolutions/Bagel?tab=License-1-ov-file")
}
}

developers {
developer {
id.set("simform")
name.set("Simform")
email.set("[email protected]")
}
}

scm {
connection.set("scm:[email protected]:mobile-simformsolutions/Bagel")
developerConnection.set("scm:[email protected]:mobile-simformsolutions/Bagel.git")
url.set("https://github.com/mobile-simformsolutions/Bagel.git")
}
}

signAllPublications()
}

android {
namespace = "com.simform.bagel"
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
compileSdk = libs.versions.compileSdk.get().toInt()

aarMetadata {
minCompileSdk = libs.versions.minSdk.get().toInt()
}

multiDexEnabled = true

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
Expand All @@ -40,48 +81,6 @@ android {
}
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>("release") {
from(components["release"])
groupId = "com.simform"
artifactId = "bagel"
version = "1.0.0"

pom {
packaging = "aar"
name.set("Bagel")
description.set("Bagel is a little native iOS/Android network debugger")
url.set("https://github.com/mobile-simformsolutions/Bagel.git")
inceptionYear.set("2024")

licenses {
license {
name.set("Apache License Version 2.0, January 2004")
url.set("https://github.com/mobile-simformsolutions/Bagel?tab=License-1-ov-file")
}
}

developers {
developer {
id.set("simform")
name.set("Simform")
email.set("[email protected]")
}
}

scm {
connection.set("scm:[email protected]:mobile-simformsolutions/Bagel")
developerConnection.set("scm:[email protected]:mobile-simformsolutions/Bagel.git")
url.set("https://github.com/mobile-simformsolutions/Bagel.git")
}
}
}
}
}
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
Expand Down
30 changes: 30 additions & 0 deletions android/gradle.defaults.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

mavenCentralUsername=
mavenCentralPassword=

signing.keyId=0x00000000
signing.password=
signing.secretKeyRingFile=
2 changes: 2 additions & 0 deletions android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ appcompat = "1.6.1"
material = "1.12.0"
hiltNavigationCompose = "1.2.0"
socketIoClient = "2.1.0"
vanniktechMavenPublish = "0.28.0"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand Down Expand Up @@ -65,3 +66,4 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
android-library = { id = "com.android.library", version.ref = "agp" }
vanniktechMavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktechMavenPublish" }

0 comments on commit ef5fdd4

Please sign in to comment.