Skip to content
Open
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
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {
id("convention.plugin.root")
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.androidKmpLibrary) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.android.lint) apply false
alias(libs.plugins.android.test) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.cacheFixPlugin) apply false
alias(libs.plugins.spotless) apply false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
// SPDX-License-Identifier: Apache-2.0
package com.addhen.gradle.convention

import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.dsl.LibraryExtension
import com.android.build.api.variant.AndroidComponentsExtension
import com.android.build.api.variant.HasUnitTestBuilder
import com.android.build.gradle.BaseExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

fun Project.configureAndroid() {
val localCompileSdk = this.libs.version("compileSdk").requiredVersion.toInt()
fun Project.configureAndroidApplication() {
val localCompileSdk = libs.version("compileSdk").requiredVersion.toInt()
val localMinSdk = libs.version("minSdk").requiredVersion.toInt()
val localTargetSdk = libs.version("targetSdk").requiredVersion.toInt()

android {
compileSdkVersion(localCompileSdk)
extensions.configure<ApplicationExtension> {
compileSdk = localCompileSdk

defaultConfig {
minSdk = localMinSdk
Expand All @@ -30,17 +31,37 @@ fun Project.configureAndroid() {
}
}

androidComponents {
configureAndroidComponents()
}

fun Project.configureAndroidLibrary() {
val localCompileSdk = libs.version("compileSdk").requiredVersion.toInt()
val localMinSdk = libs.version("minSdk").requiredVersion.toInt()

extensions.configure<LibraryExtension> {
compileSdk = localCompileSdk

defaultConfig {
minSdk = localMinSdk

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

configureAndroidComponents()
}

private fun Project.configureAndroidComponents() {
extensions.configure(AndroidComponentsExtension::class.java) {
beforeVariants(selector().withBuildType("release")) { variantBuilder ->
(variantBuilder as? HasUnitTestBuilder)?.apply {
enableUnitTest = false
}
}
}
}

private fun Project.android(action: BaseExtension.() -> Unit) = extensions.configure<BaseExtension>(action)

private fun Project.androidComponents(action: AndroidComponentsExtension<*, *, *>.() -> Unit) {
extensions.configure(AndroidComponentsExtension::class.java, action)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.addhen.gradle.convention.plugin

import com.addhen.gradle.convention.configureAndroid
import com.addhen.gradle.convention.configureAndroidApplication
import org.gradle.api.Plugin
import org.gradle.api.Project

Expand All @@ -12,7 +12,7 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
apply("org.gradle.android.cache-fix")
}

configureAndroid()
configureAndroidApplication()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package com.addhen.gradle.convention.plugin

import com.addhen.gradle.convention.configureAndroid
import com.addhen.gradle.convention.configureAndroidLibrary
import org.gradle.api.Plugin
import org.gradle.api.Project

Expand All @@ -14,7 +14,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
apply("org.gradle.android.cache-fix")
}

configureAndroid()
configureAndroidLibrary()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import org.gradle.api.Project
class KotlinAndroidConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("org.jetbrains.kotlin.android")
}

configureSpotless()
configureKotlin()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ class KotlinMultiplatformConventionPlugin : Plugin<Project> {

kotlin {
applyDefaultHierarchyTemplate()
if (pluginManager.hasPlugin("com.android.library")) {
androidTarget {
publishLibraryVariants("release")
}
}

iosX64()
//iosX64()
iosArm64()
iosSimulatorArm64()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@ class MetalavaConventionPlugin : Plugin<Project> {

metalava {
filename.set("api/api.txt")
sourcePaths.setFrom(
target.kotlin.sourceSets
.filterNot { it.name.contains("test", ignoreCase = true) }
.flatMap { it.kotlin.sourceDirectories },
)
}

tasks.named { it.startsWith("metalavaCheckCompatibility") }.configureEach {
dependsOn(tasks.named { it.startsWith("generateResourceAccessors") })
dependsOn(tasks.named { it.startsWith("generateActualResourceCollectors") })
}
}
}
Expand Down
14 changes: 9 additions & 5 deletions dokka/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


plugins {
id("convention.plugin.android.library")
alias(libs.plugins.androidKmpLibrary)
id("convention.plugin.kotlin.multiplatform")
alias(libs.plugins.dokka)
}
Expand All @@ -14,10 +14,14 @@ dependencies {
dokka(projects.kanalyticsViewerNoOp)
}

android {
namespace = "com.addhen.kanalytics.viewer.docs"
}

dokka {
moduleName.set("KAnalytics")
}

kotlin {
android {
namespace = "com.addhen.kanalytics.viewer.docs"
compileSdk = libs.versions.compileSdk.get().toInt()
minSdk = libs.versions.minSdk.get().toInt()
}
}
41 changes: 21 additions & 20 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
kanalytics = "1.5.0-SNAPSHOT"
minSdk = "24"
targetSdk = "36"
compileSdk = "36"
agp = "8.13.2"
kotlin = "2.3.21"
spotless = "8.0.0"
metalava = "0.3.5"
compose-multiplatform = "1.10.0"
compileSdk = "37"
agp = "9.2.1"
kotlin = "2.4.0"
spotless = "8.6.0"
metalava = "0.5.0"
compose-multiplatform = "1.11.1"
cacheFixPlugin = "3.0.3"
dokka = "2.1.0"
coroutines = "1.10.2"
androidx-core-ktx = "1.17.0"
dokka = "2.2.0"
coroutines = "1.11.0"
androidx-core-ktx = "1.19.0"
androidx-activity-compose = "1.13.0"
material = "1.13.0"
material = "1.14.0"
appcompat = "1.7.1"

# Version 2.8.0-alpha13 causes this issue on iOS builds:
Expand All @@ -26,18 +26,18 @@ appcompat = "1.7.1"
# accessed in module <org.jetbrains.compose.material3:material3>
# Before you bump this version higher than 2.8.0-alpha13 check the iOS app to make
# it still works.
navigation-compose = "2.9.1" # Make use of type-safe compose navigation
kotlinx-serializer = "1.9.0"
lifecycle-viewmodel-compose = "2.9.6"
kermit = "2.0.8"
navigation-compose = "2.9.2" # Make use of type-safe compose navigation
kotlinx-serializer = "1.11.0"
lifecycle-viewmodel-compose = "2.10.0"
kermit = "2.1.0"
kotlinx-collections-immutable = "0.4.0"
kotlinx-datetime = "0.7.1-0.6.x-compat"
sqldelight = "2.1.0"
kotlinx-datetime = "0.8.0"
sqldelight = "2.3.2"
startup-runtime = "1.2.0"
composeDataTable = "0.11.4"
mokkery = "2.10.2"
mokkery = "3.4.1"
json-tree = "2.6.0"
kotlinx-atomicfu = "0.29.0"
kotlinx-atomicfu = "0.33.0"
multiplatformsettings = "1.3.0"
androidx-preference = "1.2.1"
baselineprofile = "1.4.1"
Expand All @@ -46,7 +46,7 @@ espressoCore = "3.7.0"
uiautomator = "2.3.0"
benchmarkMacroJunit4 = "1.4.1"
profileinstaller = "1.4.1"
maven-publish = "0.34.0"
maven-publish = "0.36.0"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
Expand All @@ -65,6 +65,7 @@ androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version
androidx-navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigation-compose" }
kotlinx-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serializer" }
lifecycle-viewmodel-compose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle-viewmodel-compose" }
lifecycle-runtime-compose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle-viewmodel-compose" }
touchlab-kermit = { module = "co.touchlab:kermit", version.ref = "kermit" }
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
Expand All @@ -88,6 +89,7 @@ androidx-profileinstaller = { group = "androidx.profileinstaller", name = "profi

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
androidKmpLibrary = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" }
android-lint = { id = "com.android.lint", version.ref = "agp" }
android-test = { id = "com.android.test", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
Expand All @@ -99,7 +101,6 @@ compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "
compose-multiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" }
cacheFixPlugin = { id = "org.gradle.android.cache-fix", version.ref = "cacheFixPlugin" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
mokkery = { id = "dev.mokkery", version.ref = "mokkery" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ distributionPath=wrapper/dists
distributionSha256Sum=c72fb9991f6025cbe337d52ba77e531b3faf62bdd3e348fe1ccee9f51c71adb0
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-all.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 2 additions & 5 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 10 additions & 22 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading