Skip to content

Commit

Permalink
Update gradle (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
CranberrySoup authored Jan 5, 2025
1 parent 68db721 commit ca2ec09
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 17 deletions.
26 changes: 22 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
}
Expand All @@ -11,6 +14,21 @@ java {
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType<KotlinCompile> {
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()
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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<Path>()).also { closer.register(it) },
desugarClasspath = ClassFileProviderFactory(listOf<Path>()).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
)
)

Expand All @@ -70,7 +74,8 @@ abstract class CompileDexTask : DefaultTask() {

dexBuilder.convert(
files.stream(),
dexOutputDir.toPath()
dexOutputDir.toPath(),
null,
)

for (file in files) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/kotlin/com/lagradost/cloudstream3/gradle/tasks/Tasks.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -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"))
}
Expand Down

0 comments on commit ca2ec09

Please sign in to comment.