Skip to content
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
64 changes: 64 additions & 0 deletions .github/workflows/kotlin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
on:
push:
branches:
- master
tags:
- 'gl-sdk-*'
pull_request: {}

name: Kotlin library

jobs:

build:
runs-on: macos-26
steps:
- name: "Show default version of NDK"
run: echo $ANDROID_NDK_ROOT

- name: "Check out PR branch"
uses: actions/checkout@v4

- name: "Set up JDK"
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21

- uses: dtolnay/rust-toolchain@1.85.0
with:
targets: x86_64-linux-android, aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, aarch64-apple-ios, aarch64-apple-ios-sim, x86_64-apple-ios

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Task
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin

- name: "Install NDK"
run: |
cargo install cargo-ndk --version 3.5.4

- name: "Build Kotlin Multiplatform bindings"
run: |
/usr/local/bin/task build:android

- name: "Build Android library"
working-directory: libs/gl-sdk-android
run: |
./gradlew :lib:assemble --console=plain

- name: "Puiblish to Maven"
working-directory: libs/gl-sdk-android
run: |
./gradlew :lib:publishToMavenLocal

- name: Temporarily save artifact
uses: actions/upload-artifact@v4
with:
name: glsdk-artifact
path: libs/gl-sdk-android/lib/build/outputs/
retention-days: 14
8 changes: 6 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: "3"

includes:
build:
taskfile: "build/.tasks.yml"
dir: "."

clnvm:
taskfile: "libs/cln-version-manager/.tasks.yml"
dir: "libs/cln-version-manager/"
Expand Down Expand Up @@ -52,10 +56,10 @@ tasks:
-t gltesting \
-f docker/gl-testing/Dockerfile \
.

docker-ci-check:
deps:
# - docker-ci-build
- docker-ci-build
cmds:
- docker run --rm -ti -v $(pwd):/repo gltesting task ci-check

Expand Down
58 changes: 58 additions & 0 deletions build/.tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: "3"

tasks:
android:
deps:
- linux-android-aarch64
- linux-androideabi-armv7
- linux-android-i686
- linux-android-x86_64
cmds:
- cp -a target/release/android/jniLibs libs/gl-sdk-android/lib/src/androidMain

kotlin:
deps:
- android
cmds:
- cargo install --bin gobley-uniffi-bindgen gobley-uniffi-bindgen@0.2.0
- gobley-uniffi-bindgen --config ./libs/gl-sdk/uniffi.kotlin-multiplatform.toml --library ./target/aarch64-linux-android/debug/libglsdk.a --out-dir target/release/kotlin-multiplatform
- cp -a ./target/release/kotlin-multiplatform/* libs/gl-sdk-android/lib/src/

swift:
deps:
- ios
- ios-sim
cmds:
- cargo run --features bindings -- generate --library ./target/aarch64-apple-ios/release/libglsdk.a --language swift --out-dir ./target/swift
- mkdir -p ./target/swift/include
- mv target/swift/glsdkFFI.h target/swift/include
- mv target/swift/glsdkFFI.modulemap target/swift/include/module.modulemap
- xcodebuild -create-xcframework -library target/lipo-ios-sim/release/libglsdk.a -headers target/swift/include -library target/aarch64-apple-ios/release/libglsdk.a -headers target/swift/include -output target/glsdkFFI.xcframework

linux-*-*:
vars:
ABI: '{{index .MATCH 0}}'
ARCH: '{{index .MATCH 1}}'
cmds:
- cargo ndk -t {{.ARCH}}-linux-{{.ABI}} -o target/release/android/jniLibs build -p gl-sdk

ios:
deps:
- ios-apple-aarch64
- ios-apple-x86_64

ios-sim:
deps:
- ios-sim-apple-aarch64

ios-apple-*:
vars:
ARCH: '{{ index .MATCH 0 }}'
cmds:
- IPHONEOS_DEPLOYMENT_TARGET=12.0 MACOSX_DEPLOYMENT_TARGET=11.0 cargo build --release --target {{.ARCH}}-apple-ios -p gl-sdk

ios-sim-apple-*:
vars:
ARCH: '{{ index .MATCH 0 }}'
cmds:
- IPHONEOS_DEPLOYMENT_TARGET=12.0 MACOSX_DEPLOYMENT_TARGET=11.0 cargo build --release --target {{.ARCH}}-apple-ios-sim -p gl-sdl
8 changes: 8 additions & 0 deletions libs/gl-sdk-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinSerialization) apply false
alias(libs.plugins.mavenPublish) apply false
alias(libs.plugins.atomicfu) apply false
}
30 changes: 30 additions & 0 deletions libs/gl-sdk-android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

kotlinx.atomicfu.enableJvmIrTransformation=true
kotlinx.atomicfu.enableNativeIrTransformation=true

kotlin.mpp.enableCInteropCommonization=true

libraryVersion=0.12.4
31 changes: 31 additions & 0 deletions libs/gl-sdk-android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[versions]
annotation = "1.9.1"
kotlin = "2.2.20"
kotlinx-serialization = "1.9.0"
kotlinx-coroutines = "1.10.2"
android-gradle-plugin = "8.13.0"
okio = "3.16.0"
espresso = "3.7.0"
jna = "5.18.1"
junit = "4.13.2"
junit-ext = "1.3.0"
maven-publish = "0.34.0"
atomicfu = "0.29.0"

[libraries]
annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" }
junit-ext = { module = "androidx.test.ext:junit", version.ref = "junit-ext" }
junit = { module = "junit:junit", version.ref = "junit" }

[plugins]
androidLibrary = { id = "com.android.library", version.ref = "android-gradle-plugin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
atomicfu = { id = "org.jetbrains.kotlinx.atomicfu", version.ref = "atomicfu" }
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
Binary file not shown.
6 changes: 6 additions & 0 deletions libs/gl-sdk-android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Fri Jan 19 10:34:57 EET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading