From a94d9bf8b840355c2a1c2373ebd5a9ab80092465 Mon Sep 17 00:00:00 2001 From: Daniil Zhuravlev Date: Wed, 3 Sep 2025 15:15:54 +0400 Subject: [PATCH 1/2] chore: update .editorconfig --- .editorconfig | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index a352878ed..a0680c8d2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,12 +3,18 @@ root = true [*] charset = utf-8 end_of_line = lf -indent_style = tab +indent_style = space +indent_size = 4 max_line_length = 120 -tab_width = 4 insert_final_newline = true +trim_trailing_whitespace = true +# noinspection EditorConfigKeyCorrectness disabled_rules = no-wildcard-imports, no-unused-imports -[{*.kt,*.kts}] +[*.{kt,kts}] ij_kotlin_allow_trailing_comma = true ij_kotlin_allow_trailing_comma_on_call_site = true + +[*.md] +indent_size = 2 +trim_trailing_whitespace = false From 7e25002dba5a15f745b053cecdf62d3ab299fb5a Mon Sep 17 00:00:00 2001 From: Daniil Zhuravlev Date: Wed, 3 Sep 2025 16:18:13 +0400 Subject: [PATCH 2/2] refactor(build): migrate to Kotlin DSL and version catalog --- build.gradle | 77 ---------------------------- build.gradle.kts | 63 +++++++++++++++++++++++ buildSrc/build.gradle | 18 ------- buildSrc/build.gradle.kts | 18 +++++++ gradle/libs.versions.toml | 29 +++++++++++ kotatsu-parsers-ksp/build.gradle | 11 ---- kotatsu-parsers-ksp/build.gradle.kts | 11 ++++ settings.gradle | 18 ------- settings.gradle.kts | 18 +++++++ 9 files changed, 139 insertions(+), 124 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 buildSrc/build.gradle create mode 100644 buildSrc/build.gradle.kts create mode 100644 gradle/libs.versions.toml delete mode 100644 kotatsu-parsers-ksp/build.gradle create mode 100644 kotatsu-parsers-ksp/build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 58161ae05..000000000 --- a/build.gradle +++ /dev/null @@ -1,77 +0,0 @@ -import tasks.ReportGenerateTask - -plugins { - id 'java-library' - id 'org.jetbrains.kotlin.jvm' version '2.0.20' - id 'com.google.devtools.ksp' version '2.0.20-1.0.25' - id 'maven-publish' -} - -group = 'org.koitharu' -version = '1.0' - -test { - useJUnitPlatform() -} - -ksp { - arg("summaryOutputDir", "${projectDir}/.github") -} - -compileKotlin { - kotlinOptions { - freeCompilerArgs += [ - '-opt-in=kotlin.RequiresOptIn', - '-opt-in=kotlin.contracts.ExperimentalContracts', - '-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi', - '-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi', - ] - } -} - -compileTestKotlin { - kotlinOptions { - freeCompilerArgs += [ - '-opt-in=kotlin.RequiresOptIn', - '-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi', - '-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi', - ] - } -} - -kotlin { - jvmToolchain(8) - explicitApi = 'warning' - sourceSets { - main.kotlin.srcDirs += 'build/generated/ksp/main/kotlin' - } -} - -afterEvaluate { - publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } - } -} - -dependencies { - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2' - implementation 'com.squareup.okhttp3:okhttp:4.12.0' - implementation 'com.squareup.okio:okio:3.11.0' - api 'org.jsoup:jsoup:1.19.1' - implementation 'org.json:json:20240303' - implementation 'androidx.collection:collection:1.5.0' - - ksp project(':kotatsu-parsers-ksp') - - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1' - testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.1' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.1' - testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2' - testImplementation 'io.webfolder:quickjs:1.1.0' -} - -tasks.register('generateTestsReport', ReportGenerateTask) diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..a22733a7f --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,63 @@ +import tasks.ReportGenerateTask + +plugins { + `java-library` + `maven-publish` + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.ksp) +} + +group = "org.koitharu" +version = "1.0" + +tasks.test { + useJUnitPlatform() +} + +ksp { + arg("summaryOutputDir", "${projectDir}/.github") +} + +tasks.withType().configureEach { + compilerOptions { + freeCompilerArgs.addAll( + "-opt-in=kotlin.RequiresOptIn", + "-opt-in=kotlin.contracts.ExperimentalContracts", + "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", + "-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi", + ) + } +} + +kotlin { + jvmToolchain(8) + explicitApiWarning() + sourceSets["main"].kotlin.srcDirs("build/generated/ksp/main/kotlin") +} + +publishing { + publications { + create("mavenJava") { + from(components["java"]) + } + } +} + +dependencies { + implementation(libs.kotlinx.coroutines.core) + implementation(libs.okhttp) + implementation(libs.okio) + implementation(libs.json) + implementation(libs.androidx.collection) + api(libs.jsoup) + + ksp(project(":kotatsu-parsers-ksp")) + + testImplementation(libs.junit.api) + testImplementation(libs.junit.engine) + testImplementation(libs.junit.params) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.quickjs) +} + +tasks.register("generateTestsReport") diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 577528ddd..000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id 'org.jetbrains.kotlin.jvm' version '2.0.20' -} - -repositories { - mavenCentral() -} - -kotlin { - jvmToolchain(8) -} - -dependencies { - implementation gradleApi() - implementation 'org.simpleframework:simple-xml:2.7.1' - implementation 'com.soywiz.korlibs.korte:korte-jvm:4.0.10' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1' -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..fc4b79047 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + kotlin("jvm") version "2.0.20" +} + +repositories { + mavenCentral() +} + +kotlin { + jvmToolchain(8) +} + +dependencies { + implementation(gradleApi()) + implementation("org.simpleframework:simple-xml:2.7.1") + implementation("com.soywiz.korlibs.korte:korte-jvm:4.0.10") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1") +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..02db3bf8a --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,29 @@ +[versions] +kotlin = "2.0.20" +ksp = "2.0.20-1.0.25" +coroutines = "1.10.2" +junit = "5.10.1" +okhttp = "4.12.0" +okio = "3.11.0" +json = "20240303" +androidx-collection = "1.5.0" +jsoup = "1.19.1" +quickjs = "1.1.0" + +[plugins] +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } + +[libraries] +ksp-symbol-processing-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" } +kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" } +junit-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" } +junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" } +junit-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +okio = { module = "com.squareup.okio:okio", version.ref = "okio" } +json = { module = "org.json:json", version.ref = "json" } +androidx-collection = { module = "androidx.collection:collection", version.ref = "androidx-collection" } +jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } +quickjs = { module = "io.webfolder:quickjs", version.ref = "quickjs" } diff --git a/kotatsu-parsers-ksp/build.gradle b/kotatsu-parsers-ksp/build.gradle deleted file mode 100644 index ce8c88860..000000000 --- a/kotatsu-parsers-ksp/build.gradle +++ /dev/null @@ -1,11 +0,0 @@ -plugins { - id 'org.jetbrains.kotlin.jvm' -} - -kotlin { - jvmToolchain(8) -} - -dependencies { - implementation 'com.google.devtools.ksp:symbol-processing-api:2.0.20-1.0.25' -} diff --git a/kotatsu-parsers-ksp/build.gradle.kts b/kotatsu-parsers-ksp/build.gradle.kts new file mode 100644 index 000000000..c05261875 --- /dev/null +++ b/kotatsu-parsers-ksp/build.gradle.kts @@ -0,0 +1,11 @@ +plugins { + alias(libs.plugins.kotlin.jvm) +} + +kotlin { + jvmToolchain(8) +} + +dependencies { + implementation(libs.ksp.symbol.processing.api) +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index f5398e52a..000000000 --- a/settings.gradle +++ /dev/null @@ -1,18 +0,0 @@ -pluginManagement { - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -dependencyResolutionManagement { - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -rootProject.name = 'kotatsu-parsers' -include 'kotatsu-parsers-ksp' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..834fbf540 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,18 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +rootProject.name = "kotatsu-parsers" +include("kotatsu-parsers-ksp")