mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-22 12:48:15 +03:00
Create plugin for linting (#8942)
This commit is contained in:
parent
b56b8b55b4
commit
c31e75f02f
15 changed files with 45 additions and 38 deletions
2
.github/workflows/build_pull_request.yml
vendored
2
.github/workflows/build_pull_request.yml
vendored
|
@ -36,4 +36,4 @@ jobs:
|
||||||
- name: Build app and run unit tests
|
- name: Build app and run unit tests
|
||||||
uses: gradle/gradle-command-action@v2
|
uses: gradle/gradle-command-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: assembleStandardRelease testStandardReleaseUnitTest
|
arguments: lintKotlin assembleStandardRelease testStandardReleaseUnitTest
|
2
.github/workflows/build_push.yml
vendored
2
.github/workflows/build_push.yml
vendored
|
@ -31,7 +31,7 @@ jobs:
|
||||||
- name: Build app and run unit tests
|
- name: Build app and run unit tests
|
||||||
uses: gradle/gradle-command-action@v2
|
uses: gradle/gradle-command-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: assembleStandardRelease testStandardReleaseUnitTest
|
arguments: lintKotlin assembleStandardRelease testStandardReleaseUnitTest
|
||||||
|
|
||||||
# Sign APK and create release for tags
|
# Sign APK and create release for tags
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("com.mikepenz.aboutlibraries.plugin")
|
id("com.mikepenz.aboutlibraries.plugin")
|
||||||
kotlin("android")
|
kotlin("android")
|
||||||
|
id("tachiyomi.lint")
|
||||||
kotlin("plugin.serialization")
|
kotlin("plugin.serialization")
|
||||||
id("com.github.zellius.shortcut-helper")
|
id("com.github.zellius.shortcut-helper")
|
||||||
id("com.squareup.sqldelight")
|
id("com.squareup.sqldelight")
|
||||||
|
@ -346,11 +347,6 @@ tasks {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preBuild {
|
|
||||||
val ktlintTask = if (System.getenv("GITHUB_BASE_REF") == null) formatKotlin else lintKotlin
|
|
||||||
dependsOn(ktlintTask)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
|
|
@ -3,30 +3,12 @@ buildscript {
|
||||||
classpath(libs.android.shortcut.gradle)
|
classpath(libs.android.shortcut.gradle)
|
||||||
classpath(libs.google.services.gradle)
|
classpath(libs.google.services.gradle)
|
||||||
classpath(libs.aboutLibraries.gradle)
|
classpath(libs.aboutLibraries.gradle)
|
||||||
classpath(kotlinx.serialization.gradle)
|
|
||||||
classpath(libs.sqldelight.gradle)
|
classpath(libs.sqldelight.gradle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(androidx.plugins.application) apply false
|
alias(kotlinx.plugins.serialization) apply false
|
||||||
alias(androidx.plugins.library) apply false
|
|
||||||
alias(androidx.plugins.test) apply false
|
|
||||||
alias(kotlinx.plugins.android) apply false
|
|
||||||
alias(libs.plugins.kotlinter)
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply<org.jmailen.gradle.kotlinter.KotlinterPlugin>()
|
|
||||||
|
|
||||||
kotlinter {
|
|
||||||
experimentalRules = true
|
|
||||||
|
|
||||||
disabledRules = arrayOf(
|
|
||||||
"experimental:argument-list-wrapping", // Doesn't play well with Android Studio
|
|
||||||
"filename", // Often broken to give a more general name
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Delete>("clean") {
|
tasks.register<Delete>("clean") {
|
||||||
|
|
|
@ -3,12 +3,14 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinLibs.versions.kotlin.version.get()}")
|
implementation(androidxLibs.gradle)
|
||||||
|
implementation(kotlinLibs.gradle)
|
||||||
|
implementation(libs.kotlinter)
|
||||||
implementation(gradleApi())
|
implementation(gradleApi())
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
versionCatalogs {
|
versionCatalogs {
|
||||||
|
create("libs") {
|
||||||
|
from(files("../gradle/libs.versions.toml"))
|
||||||
|
}
|
||||||
|
create("androidxLibs") {
|
||||||
|
from(files("../gradle/androidx.versions.toml"))
|
||||||
|
}
|
||||||
create("kotlinLibs") {
|
create("kotlinLibs") {
|
||||||
from(files("../gradle/kotlinx.versions.toml"))
|
from(files("../gradle/kotlinx.versions.toml"))
|
||||||
}
|
}
|
||||||
|
|
20
buildSrc/src/main/kotlin/tachiyomi.lint.gradle.kts
Normal file
20
buildSrc/src/main/kotlin/tachiyomi.lint.gradle.kts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import org.jmailen.gradle.kotlinter.KotlinterExtension
|
||||||
|
import org.jmailen.gradle.kotlinter.KotlinterPlugin
|
||||||
|
|
||||||
|
apply<KotlinterPlugin>()
|
||||||
|
|
||||||
|
extensions.configure<KotlinterExtension>("kotlinter") {
|
||||||
|
experimentalRules = true
|
||||||
|
|
||||||
|
disabledRules = arrayOf(
|
||||||
|
"experimental:argument-list-wrapping", // Doesn't play well with Android Studio
|
||||||
|
"filename", // Often broken to give a more general name
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
named<DefaultTask>("preBuild").configure {
|
||||||
|
if (!System.getenv("CI").toBoolean())
|
||||||
|
dependsOn("formatKotlin")
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.library")
|
id("com.android.library")
|
||||||
kotlin("android")
|
kotlin("android")
|
||||||
|
id("tachiyomi.lint")
|
||||||
kotlin("plugin.serialization")
|
kotlin("plugin.serialization")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ agp_version = "7.4.0"
|
||||||
lifecycle_version = "2.5.1"
|
lifecycle_version = "2.5.1"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
gradle = { module = "com.android.tools.build:gradle", version.ref = "agp_version" }
|
||||||
|
|
||||||
annotation = "androidx.annotation:annotation:1.5.0"
|
annotation = "androidx.annotation:annotation:1.5.0"
|
||||||
appcompat = "androidx.appcompat:appcompat:1.6.0"
|
appcompat = "androidx.appcompat:appcompat:1.6.0"
|
||||||
biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha05"
|
biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha05"
|
||||||
|
@ -33,8 +35,3 @@ test-uiautomator = "androidx.test.uiautomator:uiautomator:2.2.0"
|
||||||
[bundles]
|
[bundles]
|
||||||
lifecycle = ["lifecycle-common", "lifecycle-process", "lifecycle-runtimektx"]
|
lifecycle = ["lifecycle-common", "lifecycle-process", "lifecycle-runtimektx"]
|
||||||
workmanager = ["work-runtime", "guava"]
|
workmanager = ["work-runtime", "guava"]
|
||||||
|
|
||||||
[plugins]
|
|
||||||
application = { id = "com.android.application", version.ref = "agp_version" }
|
|
||||||
library = { id = "com.android.library", version.ref = "agp_version" }
|
|
||||||
test = { id = "com.android.test", version.ref = "agp_version" }
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-androi
|
||||||
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.4.0" }
|
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.4.0" }
|
||||||
serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version = "1.4.0" }
|
serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version = "1.4.0" }
|
||||||
serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization_version" }
|
serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization_version" }
|
||||||
serialization-gradle = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version" }
|
|
||||||
serialization-xml-core = { module = "io.github.pdvrieze.xmlutil:core-android", version.ref = "xml_serialization_version" }
|
serialization-xml-core = { module = "io.github.pdvrieze.xmlutil:core-android", version.ref = "xml_serialization_version" }
|
||||||
serialization-xml = { module = "io.github.pdvrieze.xmlutil:serialization-android", version.ref = "xml_serialization_version" }
|
serialization-xml = { module = "io.github.pdvrieze.xmlutil:serialization-android", version.ref = "xml_serialization_version" }
|
||||||
|
|
||||||
|
@ -24,4 +23,5 @@ coroutines = ["coroutines-core", "coroutines-android"]
|
||||||
serialization = ["serialization-json", "serialization-json-okio", "serialization-protobuf", "serialization-xml-core", "serialization-xml"]
|
serialization = ["serialization-json", "serialization-json-okio", "serialization-protobuf", "serialization-xml-core", "serialization-xml"]
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version" }
|
android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version" }
|
||||||
|
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin_version" }
|
|
@ -89,6 +89,8 @@ voyager-navigator = { module = "ca.gosyer:voyager-navigator", version.ref = "voy
|
||||||
voyager-tab-navigator = { module = "ca.gosyer:voyager-tab-navigator", version.ref = "voyager" }
|
voyager-tab-navigator = { module = "ca.gosyer:voyager-tab-navigator", version.ref = "voyager" }
|
||||||
voyager-transitions = { module = "ca.gosyer:voyager-transitions", version.ref = "voyager" }
|
voyager-transitions = { module = "ca.gosyer:voyager-transitions", version.ref = "voyager" }
|
||||||
|
|
||||||
|
kotlinter = "org.jmailen.gradle:kotlinter-gradle:3.13.0"
|
||||||
|
|
||||||
[bundles]
|
[bundles]
|
||||||
reactivex = ["rxandroid", "rxjava", "rxrelay"]
|
reactivex = ["rxandroid", "rxjava", "rxrelay"]
|
||||||
okhttp = ["okhttp-core", "okhttp-logging", "okhttp-dnsoverhttps"]
|
okhttp = ["okhttp-core", "okhttp-logging", "okhttp-dnsoverhttps"]
|
||||||
|
@ -98,6 +100,3 @@ coil = ["coil-core", "coil-gif", "coil-compose"]
|
||||||
shizuku = ["shizuku-api", "shizuku-provider"]
|
shizuku = ["shizuku-api", "shizuku-provider"]
|
||||||
voyager = ["voyager-navigator", "voyager-tab-navigator", "voyager-transitions"]
|
voyager = ["voyager-navigator", "voyager-tab-navigator", "voyager-transitions"]
|
||||||
richtext = ["richtext-commonmark", "richtext-m3"]
|
richtext = ["richtext-commonmark", "richtext-m3"]
|
||||||
|
|
||||||
[plugins]
|
|
||||||
kotlinter = { id = "org.jmailen.kotlinter", version = "3.13.0" }
|
|
|
@ -1,6 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.library")
|
id("com.android.library")
|
||||||
kotlin("android")
|
kotlin("android")
|
||||||
|
id("tachiyomi.lint")
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.test")
|
id("com.android.test")
|
||||||
kotlin("android")
|
kotlin("android")
|
||||||
|
id("tachiyomi.lint")
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.library")
|
id("com.android.library")
|
||||||
kotlin("android")
|
kotlin("android")
|
||||||
|
id("tachiyomi.lint")
|
||||||
kotlin("plugin.serialization")
|
kotlin("plugin.serialization")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ open class Page(
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private val _progressFlow = MutableStateFlow(0)
|
private val _progressFlow = MutableStateFlow(0)
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
val progressFlow = _progressFlow.asStateFlow()
|
val progressFlow = _progressFlow.asStateFlow()
|
||||||
var progress: Int
|
var progress: Int
|
||||||
|
|
Loading…
Reference in a new issue