Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Renner committed Sep 7, 2023
1 parent c223010 commit b63f0c4
Show file tree
Hide file tree
Showing 8 changed files with 417 additions and 1 deletion.
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ plugins {
alias(libs.plugins.org.jetbrains.compose).apply(false)
alias(libs.plugins.org.jetbrains.kotlin.multiplatform).apply(false)
alias(libs.plugins.org.jetbrains.kotlin.plugin.serialization).apply(false)

id("my-ktlint")
id("my-detekt")
}

tasks.register("clean", Delete::class) {
Expand Down
24 changes: 24 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
`kotlin-dsl`
}

kotlin {
jvmToolchain {
@Suppress("USELESS_CAST") // BUG: cast is necessary else languageVersion can't be resolved e.g. clean task
(this as JavaToolchainSpec)
.languageVersion
.set(JavaLanguageVersion.of(JavaVersion.VERSION_11.toString())) // TODO: Version number centralisation
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString() // TODO: Version number centralisation
}
}

dependencies {
implementation(libs.ktlint.gradle)
implementation(libs.detekt.gradle.plugin)
implementation(libs.gradle.versions.plugin)
}
14 changes: 14 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
gradlePluginPortal()
mavenCentral()
google()
}

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
26 changes: 26 additions & 0 deletions buildSrc/src/main/kotlin/my-detekt.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id("io.gitlab.arturbosch.detekt")
}

dependencies {
detektPlugins("ru.kode:detekt-rules-compose:1.2.2") // TODO: Version number centralisation
detektPlugins("io.nlopez.compose.rules:detekt:0.1.10") // TODO: Version number centralisation
}

detekt {
// Documentation: https://detekt.dev/gradle.html#options-for-detekt-configuration-closure

source = files("src") // The directories where detekt looks for source files.

config = files("${rootProject.rootDir}/buildSrc/src/main/resources/detekt.yml")

parallel = true // Builds the AST in parallel.

ignoredBuildTypes = listOf("release") // Don't create tasks for the specified build types (e.g. "release")
ignoredFlavors = listOf("production", "staging") // Don't create tasks for the specified build flavor (e.g. "production")
ignoredVariants = listOf("productionRelease") // Don't create tasks for the specified build variants (e.g. "productionRelease")

basePath = projectDir.absolutePath

allRules = true // Turns on all the rules. Default: false
}
23 changes: 23 additions & 0 deletions buildSrc/src/main/kotlin/my-ktlint.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType

plugins {
id("org.jlleitschuh.gradle.ktlint")
}

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version.set("0.49.1")

android.set(true)
outputToConsole.set(true)
ignoreFailures.set(false)
enableExperimentalRules.set(false)

reporters { reporter(ReporterType.PLAIN_GROUP_BY_FILE) }

filter {
exclude("**/generated/**")
}

verbose.set(false)
debug.set(false)
}
Loading

0 comments on commit b63f0c4

Please sign in to comment.