Skip to content

Commit

Permalink
Setup publications for kompass-android and kompass-core
Browse files Browse the repository at this point in the history
  • Loading branch information
sellmair committed Apr 21, 2019
1 parent ea22ca3 commit 79c509c
Show file tree
Hide file tree
Showing 89 changed files with 97 additions and 36 deletions.
2 changes: 1 addition & 1 deletion android-example--fragment/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ dependencies {
androidTestImplementation(Deps.Android.X.testRules)
androidTestImplementation(Deps.Android.X.testRunner)
androidTestImplementation(Deps.Android.X.junit)
implementation(project(":android"))
implementation(project(":kompass-android"))
}
3 changes: 2 additions & 1 deletion android-test-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ androidExtensions {
isExperimental = true
}


dependencies {
api(Deps.Kotlin.StdLib.jdk)
api(Deps.Android.X.appCompat)
api(Deps.Android.X.espresso)
api(Deps.Android.X.testRunner)
api(Deps.Android.X.testRules)
api(Deps.Android.X.junit)
api(project(":android"))
api(project(":kompass-android"))
}
32 changes: 0 additions & 32 deletions android/build.gradle.kts

This file was deleted.

17 changes: 17 additions & 0 deletions buildSrc/src/main/kotlin/Library.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
object Library {
const val group = "io.sellmair"
const val version = "0.2.0-pre-alpha.0"

object Core {
const val name = "kompass-core"

object Jvm {
const val name = "kompass-core-jvm"
}
}

object Android {
const val name = "kompass-android"
}

}
65 changes: 65 additions & 0 deletions kompass-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
plugins {
id("com.android.library")
kotlin("android")
id("org.jetbrains.kotlin.android.extensions")
`maven-publish`
}

android {
compileSdkVersion(Project.Android.compileSdkVersion)
defaultConfig {
targetSdkVersion(Project.Android.targetSdkVersion)
minSdkVersion(Project.Android.minSdkVersion)
}
}

androidExtensions {
isExperimental = true
}

dependencies {
/* Kotlin */
implementation(Deps.Kotlin.StdLib.jdk)

/* Android X */
implementation(Deps.Android.X.lifecycleExtensions)
implementation(Deps.Android.X.lifecycleViewModel)
implementation(Deps.Android.X.fragment)


api(project(":kompass-core"))

}


//region Publishing

val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(android.sourceSets["main"].java.srcDirs)
}

publishing {
publications {
create<MavenPublication>("aar") {
groupId = Library.group
version = Library.version
artifactId = Library.Android.name

artifact(file("$buildDir/outputs/aar/kompass-android-release.aar"))
artifact(sourcesJar.get())

pom.withXml {
asNode().appendNode("dependencies").apply {
val dependencyNode = appendNode("dependency")
dependencyNode.appendNode("groupId", Library.group)
dependencyNode.appendNode("artifactId", Library.Core.Jvm.name)
dependencyNode.appendNode("version", Library.version)
}
}
}
}
}


//endregion
File renamed without changes.
10 changes: 10 additions & 0 deletions core/build.gradle.kts → kompass-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
@file:Suppress("UNUSED_VARIABLE")


plugins {
kotlin("multiplatform")
`maven-publish`
}


// TODO work around for https://youtrack.jetbrains.com/issue/KT-27170
configurations.create("compileClasspath")

group = Library.group
version = Library.version


kotlin {
macosX64("macos")
jvm("jvm")
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rootProject.name = 'kompass'

include ':core'
include ':android'
include ':kompass-core'
include ':kompass-android'
include ':android-test-base'
include ':android-test--fragment'
include ':android-example--fragment'
Expand Down

0 comments on commit 79c509c

Please sign in to comment.