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

chore(stremio-core-kotlin): bump gradle dependencies #61

Merged
merged 1 commit into from
Nov 7, 2024
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
56 changes: 14 additions & 42 deletions stremio-core-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import com.android.build.api.dsl.AndroidSourceSet
import com.google.protobuf.gradle.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "com.github.Stremio"
version = "1.3.0"
Expand All @@ -13,50 +11,32 @@ allprojects {
}

plugins {
kotlin("multiplatform") version "1.8.0"
id("maven-publish")
id("com.android.library") version "7.2.2"
kotlin("multiplatform") version "1.9.25"
id("org.mozilla.rust-android-gradle.rust-android") version "0.9.4"
id("com.google.protobuf") version "0.8.18"
id("com.google.protobuf") version "0.9.4"
id("com.android.library") version "8.5.2"
id("maven-publish")
}

val kotlinVersion: String by extra
val pbandkVersion: String by extra
val protobufVersion: String by extra
val stremioCoreAndroidProfile: String by extra

buildscript {
extra["kotlinVersion"] = "1.7.20"
extra["pbandkVersion"] = "0.14.2"
extra["protobufVersion"] = "3.21.0"
extra["stremioCoreAndroidProfile"] = "release"

val kotlinVersion: String by extra
extra["kotlinVersion"] = "1.9.25"
extra["pbandkVersion"] = "0.16.0"
extra["protobufVersion"] = "4.28.3"

repositories {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
}

dependencies {
classpath("com.android.tools.build:gradle:7.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.mozilla.rust-android-gradle:plugin:0.9.0")
classpath("com.google.protobuf:protobuf-gradle-plugin:0.8.18")
gradlePluginPortal()
}
}

fun AndroidSourceSet.proto(action: SourceDirectorySet.() -> Unit) {
(this as? ExtensionAware)
?.extensions
?.getByName("proto")
?.let { it as? SourceDirectorySet }
?.apply(action)
}

kotlin {
android {
jvmToolchain(17)
androidTarget {
// TODO: Adding a "debug" variant here results in failing imports in KMM projects. Figure out why.
publishLibraryVariants("release")
}
Expand All @@ -77,12 +57,12 @@ kotlin {
}

android {
compileSdk = 33
ndkVersion = "27.2.12479018" // configure in .cargo/config.toml and workflows/release.yml as well

defaultConfig {
namespace = "com.stremio.core"
minSdk = 21
targetSdk = 33
compileSdk = 34
}

sourceSets {
Expand All @@ -94,16 +74,14 @@ android {
}
}

packagingOptions {
packaging {
resources {
excludes += "**/*.proto"
}
}
}

protobuf {
generatedFilesBaseDir = "$projectDir/src"

protoc {
artifact = "com.google.protobuf:protoc:${protobufVersion}"
}
Expand All @@ -129,17 +107,11 @@ cargo {
targetDirectory = "../target"
targets = listOf("arm", "arm64", "x86", "x86_64")
verbose = true
profile = stremioCoreAndroidProfile
profile = "release"
}

tasks.whenTaskAdded {
if (name == "javaPreCompileDebug" || name == "javaPreCompileRelease" || name == "mergeDebugJniLibFolders" || name == "mergeReleaseJniLibFolders") {
dependsOn("cargoBuild")
}
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
}
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.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 1 addition & 2 deletions stremio-core-kotlin/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.stremio.core">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ actual object Core {

@JvmStatic
private fun onRuntimeEvent(eventProtobuf: ByteArray) {
listeners.forEach {
for (listener in listeners) {
try {
val event = RuntimeEvent.decodeFromByteArray(eventProtobuf)
it.onEvent(event)
listener.onEvent(event)
} catch (e: Exception) {
Log.e("Stremio", "Failed passing event: ", e)
}
Expand Down