Skip to content
Closed
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
59 changes: 0 additions & 59 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,6 @@ on:
types: [published]

jobs:
publish-swift:
runs-on: macos-latest
steps:
- name: Setup JDK
uses: actions/setup-java@v1.4.4
with:
java-version: 17
- name: Checkout source
uses: actions/checkout@v4
- name: Cache build deps
uses: actions/cache@v4
with:
path: |
~/.gradle/wrapper
~/.konan/cache
~/.konan/dependencies
key: build-deps-${{ runner.os }}-${{ hashFiles('gradle/**', 'gradlew*', 'gradle.properties', '*.gradle*') }}

- name: Build XCFrameworks
run: ./gradlew assembleXCFramework

- name: Zip XCFramework
uses: vimtor/action-zip@v1
with:
files: build/xcframework/
dest: build/xcframework.zip

- name: Add release artifacts
id: release_artifacts
uses: softprops/action-gh-release@15d2aaca23625e5b2744248f7b68fc1e6bbff48e
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
build/xcframework.zip

- name: Calculate checksums for XCFrameworks
run: |
cp Package.swift.template Package.swift
echo RELEASE_CHECKSUM=$(swift package compute-checksum build/xcframework.zip) >> $GITHUB_ENV

- name: Checkout master
uses: actions/checkout@v2
with:
ref: 'master'

- name: Update swift package
run: |
sed -e 's|RELEASE-URL|${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/xcframework.zip|;w Package.swift.tmp' Package.swift.template
sed -e 's/RELEASE-CHECKSUM/${{ env.RELEASE_CHECKSUM }}/;w Package.swift' Package.swift.tmp

- name: Commit swift package
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Package.swift
git commit -m "[CI] Update swift package"
git tag swiftpm-${{ github.event.release.tag_name }}
git push origin swiftpm-${{ github.event.release.tag_name }}

publish-maven:
runs-on: macos-latest

Expand Down
69 changes: 12 additions & 57 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import org.apache.tools.ant.taskdefs.condition.Os
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

allprojects {
repositories {
Expand All @@ -12,22 +14,9 @@ allprojects {

plugins {
alias(libs.plugins.kotlin.multiplatform)
`maven-publish`
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.android.library)
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/pebble-dev/libpebblecommon")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
alias(libs.plugins.publish)
}

android {
Expand All @@ -43,13 +32,11 @@ android {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlin {
jvmToolchain(11)
}
}

kotlin {
jvmToolchain(17)

android {
publishLibraryVariants("release", "debug")
}
Expand Down Expand Up @@ -127,6 +114,13 @@ kotlin {
}
}

tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
}
}


if (Os.isFamily(Os.FAMILY_MAC)) {
val iosSimulatorFatFramework by tasks.registering(PlatformFatFramework::class) {
onlyIf {
Expand All @@ -153,47 +147,8 @@ if (Os.isFamily(Os.FAMILY_MAC)) {
inputFrameworks.setFrom(project.files(iosTask.outputFile))
inputFrameworkDSYMs.setFrom(project.files(iosTask.outputFile.path+".dSYM"))
}

val assembleXCFramework by tasks.registering {
onlyIf {
org.apache.tools.ant.taskdefs.condition.Os.isFamily(org.apache.tools.ant.taskdefs.condition.Os.FAMILY_MAC)
}
val deviceTask = tasks.getByName("iosDeviceFatFramework")
val simulatorTask = tasks.getByName("iosSimulatorFatFramework")
dependsOn(deviceTask)
dependsOn(simulatorTask)
outputs.dir(layout.buildDirectory.dir("xcframework")).withPropertyName("outputDir")

val outputPath = layout.buildDirectory.dir("xcframework").get().asFile.path + "/libpebblecommon.xcframework"

doLast {
delete(outputPath)
exec {
commandLine (
"xcodebuild", "-create-xcframework",
"-framework", deviceTask.outputs.files.first { it.name == "libpebblecommon.framework" }.path,
"-debug-symbols", deviceTask.outputs.files.first { it.name == "libpebblecommon.framework.dSYM" }.path,
"-framework", simulatorTask.outputs.files.first { it.name == "libpebblecommon.framework" }.path,
"-debug-symbols", simulatorTask.outputs.files.first { it.name == "libpebblecommon.framework.dSYM" }.path,
"-output", outputPath
)
}
}
}
}

/*project.afterEvaluate {
tasks.withType(PublishToMavenRepository::class.java) {
onlyIf {
!publication.name.contains("ios")
}
}
tasks.withType(Jar::class.java) {
onlyIf {
!name.contains("ios")
}
}
}*/

abstract class PlatformFatFramework: DefaultTask() {
@get:Input
Expand Down
23 changes: 21 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,24 @@ version=0.1.27
org.gradle.jvmargs=-Xms128M -Xmx1G -XX:ReservedCodeCacheSize=200M
kotlin.native.binary.memoryModel=experimental
kotlin.mpp.androidSourceSetLayoutVersion=2
kotlinVersion=2.0.0
agpVersion=8.1.4

# Publishing
SONATYPE_AUTOMATIC_RELEASE=true
SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true
GROUP=io.rebble.libpebblecommon
POM_ARTIFACT_ID=libpebblecommon
VERSION_NAME=0.1.27
POM_NAME=libpebblecommon
POM_DESCRIPTION=A port/rewrite of libpebble2 for Kotlin multiplatform with additional features useful for watch companion apps.
POM_INCEPTION_YEAR=2025
POM_URL=https://github.com/pebble-dev/libpebblecommon
POM_LICENCE_NAME=Apache-2.0
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0
POM_LICENCE_DIST=repo
POM_SCM_URL=https://github.com/pebble-dev/libpebblecommon
POM_SCM_CONNECTION=scm:git:https://github.com/pebble-dev/libpebblecommon.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/pebble-dev/libpebblecommon.git
POM_DEVELOPER_ID=Rebble
POM_DEVELOPER_NAME=Rebble
POM_DEVELOPER_URL=https://rebble.io/
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ coroutine = "1.8.0"
uuid = "0.4.1"
serialization = "1.5.0"
kermit = "2.0.0-RC4"
publish = "0.30.0"

[plugins]
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
android-library = { id = "com.android.library", version.ref = "agp" }
publish = { id = "com.vanniktech.maven.publish", version.ref = "publish"}

[libraries]
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
Expand Down