Skip to content

Commit

Permalink
Begin to set up SPM publishing.
Browse files Browse the repository at this point in the history
Uses Touchlab plugins SKIE and KMMBridge in order to generate appealing
Swift code, and then make it consumable via Swift Package Manager.
  • Loading branch information
christiandeange committed Apr 13, 2024
1 parent f3bfaf6 commit 338ab26
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

### Mac OS ###
.DS_Store
/.build/
xcuserdata/
Package.swift

### Project ###
/docs
2 changes: 1 addition & 1 deletion api-gen-runtime-internal/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
ozone {
js()
jvm()
ios()
ios("BlueskyAPIRuntimeInternal")
}

kotlin {
Expand Down
2 changes: 1 addition & 1 deletion api-gen-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
ozone {
js()
jvm()
ios()
ios("BlueskyAPIRuntime")
}

kotlin {
Expand Down
2 changes: 1 addition & 1 deletion app/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ozone {
}
js()
jvm()
ios()
ios("OzoneCommon")
}

kotlin {
Expand Down
2 changes: 1 addition & 1 deletion app/ios/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

ozone {
ios()
ios("OzoneIos")
}

kotlin {
Expand Down
4 changes: 3 additions & 1 deletion app/iosApp/ozone.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@
DEVELOPMENT_ASSET_PATHS = "\"ozone/Preview Content\"";
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SRCROOT)/../../app/ios/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../../app/ios/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
"$(SRCROOT)/../../app/ios/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
"$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
"$(SRCROOT)/../../app/ios/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
);
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ozone/Info.plist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A6F18C762BAA793F00F88D20"
BuildableName = "ozone.app"
BuildableName = "Ozone.app"
BlueprintName = "ozone"
ReferencedContainer = "container:ozone.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -45,7 +45,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A6F18C762BAA793F00F88D20"
BuildableName = "ozone.app"
BuildableName = "Ozone.app"
BlueprintName = "ozone"
ReferencedContainer = "container:ozone.xcodeproj">
</BuildableReference>
Expand All @@ -62,7 +62,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A6F18C762BAA793F00F88D20"
BuildableName = "ozone.app"
BuildableName = "Ozone.app"
BlueprintName = "ozone"
ReferencedContainer = "container:ozone.xcodeproj">
</BuildableReference>
Expand Down
2 changes: 1 addition & 1 deletion app/store/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ozone {
}
js()
jvm()
ios()
ios("OzoneStore")
}

kotlin {
Expand Down
16 changes: 15 additions & 1 deletion bluesky/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
import org.jetbrains.dokka.gradle.AbstractDokkaTask
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import sh.christian.ozone.api.generator.ApiReturnType

plugins {
id("ozone-dokka")
id("ozone-multiplatform")
id("ozone-publish")
id("co.touchlab.kmmbridge")
id("sh.christian.ozone.generator")
id("org.jetbrains.kotlinx.binary-compatibility-validator")
}

ozone {
js()
jvm()
ios()
ios("BlueskyAPI") {
project.configurations[exportConfigurationName].extendsFrom(
project.configurations["${target.name}CompilationApi"]
)

@OptIn(ExperimentalKotlinGradlePluginApi::class)
transitiveExport = true
}
}

kmmbridge {
mavenPublishArtifacts()
spm()
}

dependencies {
Expand Down
12 changes: 10 additions & 2 deletions build-logic/src/main/kotlin/sh/christian/plugin/OzoneExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import com.android.build.gradle.AppExtension
import com.android.build.gradle.LibraryExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.Framework

abstract class OzoneExtension(
private val project: Project,
Expand Down Expand Up @@ -57,16 +59,22 @@ abstract class OzoneExtension(
}
}

fun ios() {
fun ios(
name: String,
configure: Framework.() -> Unit = {},
) {
project.plugins.apply("co.touchlab.skie")

kotlin {
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach {
it.binaries.framework {
baseName = project.name
baseName = name
isStatic = true
configure()
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ plugins {
val agp = libs.versions.agp
val compose = libs.versions.compose
val dokka = libs.versions.dokka
val kmmbridge = libs.versions.kmmbridge
val kotlin = libs.versions.kotlin
val ksp = libs.versions.ksp
val mavenPublish = libs.versions.maven.publish
val kotlinxAbi = libs.versions.kotlinx.abi.plugin
val skie = libs.versions.skie

kotlin("jvm") version kotlin apply false
kotlin("multiplatform") version kotlin apply false
kotlin("plugin.serialization") version kotlin apply false
kotlin("android") version kotlin apply false
id("co.touchlab.kmmbridge") version kmmbridge apply false
id("co.touchlab.skie") version skie apply false
id("com.android.application") version agp apply false
id("com.android.library") version agp apply false
id("com.google.devtools.ksp") version ksp apply false
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ agp = "8.1.4"
buildconfig = "4.1.2"
compose = "1.6.1"
dokka = "1.9.20"
kmmbridge = "0.5.2"
kotlin = "1.9.21"
kotlinx-abi-plugin = "0.13.2"
kotlinx-datetime = "0.5.0"
Expand All @@ -13,6 +14,7 @@ maven-publish = "0.25.3"
moshi = "1.15.0"
multiplatform-settings = "1.1.1"
serialization = "1.6.2"
skie = "0.6.2"
workflow = "1.12.1-beta04"

[libraries]
Expand Down

0 comments on commit 338ab26

Please sign in to comment.