Skip to content

Commit

Permalink
Abstract some build logic
Browse files Browse the repository at this point in the history
  • Loading branch information
deusaquilus committed Sep 10, 2024
1 parent 069006e commit c6efedb
Show file tree
Hide file tree
Showing 8 changed files with 235,646 additions and 17 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ on: [pull_request, push]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macOS-latest, windows-latest ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
Expand All @@ -14,6 +17,4 @@ jobs:
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- run: |
docker-compose build && docker-compose run --rm --service-ports setup;
./gradlew clean build --stacktrace -PisCI -Pnosign
- run: ./gradlew clean build --stacktrace -Pnosign -PisCI
50 changes: 50 additions & 0 deletions build-logic/src/main/kotlin/nativebuild.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import org.jetbrains.kotlin.konan.target.HostManager

plugins {
kotlin("multiplatform")
}

repositories {
//mavenLocal() // Don't include this, it causes all sorts of build horror
mavenCentral()
mavenLocal()
}

kotlin {
val isCI = project.hasProperty("isCI")
val platform =
if (project.hasProperty("platform"))
project.property("platform")
else
"any"

if (HostManager.hostIsLinux) {
linuxX64()
if (isCI) {
linuxArm64()
}
}

if (HostManager.hostIsMingw) {
mingwX64()
}

if (HostManager.hostIsMac) {
macosX64()
// Build the other targets only if we are on the CI
if (isCI) {
iosX64()
iosArm64()
watchosArm32()
watchosArm64()
watchosX64()
tvosArm64()
tvosX64()
macosArm64()
iosSimulatorArm64()
watchosSimulatorArm64()
tvosSimulatorArm64()
watchosDeviceArm64()
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Dterpal.trace.wrappers=true
kotlin.native.cacheKind.linuxX64=static
kotlin.native.cacheKind.linuxX64=none
android.useAndroidX=true
android.enableJetifier=false
Loading

0 comments on commit c6efedb

Please sign in to comment.