2023-08-12 20:25:30 +00:00
|
|
|
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
|
2022-10-26 19:56:31 +00:00
|
|
|
import org.jetbrains.dokka.gradle.DokkaTask
|
2024-04-16 21:07:28 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
|
2023-11-11 16:30:36 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
2022-10-26 19:56:31 +00:00
|
|
|
import java.io.ByteArrayOutputStream
|
|
|
|
import java.net.URL
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("com.android.application")
|
2023-11-10 16:02:51 +00:00
|
|
|
id("com.google.devtools.ksp")
|
2022-10-26 19:56:31 +00:00
|
|
|
id("kotlin-android")
|
|
|
|
id("org.jetbrains.dokka")
|
|
|
|
}
|
|
|
|
|
|
|
|
val tmpFilePath = System.getProperty("user.home") + "/work/_temp/keystore/"
|
|
|
|
val prereleaseStoreFile: File? = File(tmpFilePath).listFiles()?.first()
|
|
|
|
|
|
|
|
fun String.execute() = ByteArrayOutputStream().use { baot ->
|
|
|
|
if (project.exec {
|
|
|
|
workingDir = projectDir
|
|
|
|
commandLine = this@execute.split(Regex("\\s"))
|
|
|
|
standardOutput = baot
|
2023-07-31 23:25:28 +00:00
|
|
|
}.exitValue == 0)
|
2022-10-26 19:56:31 +00:00
|
|
|
String(baot.toByteArray()).trim()
|
|
|
|
else null
|
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
|
|
|
testOptions {
|
|
|
|
unitTests.isReturnDefaultValues = true
|
|
|
|
}
|
2023-07-13 21:18:37 +00:00
|
|
|
|
|
|
|
viewBinding {
|
|
|
|
enable = true
|
|
|
|
}
|
|
|
|
|
2023-11-15 16:31:02 +00:00
|
|
|
/* disable this for now
|
|
|
|
externalNativeBuild {
|
|
|
|
cmake {
|
|
|
|
path("CMakeLists.txt")
|
|
|
|
}
|
|
|
|
}*/
|
2023-08-19 19:48:10 +00:00
|
|
|
|
2022-10-26 19:56:31 +00:00
|
|
|
signingConfigs {
|
|
|
|
create("prerelease") {
|
|
|
|
if (prereleaseStoreFile != null) {
|
|
|
|
storeFile = file(prereleaseStoreFile)
|
|
|
|
storePassword = System.getenv("SIGNING_STORE_PASSWORD")
|
|
|
|
keyAlias = System.getenv("SIGNING_KEY_ALIAS")
|
|
|
|
keyPassword = System.getenv("SIGNING_KEY_PASSWORD")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-28 22:40:20 +00:00
|
|
|
compileSdk = 34
|
2023-09-04 20:36:36 +00:00
|
|
|
buildToolsVersion = "34.0.0"
|
2022-10-26 19:56:31 +00:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId = "com.lagradost.cloudstream3"
|
|
|
|
minSdk = 21
|
2023-11-15 16:31:02 +00:00
|
|
|
targetSdk = 33 /* Android 14 is Fu*ked
|
|
|
|
^ https://developer.android.com/about/versions/14/behavior-changes-14#safer-dynamic-code-loading*/
|
2023-12-09 17:54:09 +00:00
|
|
|
versionCode = 63
|
2024-03-17 02:37:09 +00:00
|
|
|
versionName = "4.3.2"
|
2022-10-26 19:56:31 +00:00
|
|
|
|
|
|
|
resValue("string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}")
|
2024-03-08 01:07:35 +00:00
|
|
|
resValue("string", "commit_hash", "git rev-parse --short HEAD".execute() ?: "")
|
2022-10-26 19:56:31 +00:00
|
|
|
resValue("bool", "is_prerelease", "false")
|
|
|
|
|
2023-08-12 20:25:30 +00:00
|
|
|
// Reads local.properties
|
2024-06-05 21:41:06 +00:00
|
|
|
val localProperties = gradleLocalProperties(rootDir)
|
2023-08-12 20:25:30 +00:00
|
|
|
|
2022-10-26 19:56:31 +00:00
|
|
|
buildConfigField(
|
2024-03-24 23:59:55 +00:00
|
|
|
"long",
|
|
|
|
"BUILD_DATE",
|
|
|
|
"${System.currentTimeMillis()}"
|
2022-10-26 19:56:31 +00:00
|
|
|
)
|
2023-08-12 20:25:30 +00:00
|
|
|
buildConfigField(
|
|
|
|
"String",
|
|
|
|
"SIMKL_CLIENT_ID",
|
|
|
|
"\"" + (System.getenv("SIMKL_CLIENT_ID") ?: localProperties["simkl.id"]) + "\""
|
|
|
|
)
|
|
|
|
buildConfigField(
|
|
|
|
"String",
|
|
|
|
"SIMKL_CLIENT_SECRET",
|
|
|
|
"\"" + (System.getenv("SIMKL_CLIENT_SECRET") ?: localProperties["simkl.secret"]) + "\""
|
|
|
|
)
|
2022-10-26 19:56:31 +00:00
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
|
2023-11-10 16:02:51 +00:00
|
|
|
ksp {
|
|
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
|
|
|
arg("exportSchema", "true")
|
|
|
|
}
|
2022-10-26 19:56:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
isDebuggable = false
|
|
|
|
isMinifyEnabled = false
|
|
|
|
isShrinkResources = false
|
2023-07-31 23:25:28 +00:00
|
|
|
proguardFiles(
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
"proguard-rules.pro"
|
|
|
|
)
|
2022-10-26 19:56:31 +00:00
|
|
|
}
|
|
|
|
debug {
|
|
|
|
isDebuggable = true
|
|
|
|
applicationIdSuffix = ".debug"
|
2023-07-31 23:25:28 +00:00
|
|
|
proguardFiles(
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
"proguard-rules.pro"
|
|
|
|
)
|
2022-10-26 19:56:31 +00:00
|
|
|
}
|
|
|
|
}
|
2023-11-15 16:31:02 +00:00
|
|
|
|
2022-10-26 19:56:31 +00:00
|
|
|
flavorDimensions.add("state")
|
|
|
|
productFlavors {
|
|
|
|
create("stable") {
|
|
|
|
dimension = "state"
|
|
|
|
resValue("bool", "is_prerelease", "false")
|
|
|
|
}
|
|
|
|
create("prerelease") {
|
|
|
|
dimension = "state"
|
|
|
|
resValue("bool", "is_prerelease", "true")
|
|
|
|
buildConfigField("boolean", "BETA", "true")
|
|
|
|
applicationIdSuffix = ".prerelease"
|
|
|
|
signingConfig = signingConfigs.getByName("prerelease")
|
|
|
|
versionNameSuffix = "-PRE"
|
|
|
|
versionCode = (System.currentTimeMillis() / 60000).toInt()
|
|
|
|
}
|
|
|
|
}
|
2023-08-04 03:37:41 +00:00
|
|
|
|
2022-10-26 19:56:31 +00:00
|
|
|
compileOptions {
|
|
|
|
isCoreLibraryDesugaringEnabled = true
|
2023-08-04 15:20:23 +00:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
2022-10-26 19:56:31 +00:00
|
|
|
}
|
2023-11-15 16:31:02 +00:00
|
|
|
|
2022-10-26 19:56:31 +00:00
|
|
|
lint {
|
|
|
|
abortOnError = false
|
|
|
|
checkReleaseBuilds = false
|
|
|
|
}
|
2024-01-19 20:09:07 +00:00
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
buildConfig = true
|
|
|
|
}
|
2023-11-15 16:31:02 +00:00
|
|
|
|
2022-10-26 19:56:31 +00:00
|
|
|
namespace = "com.lagradost.cloudstream3"
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven("https://jitpack.io")
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2023-11-15 16:31:02 +00:00
|
|
|
// Testing
|
|
|
|
testImplementation("junit:junit:4.13.2")
|
2024-03-25 00:03:04 +00:00
|
|
|
testImplementation("org.json:json:20240303")
|
2023-11-15 16:31:02 +00:00
|
|
|
androidTestImplementation("androidx.test:core")
|
2024-07-15 15:10:41 +00:00
|
|
|
implementation("androidx.test.ext:junit-ktx:1.2.1")
|
|
|
|
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
|
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
2022-10-26 19:56:31 +00:00
|
|
|
|
2023-11-15 16:31:02 +00:00
|
|
|
// Android Core & Lifecycle
|
2024-05-27 14:05:56 +00:00
|
|
|
implementation("androidx.core:core-ktx:1.13.1")
|
2024-06-30 14:17:30 +00:00
|
|
|
implementation("androidx.appcompat:appcompat:1.7.0")
|
2024-03-17 02:37:09 +00:00
|
|
|
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
2024-07-15 15:10:41 +00:00
|
|
|
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.3")
|
|
|
|
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.3")
|
2024-03-17 02:37:09 +00:00
|
|
|
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
|
2023-10-10 18:49:04 +00:00
|
|
|
|
2023-11-15 16:31:02 +00:00
|
|
|
// Design & UI
|
|
|
|
implementation("jp.wasabeef:glide-transformations:4.3.0")
|
2023-10-29 16:35:48 +00:00
|
|
|
implementation("androidx.preference:preference-ktx:1.2.1")
|
2024-05-27 14:05:56 +00:00
|
|
|
implementation("com.google.android.material:material:1.12.0")
|
2023-11-15 16:31:02 +00:00
|
|
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
|
|
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
2022-10-26 19:56:31 +00:00
|
|
|
|
2023-11-15 16:31:02 +00:00
|
|
|
// Glide Module
|
2023-12-07 20:51:42 +00:00
|
|
|
ksp("com.github.bumptech.glide:ksp:4.16.0")
|
|
|
|
implementation("com.github.bumptech.glide:glide:4.16.0")
|
|
|
|
implementation("com.github.bumptech.glide:okhttp3-integration:4.16.0")
|
2023-11-15 16:31:02 +00:00
|
|
|
|
|
|
|
// For KSP -> Official Annotation Processors are Not Yet Supported for KSP
|
2024-07-15 15:10:41 +00:00
|
|
|
ksp("dev.zacsweers.autoservice:auto-service-ksp:1.2.0")
|
|
|
|
implementation("com.google.guava:guava:33.2.1-android")
|
|
|
|
implementation("dev.zacsweers.autoservice:auto-service-ksp:1.2.0")
|
2022-10-26 19:56:31 +00:00
|
|
|
|
2023-11-15 16:31:02 +00:00
|
|
|
// Media 3 (ExoPlayer)
|
2023-08-17 21:11:59 +00:00
|
|
|
implementation("androidx.media3:media3-ui:1.1.1")
|
|
|
|
implementation("androidx.media3:media3-cast:1.1.1")
|
2023-11-15 16:31:02 +00:00
|
|
|
implementation("androidx.media3:media3-common:1.1.1")
|
|
|
|
implementation("androidx.media3:media3-session:1.1.1")
|
|
|
|
implementation("androidx.media3:media3-exoplayer:1.1.1")
|
|
|
|
implementation("com.google.android.mediahome:video:1.0.0")
|
2023-08-17 21:11:59 +00:00
|
|
|
implementation("androidx.media3:media3-exoplayer-hls:1.1.1")
|
|
|
|
implementation("androidx.media3:media3-exoplayer-dash:1.1.1")
|
2023-11-15 16:31:02 +00:00
|
|
|
implementation("androidx.media3:media3-datasource-okhttp:1.1.1")
|
|
|
|
|
|
|
|
// PlayBack
|
|
|
|
implementation("com.jaredrummler:colorpicker:1.1.0") // Subtitle Color Picker
|
|
|
|
implementation("com.github.recloudstream:media-ffmpeg:1.1.0") // Custom FF-MPEG Lib for Audio Codecs
|
2024-07-15 15:10:41 +00:00
|
|
|
implementation("com.github.teamnewpipe:NewPipeExtractor:592f159") /* For Trailers
|
2023-11-15 16:31:02 +00:00
|
|
|
^ Update to Latest Commits if Trailers Misbehave, github.com/TeamNewPipe/NewPipeExtractor/commits/dev */
|
2024-07-15 15:10:41 +00:00
|
|
|
implementation("com.github.albfernandez:juniversalchardet:2.5.0") // Subtitle Decoding
|
2022-10-26 19:56:31 +00:00
|
|
|
|
2023-11-15 16:31:02 +00:00
|
|
|
// Crash Reports (AcraApplication.kt)
|
2024-01-19 20:09:07 +00:00
|
|
|
implementation("ch.acra:acra-core:5.11.3")
|
|
|
|
implementation("ch.acra:acra-toast:5.11.3")
|
2022-10-26 19:56:31 +00:00
|
|
|
|
2023-11-15 16:31:02 +00:00
|
|
|
// UI Stuff
|
|
|
|
implementation("com.facebook.shimmer:shimmer:0.5.0") // Shimmering Effect (Loading Skeleton)
|
|
|
|
implementation("androidx.palette:palette-ktx:1.0.0") // Palette For Images -> Colors
|
2022-10-26 19:56:31 +00:00
|
|
|
implementation("androidx.tvprovider:tvprovider:1.0.0")
|
2023-11-15 16:31:02 +00:00
|
|
|
implementation("com.github.discord:OverlappingPanels:0.1.5") // Gestures
|
2024-03-08 00:45:20 +00:00
|
|
|
implementation ("androidx.biometric:biometric:1.2.0-alpha05") // Fingerprint Authentication
|
2023-11-15 16:31:02 +00:00
|
|
|
implementation("com.github.rubensousa:previewseekbar-media3:1.1.1.0") // SeekBar Preview
|
2024-07-15 15:10:41 +00:00
|
|
|
implementation("io.github.g0dkar:qrcode-kotlin:4.2.0") // QR code for PIN Auth on TV
|
2023-11-15 16:31:02 +00:00
|
|
|
|
2023-12-07 20:42:32 +00:00
|
|
|
// Extensions & Other Libs
|
2024-05-27 14:05:56 +00:00
|
|
|
implementation("org.mozilla:rhino:1.7.15") // run JavaScript
|
2023-11-15 16:31:02 +00:00
|
|
|
implementation("me.xdrop:fuzzywuzzy:1.4.0") // Library/Ext Searching with Levenshtein Distance
|
2023-12-07 20:43:52 +00:00
|
|
|
implementation("com.github.LagradOst:SafeFile:0.0.6") // To Prevent the URI File Fu*kery
|
2023-11-15 16:31:02 +00:00
|
|
|
implementation("org.conscrypt:conscrypt-android:2.5.2") // To Fix SSL Fu*kery on Android 9
|
2024-07-15 15:10:41 +00:00
|
|
|
implementation("com.uwetrottmann.tmdb2:tmdb-java:2.11.0") // TMDB API v3 Wrapper Made with RetroFit
|
2023-12-07 20:42:32 +00:00
|
|
|
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
|
2023-11-15 16:31:02 +00:00
|
|
|
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1") /* JSON Parser
|
|
|
|
^ Don't Bump Jackson above 2.13.1 , Crashes on Android TV's and FireSticks that have Min API
|
|
|
|
Level 25 or Less. */
|
2022-10-26 19:56:31 +00:00
|
|
|
|
2023-11-15 16:31:02 +00:00
|
|
|
// Downloading & Networking
|
2024-01-21 19:11:51 +00:00
|
|
|
implementation("androidx.work:work-runtime:2.9.0")
|
|
|
|
implementation("androidx.work:work-runtime-ktx:2.9.0")
|
2024-02-29 16:07:45 +00:00
|
|
|
implementation("com.github.Blatzar:NiceHttp:0.4.11") // HTTP Lib
|
2024-04-16 21:07:28 +00:00
|
|
|
|
|
|
|
implementation(project(":library") {
|
2024-07-03 01:42:10 +00:00
|
|
|
// There does not seem to be a good way of getting the android flavor.
|
|
|
|
val isDebug = gradle.startParameter.taskRequests.any { task ->
|
|
|
|
task.args.any { arg ->
|
|
|
|
arg.contains("debug", true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.extra.set("isDebug", isDebug)
|
2024-04-16 21:07:28 +00:00
|
|
|
})
|
2022-10-26 19:56:31 +00:00
|
|
|
}
|
|
|
|
|
2024-04-16 21:07:28 +00:00
|
|
|
tasks.register<Jar>("androidSourcesJar") {
|
2022-10-26 19:56:31 +00:00
|
|
|
archiveClassifier.set("sources")
|
2023-11-15 16:31:02 +00:00
|
|
|
from(android.sourceSets.getByName("main").java.srcDirs) // Full Sources
|
2022-10-26 19:56:31 +00:00
|
|
|
}
|
|
|
|
|
2024-04-16 21:07:28 +00:00
|
|
|
tasks.register<Copy>("copyJar") {
|
|
|
|
from(
|
|
|
|
"build/intermediates/compile_app_classes_jar/prereleaseDebug",
|
|
|
|
"../library/build/libs"
|
|
|
|
)
|
|
|
|
into("build/app-classes")
|
|
|
|
include("classes.jar", "library-jvm*.jar")
|
|
|
|
// Remove the version
|
|
|
|
rename("library-jvm.*.jar", "library-jvm.jar")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Merge the app classes and the library classes into classes.jar
|
|
|
|
tasks.register<Jar>("makeJar") {
|
2024-07-04 18:07:01 +00:00
|
|
|
// Duplicates cause hard to catch errors, better to fail at compile time.
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.FAIL
|
2024-04-16 21:07:28 +00:00
|
|
|
dependsOn(tasks.getByName("copyJar"))
|
|
|
|
from(
|
|
|
|
zipTree("build/app-classes/classes.jar"),
|
|
|
|
zipTree("build/app-classes/library-jvm.jar")
|
|
|
|
)
|
|
|
|
destinationDirectory.set(layout.buildDirectory)
|
|
|
|
archivesName = "classes"
|
2022-10-26 19:56:31 +00:00
|
|
|
}
|
|
|
|
|
2023-11-11 16:30:36 +00:00
|
|
|
tasks.withType<KotlinCompile> {
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-26 19:56:31 +00:00
|
|
|
tasks.withType<DokkaTask>().configureEach {
|
|
|
|
moduleName.set("Cloudstream")
|
|
|
|
dokkaSourceSets {
|
|
|
|
named("main") {
|
|
|
|
sourceLink {
|
|
|
|
// Unix based directory relative path to the root of the project (where you execute gradle respectively).
|
|
|
|
localDirectory.set(file("src/main/java"))
|
|
|
|
|
|
|
|
// URL showing where the source code can be accessed through the web browser
|
|
|
|
remoteUrl.set(URL("https://github.com/recloudstream/cloudstream/tree/master/app/src/main/java"))
|
2023-11-15 16:31:02 +00:00
|
|
|
|
2022-10-26 19:56:31 +00:00
|
|
|
// Suffix which is used to append the line number to the URL. Use #L for GitHub
|
|
|
|
remoteLineSuffix.set("#L")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-28 22:38:55 +00:00
|
|
|
}
|