Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dokka: fix compatibility with multiplatform and configuration cache #1493

Merged
merged 7 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/generate_dokka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
run: |
cd $GITHUB_WORKSPACE/dokka/
rm -rf "./-cloudstream"
Luna712 marked this conversation as resolved.
Show resolved Hide resolved
rm -rf "./app"
rm -rf "./library"

- name: Setup JDK 17
uses: actions/setup-java@v4
Expand Down
21 changes: 21 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import org.jetbrains.dokka.gradle.engine.parameters.KotlinPlatform
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import java.io.ByteArrayOutputStream
Expand Down Expand Up @@ -265,4 +267,23 @@ tasks.withType<KotlinJvmCompile> {
jvmTarget.set(javaTarget)
freeCompilerArgs.add("-Xjvm-default=all-compatibility")
}
}

dokka {
moduleName = "App"
dokkaSourceSets {
main {
analysisPlatform = KotlinPlatform.JVM
documentedVisibilities(
VisibilityModifier.Public,
VisibilityModifier.Protected
)

sourceLink {
localDirectory = file("..")
remoteUrl("https://github.com/recloudstream/cloudstream/tree/master")
remoteLineSuffix = "#L"
}
}
}
}
105 changes: 4 additions & 101 deletions docs/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,110 +1,13 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.net.URI

plugins {
id("com.android.library")
id("kotlin-android")
kotlin("jvm")
id("org.jetbrains.dokka")
}

val javaTarget = JvmTarget.fromTarget(libs.versions.jvmTarget.get())

android {
compileSdk = libs.versions.compileSdk.get().toInt()
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
}

namespace = "com.lagradost.api"

compileOptions {
sourceCompatibility = JavaVersion.toVersion(javaTarget.target)
targetCompatibility = JavaVersion.toVersion(javaTarget.target)
}

@Suppress("UnstableApiUsage")
testOptions {
targetSdk = libs.versions.targetSdk.get().toInt()
}

lint {
targetSdk = libs.versions.targetSdk.get().toInt()
}
}

val dokkaImplementation: Configuration by configurations.creating {
// This ensures you can access artifacts
isCanBeResolved = true
isTransitive = true
}

dependencies {
dokkaImplementation(libs.junit.ktx)
dokkaImplementation(libs.core.ktx)
dokkaImplementation(libs.appcompat)
dokkaImplementation(libs.navigation.ui.ktx)
dokkaImplementation(libs.lifecycle.livedata.ktx)
dokkaImplementation(libs.lifecycle.viewmodel.ktx)
dokkaImplementation(libs.navigation.fragment.ktx)
dokkaImplementation(libs.preference.ktx)
dokkaImplementation(libs.material)
dokkaImplementation(libs.constraintlayout)
dokkaImplementation(libs.swiperefreshlayout)
dokkaImplementation(libs.guava)
dokkaImplementation(libs.auto.service.ksp)
dokkaImplementation(libs.bundles.media3)
dokkaImplementation(libs.colorpicker) // Subtitle Color Picker
dokkaImplementation(libs.bundles.nextlibMedia3)
dokkaImplementation(libs.newpipeextractor)
dokkaImplementation(libs.juniversalchardet) // Subtitle Decoding
dokkaImplementation(libs.acra.core)
dokkaImplementation(libs.acra.toast)
dokkaImplementation(libs.shimmer) // Shimmering Effect (Loading Skeleton)
dokkaImplementation(libs.palette.ktx) // Palette for Images -> Colors
dokkaImplementation(libs.tvprovider)
dokkaImplementation(libs.overlappingpanels) // Gestures
dokkaImplementation(libs.biometric) // Fingerprint Authentication
dokkaImplementation(libs.previewseekbar.media3) // SeekBar Preview
dokkaImplementation(libs.qrcode.kotlin) // QR Code for PIN Auth on TV
dokkaImplementation(libs.rhino) // Run JavaScript
dokkaImplementation(libs.fuzzywuzzy) // Library/Ext Searching with Levenshtein Distance
dokkaImplementation(libs.safefile) // To Prevent the URI File Fu*kery
dokkaImplementation(libs.conscrypt.android) // To Fix SSL Fu*kery on Android 9
dokkaImplementation(libs.tmdb.java) // TMDB API v3 Wrapper Made with RetroFit
dokkaImplementation(libs.jackson.module.kotlin) // JSON Parser
dokkaImplementation(libs.work.runtime)
dokkaImplementation(libs.work.runtime.ktx)
dokkaImplementation(libs.nicehttp) // HTTP Lib
dokka(project(":app:"))
dokka(project(":library:"))
}

dokka {
dokkaSourceSets {
moduleName = "Cloudstream"
register("cloudstream") {
listOf("androidMain", "commonMain").forEach { srcName ->
sourceRoots.from("../library/src/$srcName/kotlin")
}
sourceRoots.from(file("../app/src/main/java"))

classpath.from(android.bootClasspath)
classpath.from(dokkaImplementation.files)

sourceLink {
localDirectory = file("..")
remoteUrl("https://github.com/recloudstream/cloudstream/tree/master")
remoteLineSuffix = "#L"
}

externalDocumentationLinks {
dokkaImplementation.dependencies.forEach {
register(it.name) {
url = URI("https://javadoc.io/doc/${it.group}/${it.name}/${it.version}")
packageListUrl = URI("https://javadoc.io/doc/${it.group}/${it.name}/${it.version}/package-list")
}
}
}
}
}
moduleName = "Cloudstream"
}
4 changes: 0 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[versions]
acraCore = "5.11.3"
appcompat = "1.7.0"
autoServiceKsp = "1.2.0"
biometric = "1.2.0-alpha05"
buildkonfigGradlePlugin = "0.15.2"
coil = "3.0.4"
Expand All @@ -14,7 +13,6 @@ dokkaGradlePlugin = "2.0.0"
espressoCore = "3.6.1"
fuzzywuzzy = "1.4.0"
gradle = "8.8.0"
guava = "33.3.1-android"
jacksonModuleKotlin = "2.13.1"
json = "20240303"
junit = "4.13.2"
Expand Down Expand Up @@ -58,7 +56,6 @@ torrentserver-aniyomi = { module = "com.github.Diegopyl1209:torrentserver-aniyom
acra-core = { module = "ch.acra:acra-core", version.ref = "acraCore" }
acra-toast = { module = "ch.acra:acra-toast", version.ref = "acraCore" }
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
auto-service-ksp = { module = "dev.zacsweers.autoservice:auto-service-ksp", version.ref = "autoServiceKsp" }
biometric = { module = "androidx.biometric:biometric", version.ref = "biometric" }
buildkonfig-gradle-plugin = { module = "com.codingfeline.buildkonfig:buildkonfig-gradle-plugin", version.ref = "buildkonfigGradlePlugin" }
coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" }
Expand All @@ -74,7 +71,6 @@ espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref =
ext-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
fuzzywuzzy = { module = "me.xdrop:fuzzywuzzy", version.ref = "fuzzywuzzy" }
gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jacksonModuleKotlin" }
jetbrains-kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinGradlePluginVersion" }
json = { module = "org.json:json", version.ref = "json" }
Expand Down
22 changes: 22 additions & 0 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.codingfeline.buildkonfig.compiler.FieldSpec
import org.jetbrains.dokka.gradle.engine.parameters.KotlinPlatform
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

Expand All @@ -7,6 +9,7 @@ plugins {
id("maven-publish")
id("com.android.library")
id("com.codingfeline.buildkonfig")
id("org.jetbrains.dokka")
}

val javaTarget = JvmTarget.fromTarget(libs.versions.jvmTarget.get())
Expand Down Expand Up @@ -85,4 +88,23 @@ publishing {
groupId = "com.lagradost.api"
}
}
}

dokka {
moduleName = "Library"
dokkaSourceSets {
configureEach {
analysisPlatform = KotlinPlatform.AndroidJVM
documentedVisibilities(
VisibilityModifier.Public,
VisibilityModifier.Protected
)

sourceLink {
localDirectory = file("..")
remoteUrl("https://github.com/recloudstream/cloudstream/tree/master")
remoteLineSuffix = "#L"
}
}
}
}
Loading