Fatima Jamal
Fatima Jamal

Reputation: 161

How i add Spotless to Multi-Module Project?

I'm building a multi-module jetpack compose project. Where i'm using build-logic module to pass common library and cofig to other modules. I wish to add Spotless to my project, to automate code formatting, but i were unable to find a resource to how i add it in my build-logic module. This is my current build.gradle in my build-logic module.

import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
  `kotlin-dsl`
   alias(libs.plugins.android.lint)
}

group = "com.example.spotifyclone.buildlogic"

java {
   sourceCompatibility = JavaVersion.VERSION_17
   targetCompatibility = JavaVersion.VERSION_17
}

kotlin{
   compilerOptions {
    jvmTarget = JvmTarget.JVM_17
   }
}

dependencies {
   compileOnly(libs.android.gradlePlugin)
   compileOnly(libs.android.tools.common)
   compileOnly(libs.compose.gradlePlugin)
   compileOnly(libs.kotlin.gradlePlugin)
   compileOnly(libs.ksp.gradlePlugin)
   lintChecks(libs.androidx.lint.gradle)
}

tasks {
   validatePlugins {
    enableStricterValidation = true
    failOnWarning = true
   }
}


 gradlePlugin {
   plugins {
     register("androidApplicationCompose") {
        id = "spotify.android.application.compose"
        implementationClass = "AndroidApplicationComposeConventionPlugin"
     }
     register("androidApplication") {
        id = "spotify.android.application"
        implementationClass = "AndroidApplicationConventionPlugin"
     }
     register("androidLibraryCompose") {
        id = "spotify.android.library.compose"
        implementationClass = "AndroidLibraryComposeConventionPlugin"
     }
     register("androidLibrary") {
        id = "spotify.android.library"
        implementationClass = "AndroidLibraryConventionPlugin"
     }
     register("androidFeature") {
        id = "spotify.android.feature"
        implementationClass = "AndroidFeatureConventionPlugin"
     }
     register("androidHilt") {
        id = "spotify.android.hilt"
        implementationClass = "AndroidHiltConventionPlugin"
     }
     register("androidLint") {
        id = "spotify.android.lint"
        implementationClass = "AndroidLintConventionPlugin"
     }
  }
}

Upvotes: 0

Views: 45

Answers (0)

Related Questions