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

Simplify sample app #111

Merged
merged 11 commits into from
Apr 21, 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
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
*.iml
.gradle
/local.properties
/.idea
.idea
local.properties
.DS_Store
build/
/captures
captures
xcuserdata
.externalNativeBuild
.cxx
local.properties
Carthage/
Cartfile.resolved
57 changes: 28 additions & 29 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
import java.util.Properties

plugins {
id("com.google.gms.google-services") version "4.3.15" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
alias(libs.plugins.ktlint)
alias(libs.plugins.nexus)
alias(libs.plugins.jetbrains.compose) apply false
}

allprojects {
val localProps = Properties()
val localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.inputStream().use { localProps.load(it) }
}
val localProps = Properties()
val localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.inputStream().use { localProps.load(it) }
}

val signingKey by extra(
localProps.getOrDefault("signing.key", System.getenv("SIGNING_KEY") ?: "")
)
val signingPassword by extra(
localProps.getOrDefault("signing.password", System.getenv("SIGNING_PASSWORD") ?: "")
)
val ossrhUsername by extra(
localProps.getOrDefault("ossrhUsername", System.getenv("OSSRH_USERNAME") ?: "")
val signingKey by extra(
localProps.getOrDefault("signing.key", System.getenv("SIGNING_KEY") ?: "")
)
val signingPassword by extra(
localProps.getOrDefault("signing.password", System.getenv("SIGNING_PASSWORD") ?: "")
)
val ossrhUsername by extra(
localProps.getOrDefault("ossrhUsername", System.getenv("OSSRH_USERNAME") ?: "")
)
val ossrhPassword by extra(
localProps.getOrDefault("ossrhPassword", System.getenv("OSSRH_PASSWORD") ?: "")
)
val sonatypeStagingProfileId by extra(
localProps.getOrDefault(
"sonatypeStagingProfileId",
System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: ""
)
val ossrhPassword by extra(
localProps.getOrDefault("ossrhPassword", System.getenv("OSSRH_PASSWORD") ?: "")
)
val sonatypeStagingProfileId by extra(
localProps.getOrDefault(
"sonatypeStagingProfileId",
System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: ""
)
)
}
)

nexusPublishing {
this.repositories {
sonatype {
val sonatypeStagingProfileId: String by extra
val ossrhUsername: String by extra
val ossrhPassword: String by extra
val sonatypeStagingProfileId: String by rootProject.extra
val ossrhUsername: String by rootProject.extra
val ossrhPassword: String by rootProject.extra

stagingProfileId.set(sonatypeStagingProfileId)
username.set(ossrhUsername)
Expand Down
11 changes: 2 additions & 9 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
mavenCentral()
google()
}

dependencies {
implementation("com.android.tools.build:gradle:8.0.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
implementation("org.jlleitschuh.gradle:ktlint-gradle:10.3.0")
implementation(libs.kotlin.plugin)
implementation(libs.agp.plugin)
}
13 changes: 13 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}

repositories {
gradlePluginPortal()
mavenCentral()
google()
}
}
5 changes: 0 additions & 5 deletions buildSrc/src/main/kotlin/AndroidConfig.kt

This file was deleted.

7 changes: 7 additions & 0 deletions buildSrc/src/main/kotlin/KotlinAndroidTarget.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget

fun KotlinAndroidTarget.configureJvmTarget(jvmVersion: String = "1.8") {
compilations.all {
kotlinOptions.jvmTarget = jvmVersion
}
}
15 changes: 15 additions & 0 deletions buildSrc/src/main/kotlin/KotlinMultiplatformExtension.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

fun KotlinMultiplatformExtension.configureKotlinCompilerArgs(vararg args: String) {
targets.all {
compilations.all {
kotlinOptions {
freeCompilerArgs += setOf(
"-opt-in=kotlin.RequiresOptIn",
"-Xexpect-actual-classes",
*args
)
}
}
}
}
37 changes: 0 additions & 37 deletions buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts

This file was deleted.

37 changes: 37 additions & 0 deletions buildSrc/src/main/kotlin/webrtc.multiplatform.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
plugins {
id("com.android.library")
kotlin("multiplatform")
}

kotlin {
configureKotlinCompilerArgs()

androidTarget {
configureJvmTarget()
}
}

android {
compileSdk = androidCompileSdkVersion

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDir("src/androidMain/res")

defaultConfig {
minSdk = androidMinSdkVersion
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

private val Project.versionCatalog: VersionCatalog
get() = extensions.getByType<VersionCatalogsExtension>().named("libs")

private val Project.androidCompileSdkVersion: Int
get() = "${versionCatalog.findVersion("compileSdk").get()}".toInt()

private val Project.androidMinSdkVersion: Int
get() = "${versionCatalog.findVersion("minSdk").get()}".toInt()
15 changes: 12 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
# Gradle
org.gradle.caching=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2g

# Kotlin
kotlin.code.style=official
kotlin.mpp.enableCInteropCommonization=true
kotlin.js.compiler=ir

# Android
android.nonTransitiveRClass=true
android.useAndroidX=true

# Workaround for java.lang.NoSuchMethodError: No static method createEgl14([I)Lorg/webrtc/EglBase14; exception
# https://issuetracker.google.com/issues/265195801
android.enableDexingArtifactTransform=false
android.useFullClasspathForDexingTransform = true

# KMP
kotlin.mpp.androidSourceSetLayoutVersion=2
kotlin.mpp.enableCInteropCommonization=true

#Compose
org.jetbrains.compose.experimental.jscanvas.enabled=true

# Versions
webRtcKmpVersion=0.114.4
58 changes: 58 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[versions]
kotlin = "1.9.23"
kotlin-coroutines = "1.8.0"
androidx-activity-compose = "1.9.0"
androidx-appcompat = "1.6.1"
androidx-core = "1.13.0"
androidx-material = "1.11.0"
androidx-lifecycle = "2.7.0"
androidx-test-core = "1.5.0"
androidx-test-runner = "1.5.2"
androidx-test-rules = "1.5.0"
accompanist-permision = "0.34.0"
compose = "1.6.6"
kermit = "2.0.3"
kotlin-wrappers = "1.0.0-pre.732"
webrtc-sdk = "114.5735.02"

#Android
minSdk = "21"
compileSdk = "34"
targetSdk = "34"

# Plugins
agp = "8.2.2"
ktlint = "10.3.0"
nexus = "1.3.0"
compose-plugin = "1.6.2"

[libraries]
webrtc-sdk = { module = "io.github.webrtc-sdk:android", version.ref = "webrtc-sdk" }
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlin-coroutines" }
androidx-coreKtx = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" }
androidx-material = { module = "com.google.android.material:material", version.ref = "androidx-material" }
accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanist-permision" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
kermit = { module = "co.touchlab:kermit", version.ref = "kermit" }
androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test-core" }
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test-rules" }
kotlin-wrappers-bom = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version.ref = "kotlin-wrappers" }
kotlin-wrappers-emotion = { module = "org.jetbrains.kotlin-wrappers:kotlin-emotion" }
kotlin-wrappers-react = { module = "org.jetbrains.kotlin-wrappers:kotlin-react" }
kotlin-wrappers-reactDom = { module = "org.jetbrains.kotlin-wrappers:kotlin-react-dom" }
kotlin-wrappers-mui = { module = "org.jetbrains.kotlin-wrappers:kotlin-mui-material" }

# Plugin dependencies
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
agp-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }

[plugins]
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
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-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading