diff --git a/build.gradle.kts b/build.gradle.kts index 65578ca..7f09793 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,8 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { - kotlin("jvm") version "1.7.10" + kotlin("jvm") version "2.0.0" id("java-gradle-plugin") id("maven-publish") } @@ -11,6 +14,21 @@ java { targetCompatibility = JavaVersion.VERSION_11 } +tasks.withType { + compilerOptions { + // Disables some unnecessary features + freeCompilerArgs.addAll( + listOf( + "-Xno-call-assertions", + "-Xno-param-assertions", + "-Xno-receiver-assertions" + ) + ) + + jvmTarget.set(JvmTarget.JVM_11) // Required + } +} + repositories { mavenCentral() google() @@ -23,9 +41,9 @@ dependencies { compileOnly("com.google.guava:guava:30.1.1-jre") compileOnly("com.android.tools:sdk-common:30.0.0") - compileOnly("com.android.tools.build:gradle:7.2.2") - compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10") - + compileOnly("com.android.tools.build:gradle:8.7.3") + compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0") + implementation("org.ow2.asm:asm:9.4") implementation("org.ow2.asm:asm-tree:9.4") implementation("com.github.vidstige:jadb:master-SNAPSHOT") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 84d1f85..19cfad9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/CompileDexTask.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/CompileDexTask.kt index fb4e7c0..37d4104 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/CompileDexTask.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/CompileDexTask.kt @@ -47,16 +47,20 @@ abstract class CompileDexTask : DefaultTask() { minSdkVersion = minSdk, debuggable = true, dexPerClass = false, - withDesugaring = minSdk >= 24, + withDesugaring = true, // Make all plugins work on lower android versions desugarBootclasspath = ClassFileProviderFactory(android.bootClasspath.map(File::toPath)) .also { closer.register(it) }, - desugarClasspath = ClassFileProviderFactory(listOf()).also { closer.register(it) }, + desugarClasspath = ClassFileProviderFactory(listOf()).also { + closer.register( + it + ) + }, coreLibDesugarConfig = null, - coreLibDesugarOutputKeepRuleFile = null, messageReceiver = MessageReceiverImpl( ErrorFormatMode.HUMAN_READABLE, LoggerFactory.getLogger(CompileDexTask::class.java) - ) + ), + enableApiModeling = false // Unknown option, setting to false seems to work ) ) @@ -70,7 +74,8 @@ abstract class CompileDexTask : DefaultTask() { dexBuilder.convert( files.stream(), - dexOutputDir.toPath() + dexOutputDir.toPath(), + null, ) for (file in files) { diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/DeployWithAdbTask.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/DeployWithAdbTask.kt index c78a537..bdb4f81 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/DeployWithAdbTask.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/DeployWithAdbTask.kt @@ -43,6 +43,10 @@ abstract class DeployWithAdbTask : DefaultTask() { device.push(file, RemoteFile(path + file.name)) + // Make the file readonly to work on newer android versions, this does not impact adb push. + // https://developer.android.com/about/versions/14/behavior-changes-14#safer-dynamic-code-loading + device.executeShell("chmod", "-w", path + file.name) + val args = arrayListOf("start", "-a", "android.intent.action.VIEW", "-d", "cloudstreamapp:") if (waitForDebugger) { diff --git a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt index cc51430..a64d569 100644 --- a/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt +++ b/src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt @@ -1,7 +1,6 @@ package com.lagradost.cloudstream3.gradle.tasks import com.lagradost.cloudstream3.gradle.getCloudstream -import com.lagradost.cloudstream3.gradle.entities.PluginManifest import com.lagradost.cloudstream3.gradle.makeManifest import com.android.build.gradle.BaseExtension import com.android.build.gradle.tasks.ProcessLibraryManifest @@ -12,7 +11,6 @@ import org.gradle.api.tasks.AbstractCopyTask import org.gradle.api.tasks.bundling.Zip import org.gradle.api.tasks.compile.AbstractCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import com.lagradost.cloudstream3.gradle.findCloudstream const val TASK_GROUP = "cloudstream" @@ -47,11 +45,13 @@ fun registerTasks(project: Project) { it.input.from(kotlinTask.destinationDirectory) } - val javacTask = project.tasks.findByName("compileDebugJavaWithJavac") as AbstractCompile? - if (javacTask != null) { - it.dependsOn(javacTask) - it.input.from(javacTask.destinationDirectory) - } + // This task does not seem to be required for a successful cs3 file + +// val javacTask = project.tasks.findByName("compileDebugJavaWithJavac") as AbstractCompile? +// if (javacTask != null) { +// it.dependsOn(javacTask) +// it.input.from(javacTask.destinationDirectory) +// } it.outputFile.set(intermediates.resolve("classes.dex")) }