Add spotless (with ktlint) (mihonapp/mihon#1136)
(cherry picked from commit 5ae8095ef1ed2ae9f98486f9148e933c77a28692) # Conflicts: # .github/workflows/build_pull_request.yml # .github/workflows/build_push.yml
This commit is contained in:
parent
7aa20b60df
commit
62507fc3cd
14 changed files with 56 additions and 6 deletions
2
.github/workflows/build_benchmark.yml
vendored
2
.github/workflows/build_benchmark.yml
vendored
|
|
@ -83,7 +83,7 @@ jobs:
|
|||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4
|
||||
|
||||
- name: Build Benchmark app and run unit tests
|
||||
run: ./gradlew assembleDevBenchmark testDevBenchmarkUnitTest testReleaseUnitTest -Pandroid.signingConfig=debug --stacktrace
|
||||
run: ./gradlew spotlessCheck assembleDevBenchmark testDevBenchmarkUnitTest testReleaseUnitTest -Pandroid.signingConfig=debug --stacktrace
|
||||
|
||||
- name: Sign APK
|
||||
uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407 # v1
|
||||
|
|
|
|||
2
.github/workflows/build_check.yml
vendored
2
.github/workflows/build_check.yml
vendored
|
|
@ -61,7 +61,7 @@ jobs:
|
|||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4
|
||||
|
||||
- name: Build app and run unit tests
|
||||
run: ./gradlew assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest --stacktrace
|
||||
run: ./gradlew spotlessCheck assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest --stacktrace
|
||||
|
||||
- name: Sign APK
|
||||
uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407 # v1
|
||||
|
|
|
|||
2
.github/workflows/build_preview.yml
vendored
2
.github/workflows/build_preview.yml
vendored
|
|
@ -155,7 +155,7 @@ jobs:
|
|||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4
|
||||
|
||||
- name: Build Preview app and run unit tests
|
||||
run: ./gradlew assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest --stacktrace
|
||||
run: ./gradlew spotlessCheck assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest --stacktrace
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
|
|
|
|||
2
.github/workflows/build_pull_request.yml
vendored
2
.github/workflows/build_pull_request.yml
vendored
|
|
@ -64,7 +64,7 @@ jobs:
|
|||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4
|
||||
|
||||
- name: Build app and run unit tests
|
||||
run: ./gradlew assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest --stacktrace
|
||||
run: ./gradlew spotlessCheck assembleStandardPreview testStandardPreviewUnitTest testReleaseUnitTest --stacktrace
|
||||
|
||||
- name: Sign APK
|
||||
uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407 # v1
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ jobs:
|
|||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4
|
||||
|
||||
- name: Build app and run unit tests
|
||||
run: ./gradlew assembleDevDebug testDevDebugUnitTest testDebugUnitTest --stacktrace
|
||||
run: ./gradlew spotlessCheck assembleDevDebug testDevDebugUnitTest testDebugUnitTest --stacktrace
|
||||
|
||||
- name: Rename apk
|
||||
id: current_commit
|
||||
|
|
|
|||
2
.github/workflows/build_release.yml
vendored
2
.github/workflows/build_release.yml
vendored
|
|
@ -131,7 +131,7 @@ jobs:
|
|||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4
|
||||
|
||||
- name: Build app and run unit tests
|
||||
run: ./gradlew assembleStandardRelease testStandardReleaseUnitTest testReleaseUnitTest --stacktrace
|
||||
run: ./gradlew spotlessCheck assembleStandardRelease testStandardReleaseUnitTest testReleaseUnitTest --stacktrace
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ dependencies {
|
|||
implementation(androidx.gradle)
|
||||
implementation(kotlinx.gradle)
|
||||
implementation(kotlinx.compose.compiler.gradle)
|
||||
implementation(libs.spotless.gradle)
|
||||
implementation(gradleApi())
|
||||
|
||||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import mihon.buildlogic.configureCompose
|
|||
plugins {
|
||||
id("com.android.application")
|
||||
kotlin("android")
|
||||
|
||||
id("mihon.code.lint")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import mihon.buildlogic.configureTest
|
|||
plugins {
|
||||
id("com.android.application")
|
||||
kotlin("android")
|
||||
|
||||
id("mihon.code.lint")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import mihon.buildlogic.configureTest
|
|||
plugins {
|
||||
id("com.android.test")
|
||||
kotlin("android")
|
||||
|
||||
id("mihon.code.lint")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
34
buildSrc/src/main/kotlin/mihon.code.lint.gradle.kts
Normal file
34
buildSrc/src/main/kotlin/mihon.code.lint.gradle.kts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
|
||||
plugins {
|
||||
id("com.diffplug.spotless")
|
||||
}
|
||||
|
||||
val libs = the<LibrariesForLibs>()
|
||||
|
||||
spotless {
|
||||
kotlin {
|
||||
target("**/*.kt", "**/*.kts")
|
||||
targetExclude("**/build/**/*.kt")
|
||||
ktlint(libs.ktlint.core.get().version)
|
||||
.editorConfigOverride(mapOf(
|
||||
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
|
||||
"ktlint_standard_class-signature" to "disabled",
|
||||
"ktlint_standard_discouraged-comment-location" to "disabled",
|
||||
"ktlint_standard_function-expression-body" to "disabled",
|
||||
"ktlint_standard_function-signature" to "disabled",
|
||||
"ktlint_standard_max-line-length" to "disabled",
|
||||
"ktlint_standard_type-argument-comment" to "disabled",
|
||||
"ktlint_standard_value-argument-comment" to "disabled",
|
||||
"ktlint_standard_value-parameter-comment" to "disabled",
|
||||
))
|
||||
trimTrailingWhitespace()
|
||||
endWithNewline()
|
||||
}
|
||||
format("xml") {
|
||||
target("**/*.xml")
|
||||
targetExclude("**/build/**/*.xml")
|
||||
trimTrailingWhitespace()
|
||||
endWithNewline()
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ import mihon.buildlogic.configureCompose
|
|||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
|
||||
id("mihon.code.lint")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import mihon.buildlogic.configureTest
|
|||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
|
||||
id("mihon.code.lint")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ shizuku_version = "12.2.0"
|
|||
sqldelight = "2.0.2"
|
||||
sqlite = "2.4.0"
|
||||
voyager = "1.0.0"
|
||||
spotless = "6.25.0"
|
||||
ktlint-core = "1.3.1"
|
||||
|
||||
[libraries]
|
||||
desugar = "com.android.tools:desugar_jdk_libs:2.0.4"
|
||||
|
|
@ -100,6 +102,9 @@ voyager-screenmodel = { module = "cafe.adriel.voyager:voyager-screenmodel", vers
|
|||
voyager-tab-navigator = { module = "cafe.adriel.voyager:voyager-tab-navigator", version.ref = "voyager" }
|
||||
voyager-transitions = { module = "cafe.adriel.voyager:voyager-transitions", version.ref = "voyager" }
|
||||
|
||||
spotless-gradle = { group = "com.diffplug.spotless", name = "spotless-plugin-gradle", version.ref = "spotless" }
|
||||
ktlint-core = { module = "com.pinterest.ktlint:ktlint-cli", version.ref = "ktlint-core" }
|
||||
|
||||
[bundles]
|
||||
okhttp = ["okhttp-core", "okhttp-logging", "okhttp-brotli", "okhttp-dnsoverhttps"]
|
||||
js-engine = ["quickjs-android"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue