Skip to content

Commit

Permalink
Don't lint generated source files
Browse files Browse the repository at this point in the history
  • Loading branch information
arkon committed Feb 7, 2021
1 parent 68db37b commit 473a1fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,9 @@ repositories {

apply from: "$rootDir/common-dependencies.gradle"

lintKotlinMain {
exclude 'generated-src/**/*.kt'
}

preBuild.dependsOn(lintKotlin)
lintKotlin.dependsOn(formatKotlin)
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ interface ThemeSourceGenerator {
val themeSrcPath = "$userDir/multisrc/src/main/java/${themeSuffix(themePkg, "/")}"
val themeSrcFile = File(themeSrcPath)
val themeDestPath = "$projectRootPath/src/${themeSuffix(themePkg, "/")}"
val themeDestFile = File(themeDestPath)

val themeDestFile = File(themeDestPath)
themeDestFile.mkdirs()

themeSrcFile.list()!!
Expand Down Expand Up @@ -147,7 +147,7 @@ interface ThemeSourceGenerator {
""".trimIndent()
}
is ThemeSourceData.MultiLang -> {
val sourceClasses = source.lang.mapIndexed { index, lang ->
val sourceClasses = source.langs.mapIndexed { index, lang ->
val indexedClassName = "$themeClass${index}"
indexedClassName to """$indexedClassName : $themeClass("${source.name}", "${source.baseUrl}", "$lang") {
override val versionId = ${source.versionId}
Expand All @@ -168,7 +168,7 @@ interface ThemeSourceGenerator {
}

File("$classPath/${source.className}.kt").writeText("""
// THIS FILE IS AUTO-GENERATED; DO NOT EDIT???
// THIS FILE IS AUTO-GENERATED; DO NOT EDIT
package eu.kanade.tachiyomi.extension.${pkgNameSuffix(source, ".")}
import eu.kanade.tachiyomi.multisrc.$themePkg.$themeClass
Expand All @@ -181,7 +181,7 @@ interface ThemeSourceGenerator {
}

private fun cleanDirectory(dir: File) {
for (file in dir.listFiles()!!) {
dir.listFiles()?.forEach { file ->
if (file.isDirectory) cleanDirectory(file)
file.delete()
}
Expand Down Expand Up @@ -212,20 +212,20 @@ sealed class ThemeSourceData {
override val baseUrl: String,
val lang: String,
override val isNsfw: Boolean = false,
override val versionId: Int = 1,
override val className: String = name.replace(" ", ""),
override val pkgName: String = className.toLowerCase(Locale.ENGLISH),
override val versionId: Int = 1,
override val overrideVersionCode: Int = 0,
) : ThemeSourceData()

data class MultiLang(
override val name: String,
override val baseUrl: String,
val lang: List<String>,
val langs: List<String>,
override val isNsfw: Boolean = false,
override val versionId: Int = 1,
override val className: String = name.replace(" ", "") + "Factory",
override val pkgName: String = className.substringBefore("Factory").toLowerCase(Locale.ENGLISH),
override val versionId: Int = 1,
override val overrideVersionCode: Int = 0,
) : ThemeSourceData()
}
Expand Down

0 comments on commit 473a1fb

Please sign in to comment.