Skip to content

Commit

Permalink
Merge pull request #147 from MohamedRejeb/0.5.x
Browse files Browse the repository at this point in the history
Refactor convention plugins
  • Loading branch information
MohamedRejeb authored Aug 7, 2024
2 parents b6c9052 + f2f2328 commit 77d50ee
Show file tree
Hide file tree
Showing 31 changed files with 341 additions and 288 deletions.
4 changes: 1 addition & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
// id("root.publication")
id("root.publication")
// trick: for the same plugin versions in all sub-modules
alias(libs.plugins.androidApplication).apply(false)
alias(libs.plugins.androidLibrary).apply(false)
Expand All @@ -11,5 +11,3 @@ plugins {
alias(libs.plugins.composeMultiplatform).apply(false)
alias(libs.plugins.conventionPlugin).apply(false)
}

rootPublicationSetup()
9 changes: 2 additions & 7 deletions calf-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
id("module.publication")
}

composeMultiplatformSetup()
modulePublicationSetup()

kotlin {
sourceSets.commonMain.dependencies {
implementation(compose.runtime)
Expand Down
7 changes: 2 additions & 5 deletions calf-file-picker-coil/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
id("kotlin.multiplatform")
id("module.publication")
}

kotlinMultiplatformSetup()
modulePublicationSetup()

kotlin {
sourceSets.commonMain.dependencies {
api(projects.calfCore)
Expand Down
9 changes: 2 additions & 7 deletions calf-file-picker/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
id("module.publication")
}

composeMultiplatformSetup()
modulePublicationSetup()

kotlin {
sourceSets.commonMain.dependencies {
api(projects.calfIo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.interop.LocalUIViewController
import com.mohamedrejeb.calf.core.InternalCalfApi
import com.mohamedrejeb.calf.io.KmpFile
import kotlinx.cinterop.BetaInteropApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
Expand Down Expand Up @@ -37,6 +38,7 @@ import platform.UniformTypeIdentifiers.UTTypeVideo
import platform.darwin.NSObject
import kotlin.coroutines.resume

@OptIn(BetaInteropApi::class)
@Composable
actual fun rememberFilePickerLauncher(
type: FilePickerFileType,
Expand All @@ -49,7 +51,7 @@ actual fun rememberFilePickerLauncher(
rememberDocumentPickerLauncher(type, selectionMode, onResult)
}

@OptIn(InternalCalfApi::class)
@OptIn(InternalCalfApi::class, BetaInteropApi::class)
@Composable
private fun rememberDocumentPickerLauncher(
type: FilePickerFileType,
Expand Down Expand Up @@ -137,6 +139,7 @@ private fun rememberDocumentPickerLauncher(
}
}

@OptIn(BetaInteropApi::class)
@Composable
private fun rememberImageVideoPickerLauncher(
type: FilePickerFileType,
Expand Down
7 changes: 1 addition & 6 deletions calf-geo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
}

composeMultiplatformSetup()

kotlin {
sourceSets.commonMain.dependencies {
implementation(compose.runtime)
Expand Down
7 changes: 2 additions & 5 deletions calf-io/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
id("kotlin.multiplatform")
id("module.publication")
}

kotlinMultiplatformSetup()
modulePublicationSetup()

kotlin {
sourceSets.commonMain.dependencies {
api(projects.calfCore)
Expand Down
7 changes: 1 addition & 6 deletions calf-maps/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
}

composeMultiplatformSetup()

kotlin {
sourceSets.commonMain.dependencies {
implementation(compose.runtime)
Expand Down
7 changes: 1 addition & 6 deletions calf-navigation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
}

composeMultiplatformSetup()

kotlin {
sourceSets.commonMain.dependencies {
implementation(compose.runtime)
Expand Down
9 changes: 2 additions & 7 deletions calf-permissions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
id("module.publication")
}

composeMultiplatformSetup()
modulePublicationSetup()

kotlin {
sourceSets.commonMain.dependencies {
implementation(compose.runtime)
Expand Down
7 changes: 1 addition & 6 deletions calf-sf-symbols/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
}

composeMultiplatformSetup()

kotlin {
sourceSets.commonMain.dependencies {
implementation(compose.runtime)
Expand Down
9 changes: 2 additions & 7 deletions calf-ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
id("module.publication")
}

composeMultiplatformSetup()
modulePublicationSetup()

kotlin {
sourceSets.commonMain.dependencies {
implementation(projects.calfCore)
Expand Down
9 changes: 2 additions & 7 deletions calf-webview/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import org.gradle.internal.os.OperatingSystem

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.androidLibrary)
id("compose.multiplatform")
id("module.publication")
}

composeMultiplatformSetup()
modulePublicationSetup()

val os: OperatingSystem = OperatingSystem.current()
val arch: String = System.getProperty("os.arch")
val isAarch64: Boolean = arch.contains("aarch64")
Expand Down
4 changes: 2 additions & 2 deletions convention-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl-base`
`java-gradle-plugin`
`kotlin-dsl`
}

java {
Expand All @@ -23,6 +22,7 @@ dependencies {
implementation(libs.gradlePlugin.android)
implementation(libs.gradlePlugin.jetbrainsCompose)
implementation(libs.gradlePlugin.kotlin)
implementation(libs.gradlePlugin.composeCompiler)
implementation(libs.nexus.publish)

// hack to access version catalogue https://github.com/gradle/gradle/issues/15383
Expand Down
18 changes: 0 additions & 18 deletions convention-plugins/src/main/kotlin/ComposeMultiplatform.kt

This file was deleted.

15 changes: 0 additions & 15 deletions convention-plugins/src/main/kotlin/KotlinMultiplatform.kt

This file was deleted.

92 changes: 0 additions & 92 deletions convention-plugins/src/main/kotlin/Publication.kt

This file was deleted.

8 changes: 2 additions & 6 deletions convention-plugins/src/main/kotlin/Targets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ fun KotlinMultiplatformExtension.applyTargets() {
jvmToolchain(11)
jvm("desktop")

js {
browser()
}
js().browser()

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
}
wasmJs().browser()

iosX64()
iosArm64()
Expand Down
Loading

0 comments on commit 77d50ee

Please sign in to comment.