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
70 changes: 0 additions & 70 deletions build.gradle

This file was deleted.

81 changes: 81 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* Copyright © 2025 Md. Mahmudul Hasan Shohag. All rights reserved.
*/


import org.jetbrains.dokka.gradle.DokkaMultiModuleTask // Keep this import

// Top-level build file where you can add configuration options common to all sub-projects/modules.

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
}

// Configure Spotless for the root project (e.g., build.gradle.kts, settings.gradle.kts)
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
// Optional: If you want to use the same ktlint version across kotlin and kotlinGradle
// val ktlintVersion = libs.versions.ktlint.get() // Assuming you add ktlint version to toml

kotlinGradle {
target("*.gradle.kts", "settings.gradle.kts") // Target root .gradle.kts files and settings.gradle.kts
targetExclude("**/build/**/*.kts", "build-logic/**/*.gradle.kts") // Exclude build dir & build-logic
ktlint() // .editorconfig() can be added if you have one at the root
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), """(^(?![\\/ ]\\*).*$)""") // Regex for KTS license
}

// You might still want a general kotlin format for any .kt files directly in the root, if any.
// kotlin {
// target("*.kt")
// ktlint()
// licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
// }
}

subprojects {
// Apply Spotless plugin to each subproject.
// The plugin's version is managed via the root project's plugins block.
apply(plugin = "com.diffplug.spotless")

// Configure Spotless for each subproject
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
targetExclude("${layout.buildDirectory.get()}/**/*.kt", "bin/**/*.kt")
ktlint()
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
}
kotlinGradle {
target("build.gradle.kts") // Target build.gradle.kts in each subproject
ktlint()
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), """(^(?![\\/ ]\\*).*$)""")
}
// Removed problematic format("kts") block. build.gradle.kts for subprojects will be handled by kotlinGradle.
format("xml") {
target("**/*.xml")
targetExclude("**/build/**/*.xml")
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
}
}
}

tasks.withType<DokkaMultiModuleTask>().configureEach {
moduleName.set("Why Not! Image Carousel!")
outputDirectory.set(rootProject.file("docs/api"))
failOnWarning.set(true)

// dokkaPlugins is the modern way, but pluginsMapConfiguration might still work.
// If issues arise, this is an area to check.
// For now, keeping it similar to the original:
pluginsMapConfiguration.set(
mapOf(
"org.jetbrains.dokka.base.DokkaBase" to """{
"footerMessage": "Copyright © 2021 Md. Mahmudul Hasan Shohag"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider centralizing the copyright year in gradle.properties and referencing it here for consistency.

}""",
),
)
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ android.useAndroidX=true
kotlin.code.style=official
# ------------------------------------------------------------
android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.nonFinalResIds=false

# Version name for the sample app, and potentially for the library if not hardcoded in publishing
VERSION_NAME=2.1.1
80 changes: 80 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This file defines the versions, libraries, and plugins used by the project.
# For more information, see: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog-format

[versions]
agp = "8.10.1"
kotlin = "2.1.21"
ksp = "2.1.21-2.0.2" # Note: KSP version is often tightly coupled with Kotlin version

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The KSP version 2.1.21-2.0.2 may be incorrect. KSP versions are tightly coupled with Kotlin versions. Verify the correct KSP version for your Kotlin version.

dokka = "2.0.0"
spotless = "7.0.4"
mavenPublish = "0.33.0" # Updated to latest version

# Android SDK versions
compileSdk = "36"
minSdk = "21"
targetSdk = "36"
Comment on lines +13 to +15

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The compileSdk and targetSdk are set to 36. Ensure this SDK version is available. Using a non-existent SDK version will cause the build to fail.

compileSdk = "34"
minSdk = "21"
targetSdk = "34"

javaVersion = "17"

# Build tools / Linters
ktlintVersion = "0.45.2" # Bundled with Spotless 7.0.4

# Dependencies
junit = "4.13.2"
androidxTestCore = "1.6.1"
androidxTestExtJunit = "1.2.1"
androidxTestRunner = "1.6.2"
androidxTestRules = "1.6.1"
androidxEspressoCore = "3.6.1"
# androidxEspressoIntents uses the same version as androidxEspressoCore
androidxAppcompat = "1.7.1"
androidxCoreKtx = "1.16.0"
androidxConstraintlayout = "2.2.1"
material = "1.12.0"
circleindicator = "2.1.6"
glide = "4.16.0"
androidxFragmentKtx = "1.8.8"
leakcanary = "2.14"
androidxRecyclerview = "1.4.0"


[libraries]
# Kotlin
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }

# AndroidX Test
androidx-test-coreKtx = { group = "androidx.test", name = "core-ktx", version.ref = "androidxTestCore" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidxTestExtJunit" }
androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidxTestRunner" }
androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidxTestRules" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspressoCore" }
androidx-espresso-intents = { group = "androidx.test.espresso", name = "espresso-intents", version.ref = "androidxEspressoCore" }

# AndroidX UI & Core
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidxAppcompat" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCoreKtx" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidxConstraintlayout" }
androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "androidxFragmentKtx" }
androidx-recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "androidxRecyclerview" }

# Google
material = { group = "com.google.android.material", name = "material", version.ref = "material" }

# Third-party
circleindicator = { group = "me.relex", name = "circleindicator", version.ref = "circleindicator" }
glide = { group = "com.github.bumptech.glide", name = "glide", version.ref = "glide" }
leakcanary-android = { group = "com.squareup.leakcanary", name = "leakcanary-android", version.ref = "leakcanary" }
junit = { group = "junit", name = "junit", version.ref = "junit" }


[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }

[bundles]
# Example: androidx-test-implementations = ["androidx-test-core", "androidx-test-ext-junit", ...]
# Can be added later if useful.
79 changes: 0 additions & 79 deletions sample/build.gradle

This file was deleted.

Loading