Skip to content

Commit

Permalink
Merge pull request #225 from NordicSemiconductor/version/2
Browse files Browse the repository at this point in the history
Version 2.0.0
  • Loading branch information
philips77 authored Mar 8, 2024
2 parents 418f6a3 + 27cd724 commit 73c86c3
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 112 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ List of plugins currently available in the repository:
4. [no.nordicsemi.android.library.compose](plugins/src/main/kotlin/AndroidLibraryComposeConventionPlugin.kt)
5. [no.nordicsemi.android.feature](plugins/src/main/kotlin/AndroidFeatureConventionPlugin.kt)
6. [no.nordicsemi.android.kotlin](plugins/src/main/kotlin/AndroidKotlinConventionPlugin.kt)
6. [no.nordicsemi.android.hilt](plugins/src/main/kotlin/AndroidHiltConventionPlugin.kt)
6. [no.nordicsemi.android.gradle.nexus](plugins/src/main/kotlin/AndroidNexusRepositoryPlugin.kt)
7. [no.nordicsemi.android.hilt](plugins/src/main/kotlin/AndroidHiltConventionPlugin.kt)
8. [no.nordicsemi.android.gradle.nexus](plugins/src/main/kotlin/AndroidNexusRepositoryPlugin.kt)
9. [no.nordicsemi.kotlin.gradle.nexus](plugins/src/main/kotlin/KotlinNexusRepositoryPlugin.kt)

Plugins are released to Nexus repository and are available by their ids and version number.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
id 'org.jetbrains.kotlin.android' version '1.9.20' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
}

Expand Down
31 changes: 19 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ androidxActivity = "1.8.2"
androidxAnnotation = "1.7.1"
androidxAppCompat = "1.6.1"
androidxComposeBom = "2024.02.01" # https://developer.android.com/jetpack/compose/bom/bom-mapping
androidxComposeCompiler = "1.5.8" # https://developer.android.com/jetpack/androidx/releases/compose-kotlin
androidxComposeCompiler = "1.5.10" # https://developer.android.com/jetpack/androidx/releases/compose-kotlin
androidxComposeRuntimeTracing = "1.0.0-beta01"
androidxCore = "1.12.0"
androidxCoreSplashscreen = "1.0.1"
Expand Down Expand Up @@ -57,7 +57,8 @@ timber = "5.0.1"
chart = "v3.1.0"
leakcanary = "2.13"
mockk = "1.13.10"
slf4j = "2.0.12"
slf4j = "1.7.36" # don't update to 2.x, unless the next one is also updated
slf4j-timber = "3.1" # <- this one
robolectric = "4.11.1"
skydovesBallon = "1.6.4"
moshiKotlin = "1.15.1"
Expand All @@ -74,15 +75,16 @@ kmmVoyager = "1.0.0"
kmmLogs = "2.7.1"
gson = "2.10.1"

nordic-blek = "1.0.15"
nordic-blek = "2.0.0"
nordic-ble = "2.7.3"
nordic-dfu = "2.4.2"
nordic-log = "2.3.0"
nordic-data = "1.0.0"
nordic-mcumgr = "1.9.2"
nordic-scanner = "1.6.0"
nordic-common = "1.9.4"
nordic-common = "2.0.0"
nordic-memfault = "1.0.2"
nordicPlugins = "1.11.1"
nordicPlugins = "2.0.0"
dokkaPlugin = "1.9.20"
googleServicesPlugins = "4.4.0"
firebaseCrashlyticsPlugins = "2.9.9"
Expand All @@ -101,6 +103,7 @@ androidx-activity-compose = { group = "androidx.activity", name = "activity-comp
androidx-annotation = { group = "androidx.annotation", name = "annotation", version.ref = "androidxAnnotation" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidxAppCompat" }
androidx-benchmark-macro = { group = "androidx.benchmark", name = "benchmark-macro-junit4", version.ref = "androidxMacroBenchmark" }
androidx-compose-compiler = { group = "androidx.compose.compiler", name = "compiler", version.ref = "androidxComposeCompiler" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }
androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" }
androidx-compose-foundation-layout = { group = "androidx.compose.foundation", name = "foundation-layout" }
Expand Down Expand Up @@ -196,7 +199,8 @@ memfault-cloud = { group = "com.memfault.cloud", name = "cloud-android", version
timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "timber" }
chart = { group = "com.github.PhilJay", name = "MPAndroidChart", version.ref = "chart" }
leakcanary = { group = "com.squareup.leakcanary", name = "leakcanary-android", version.ref = "leakcanary" }
test-slf4j-simple = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j" }
slf4j = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j" }
slf4j-timber = { group = "com.arcao", name = "slf4j-timber", version.ref = "slf4j-timber" }
test-mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
test-robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" }
skydoves-ballon = { group = "com.github.skydoves", name = "balloon-compose", version.ref = "skydovesBallon" }
Expand All @@ -220,26 +224,28 @@ nordic-mcumgr-core = { group = "no.nordicsemi.android", name = "mcumgr-core", ve
nordic-mcumgr-ble = { group = "no.nordicsemi.android", name = "mcumgr-ble", version.ref = "nordic-mcumgr" }
nordic-log = { group = "no.nordicsemi.android", name = "log", version.ref = "nordic-log" }
nordic-log-timber = { group = "no.nordicsemi.android", name = "log-timber", version.ref = "nordic-log" }
nordic-scanner = { group = "no.nordicsemi.android.support.v18", name = "scanner", version.ref = "nordic-scanner" }
nordic-compat-scanner = { group = "no.nordicsemi.android.support.v18", name = "scanner", version.ref = "nordic-scanner" }
nordic-kotlin-data = { group = "no.nordicsemi.kotlin", name = "data", version.ref = "nordic-data" }
nordic-core = { group = "no.nordicsemi.android.common", name = "core", version.ref = "nordic-common" }
nordic-theme = { group = "no.nordicsemi.android.common", name = "theme", version.ref = "nordic-common" }
nordic-analytics = { group = "no.nordicsemi.android.common", name = "analytics", version.ref = "nordic-common" }
nordic-navigation = { group = "no.nordicsemi.android.common", name = "navigation", version.ref = "nordic-common" }
nordic-uilogger = { group = "no.nordicsemi.android.common", name = "uilogger", version.ref = "nordic-common" }
nordic-logger = { group = "no.nordicsemi.android.common", name = "logger", version.ref = "nordic-common" }
nordic-scanner = { group = "no.nordicsemi.android.common", name = "scanner", version.ref = "nordic-common" }
nordic-permissions-nfc = { group = "no.nordicsemi.android.common", name = "permissions-nfc", version.ref = "nordic-common" }
nordic-permissions-ble = { group = "no.nordicsemi.android.common", name = "permissions-ble", version.ref = "nordic-common" }
nordic-permissions-internet = { group = "no.nordicsemi.android.common", name = "permissions-internet", version.ref = "nordic-common" }
nordic-memfault = { group = "no.nordicsemi.android", name = "memfault", version.ref = "nordic-memfault" }

# BleK
nordic-blek-client = { group = "no.nordicsemi.android.kotlin.ble", name = "client", version.ref = "nordic-blek" }
nordic-blek-server = { group = "no.nordicsemi.android.kotlin.ble", name = "server", version.ref = "nordic-blek" }
nordic-blek-client-android = { group = "no.nordicsemi.android.kotlin.ble", name = "client-android", version.ref = "nordic-blek" }
nordic-blek-client-mock = { group = "no.nordicsemi.android.kotlin.ble", name = "client-mock", version.ref = "nordic-blek" }
nordic-blek-server-android = { group = "no.nordicsemi.android.kotlin.ble", name = "server-android", version.ref = "nordic-blek" }
nordic-blek-server-mock = { group = "no.nordicsemi.android.kotlin.ble", name = "server-mock", version.ref = "nordic-blek" }
nordic-blek-profile = { group = "no.nordicsemi.android.kotlin.ble", name = "profile", version.ref = "nordic-blek" }
nordic-blek-core = { group = "no.nordicsemi.android.kotlin.ble", name = "core", version.ref = "nordic-blek" }
nordic-blek-scanner = { group = "no.nordicsemi.android.kotlin.ble", name = "scanner", version.ref = "nordic-blek" }
nordic-blek-advertiser = { group = "no.nordicsemi.android.kotlin.ble", name = "advertiser", version.ref = "nordic-blek" }
nordic-blek-uiscanner = { group = "no.nordicsemi.android.kotlin.ble", name = "uiscanner", version.ref = "nordic-blek" }

# Dependencies of the included build-logic
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
Expand All @@ -253,7 +259,8 @@ nordic-library-compose = { id = "no.nordicsemi.android.gradle.library.compose",
nordic-feature = { id = "no.nordicsemi.android.gradle.feature", version.ref = "nordicPlugins" }
nordic-hilt = { id = "no.nordicsemi.android.gradle.hilt", version.ref = "nordicPlugins" }
nordic-kotlin = { id = "no.nordicsemi.android.gradle.kotlin", version.ref = "nordicPlugins" }
nordic-nexus = { id = "no.nordicsemi.android.gradle.nexus", version.ref = "nordicPlugins" }
nordic-nexus-android = { id = "no.nordicsemi.android.gradle.nexus", version.ref = "nordicPlugins" }
nordic-nexus-kotlin = { id = "no.nordicsemi.kotlin.gradle.nexus", version.ref = "nordicPlugins" }
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" }
Expand Down
23 changes: 15 additions & 8 deletions plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,62 +66,69 @@ gradlePlugin {

gradlePlugin {
plugins {
register("application.compose") {
register("android.application.compose") {
id = "no.nordicsemi.android.gradle.application.compose"
displayName = "Application with Compose"
description = "Application plugin extension with Compose and Material3 dependencies. This plugin includes 'application' plugin."
implementationClass = "AndroidApplicationComposeConventionPlugin"
tags.set(listOf("nordicsemi", "Android", "application", "compose"))
}
register("application") {
register("android.application") {
id = "no.nordicsemi.android.gradle.application"
displayName = "Standalone Application configuration"
description = "Application plugin extension"
implementationClass = "AndroidApplicationConventionPlugin"
tags.set(listOf("nordicsemi", "Android", "application"))
}
register("library.compose") {
register("android.library.compose") {
id = "no.nordicsemi.android.gradle.library.compose"
displayName = "Library with Compose"
description = "Library plugin extension with Compose and Material3 dependencies. This plugin extends 'library' plugin."
implementationClass = "AndroidLibraryComposeConventionPlugin"
tags.set(listOf("nordicsemi", "Android", "library", "compose"))
}
register("library") {
register("android.library") {
id = "no.nordicsemi.android.gradle.library"
displayName = "Standalone library configuration"
description = "Library plugin extension"
implementationClass = "AndroidLibraryConventionPlugin"
tags.set(listOf("nordicsemi", "Android", "library"))
}
register("feature") {
register("android.feature") {
id = "no.nordicsemi.android.gradle.feature"
displayName = "Feature plugin"
description = "UI feature plugin with Hilt & Compose. This plugin extends 'library.compose' and 'hilt' plugins and adds Compose navigation."
implementationClass = "AndroidFeatureConventionPlugin"
tags.set(listOf("nordicsemi", "Android", "feature"))
}
register("hilt") {
register("android.hilt") {
id = "no.nordicsemi.android.gradle.hilt"
displayName = "Hilt plugin"
description = "Plugin enabling Hilt"
implementationClass = "AndroidHiltConventionPlugin"
tags.set(listOf("nordicsemi", "Android", "hilt"))
}
register("kotlin") {
register("android.kotlin") {
id = "no.nordicsemi.android.gradle.kotlin"
displayName = "Kotlin plugin"
description = "Plugin enabling Kotlin"
implementationClass = "AndroidKotlinConventionPlugin"
tags.set(listOf("nordicsemi", "Android", "kotlin"))
}
register("nexus") {
register("android.nexus") {
id = "no.nordicsemi.android.gradle.nexus"
displayName = "Nexus plugin"
description = "Plugin creating a task for publishing to Nexus repository."
implementationClass = "AndroidNexusRepositoryPlugin"
tags.set(listOf("nordicsemi", "Android", "nexus", "publish"))
}
register("kotlin.nexus") {
id = "no.nordicsemi.kotlin.gradle.nexus"
displayName = "Nexus plugin"
description = "Plugin creating a task for publishing Kotlin library to Nexus repository."
implementationClass = "KotlinNexusRepositoryPlugin"
tags.set(listOf("nordicsemi", "kotlin", "nexus", "publish"))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

@Suppress("UnstableApiUsage")
class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
Expand Down
1 change: 0 additions & 1 deletion plugins/src/main/kotlin/AndroidLibraryConventionPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByType

@Suppress("UnstableApiUsage")
class AndroidLibraryConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
Expand Down
73 changes: 3 additions & 70 deletions plugins/src/main/kotlin/AndroidNexusRepositoryPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
*/

import com.android.build.gradle.LibraryExtension
import no.nordicsemi.android.NexusRepositoryPluginExt
import no.nordicsemi.android.buildlogic.getVersionNameFromTags
import no.nordicsemi.android.from
import no.nordicsemi.android.tasks.ReleaseStagingRepositoriesTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPom
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.get
Expand Down Expand Up @@ -95,6 +96,7 @@ class AndroidNexusRepositoryPlugin : Plugin<Project> {
// Apply POM configuration.
pom {
from(nexusPluginExt)
packaging = "aar"
}
}
// This task will add *.asc files to the publication for all artifacts.
Expand All @@ -113,73 +115,4 @@ class AndroidNexusRepositoryPlugin : Plugin<Project> {
val publishing = extensions.getByType<PublishingExtension>()
configuration(publishing)
}

private fun MavenPom.from(
nexusPluginExt: NexusRepositoryPluginExt,
) = with (nexusPluginExt) {
name.set(POM_NAME)
description.set(POM_DESCRIPTION)
url.set(POM_URL)
packaging = POM_PACKAGING

// https://maven.apache.org/pom.html#licenses
licenses {
license {
name.set(POM_LICENCE)
url.set(POM_LICENCE_URL)
// The two stated methods are repo (they may be downloaded from a Maven repository) or manual (they must be manually installed).
distribution.set("repo")
}
}

// https://maven.apache.org/pom.html#scm
scm {
url.set(POM_SCM_URL)
connection.set(POM_SCM_CONNECTION)
developerConnection.set(POM_SCM_DEV_CONNECTION)
}

// https://maven.apache.org/pom.html#organization
organization {
name.set(POM_ORG)
url.set(POM_ORG_URL)
}

// https://maven.apache.org/pom.html#developers
developers {
developer {
id.set(POM_DEVELOPER_ID)
name.set(POM_DEVELOPER_NAME)
email.set(POM_DEVELOPER_EMAIL)
organization.set(POM_ORG)
organizationUrl.set(POM_ORG_URL)
}
}
}
}

abstract class NexusRepositoryPluginExt {
// Required parameters:
lateinit var POM_ARTIFACT_ID: String
lateinit var POM_NAME: String
lateinit var POM_DESCRIPTION: String
lateinit var POM_URL: String
lateinit var POM_SCM_URL: String
lateinit var POM_SCM_CONNECTION: String
lateinit var POM_SCM_DEV_CONNECTION: String

// Default values:
var POM_PACKAGING: String = "aar"
var POM_GROUP: String? = null // If not set, the project's "group" will be used.

// License
var POM_LICENCE: String = "BSD-3-Clause"
var POM_LICENCE_URL: String = "http://opensource.org/licenses/BSD-3-Clause"

// Developer
var POM_DEVELOPER_ID: String = "mag"
var POM_DEVELOPER_NAME: String = "Mobile Applications Group"
var POM_DEVELOPER_EMAIL: String = "[email protected]"
var POM_ORG: String = "Nordic Semiconductor ASA"
var POM_ORG_URL: String = "https://www.nordicsemi.com"
}
Loading

0 comments on commit 73c86c3

Please sign in to comment.