Skip to content

Commit

Permalink
[#5] Attempting setup for multimodule jitpack support (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssawchenko authored Jan 26, 2024
1 parent 6776305 commit 768be5d
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/steamclock/steamock/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class MainActivity : ComponentActivity() {
// be setup via dependency injection.
//=================================================================
private val postmanConfig = PostmanMockConfig(
postmanAccessKey = com.steamclock.steamock.lib.BuildConfig.postmanAccessKey,
mockCollectionId = com.steamclock.steamock.lib.BuildConfig.postmanMockCollectionId,
mockServerUrl = com.steamclock.steamock.lib.BuildConfig.postmanMockServerUrl,
postmanAccessKey = com.steamclock.steamock.lib_core.BuildConfig.postmanAccessKey,
mockCollectionId = com.steamclock.steamock.lib_core.BuildConfig.postmanMockCollectionId,
mockServerUrl = com.steamclock.steamock.lib_core.BuildConfig.postmanMockServerUrl,
json = appJson,
logCalls = true
)
Expand Down
9 changes: 8 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.1" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
id("com.android.library") version "8.1.1" apply false
id("org.jetbrains.kotlin.jvm") version "1.9.0"
}

subprojects {
/**
* Setup maven-publish on all modules; see each module for publication details.
*/
apply(plugin = "maven-publish")
}
25 changes: 24 additions & 1 deletion lib-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,31 @@ plugins {
kotlin("plugin.serialization") version "1.9.21"
}

//============================================================
// Maven/Jitpack Publishing
//============================================================
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(android.sourceSets.getByName("main").java.srcDirs)
}

afterEvaluate {
publishing {
publications {
val release by publications.registering(MavenPublication::class) {
from(components["release"])
artifact(sourcesJar.get())
artifactId = "lib-core"
groupId = "com.github.steamclock.steamock-android"
version = "1.0"
}
}
}
}
//============================================================

android {
namespace = "com.steamclock.steamock.lib"
namespace = "com.steamclock.steamock.lib_core"
compileSdk = 34

// Postman mocking setup pulled from local.properties
Expand Down
23 changes: 23 additions & 0 deletions lib-ktor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@ plugins {
id("org.jetbrains.kotlin.android")
}

//============================================================
// Maven/Jitpack Publishing
//============================================================
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(android.sourceSets.getByName("main").java.srcDirs)
}

afterEvaluate {
publishing {
publications {
val release by publications.registering(MavenPublication::class) {
from(components["release"])
artifact(sourcesJar.get())
artifactId = "lib-ktor"
groupId = "com.github.steamclock.steamock-android"
version = "1.0"
}
}
}
}
//============================================================

android {
namespace = "com.steamclock.steamock.lib_ktor"
compileSdk = 33
Expand Down
23 changes: 23 additions & 0 deletions lib-retrofit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@ plugins {
id("org.jetbrains.kotlin.android")
}

//============================================================
// Maven/Jitpack Publishing
//============================================================
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(android.sourceSets.getByName("main").java.srcDirs)
}

afterEvaluate {
publishing {
publications {
val release by publications.registering(MavenPublication::class) {
from(components["release"])
artifact(sourcesJar.get())
artifactId = "lib-retrofit"
groupId = "com.github.steamclock.steamock-android"
version = "1.0"
}
}
}
}
//============================================================

android {
namespace = "com.steamclock.steamock.lib_retrofit"
compileSdk = 33
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://www.jitpack.io" ) }
}
}

Expand Down

0 comments on commit 768be5d

Please sign in to comment.