Skip to content

Commit

Permalink
Adding support for Apple Silicon simulator (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisob55 authored Feb 23, 2023
1 parent af9aea9 commit 3a9a885
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
- Added support for Apple Silicon simulator.

## [0.7.1] - 2022-12-05Z
- Updated KMP version and cleaned up gradle scripts.
Expand Down
19 changes: 13 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
import java.text.SimpleDateFormat
import java.util.Date
import uk.gov.hmrc.Dependencies
Expand Down Expand Up @@ -44,10 +45,13 @@ kotlin {
jvm()
val iosX64 = iosX64("ios")
val iosArm32 = iosArm32()
val iosArm64 = iosArm64() //Simulator
val iosArm64 = iosArm64()
val iosSimulatorArm64 = iosSimulatorArm64()

val xcFramework = XCFramework(Config.frameworkName)

targets{
configure(listOf(iosX64, iosArm32, iosArm64)) {
configure(listOf(iosX64, iosArm32, iosArm64, iosSimulatorArm64)) {
binaries.framework {
baseName = Config.frameworkName
embedBitcode("disable")
Expand Down Expand Up @@ -109,14 +113,17 @@ kotlin {

val iosArm32Main by sourceSets.getting
val iosArm64Main by sourceSets.getting
val iosSimulatorArm64Main by sourceSets.getting

configure(listOf(iosArm32Main, iosArm64Main)) {
configure(listOf(iosArm32Main, iosArm64Main, iosSimulatorArm64Main)) {
dependsOn(iosMain)
}

val iosArm32Test by sourceSets.getting
val iosArm64Test by sourceSets.getting
configure(listOf(iosArm32Test, iosArm64Test)) {
val iosSimulatorArm64Test by sourceSets.getting

configure(listOf(iosArm32Test, iosArm64Test, iosSimulatorArm64Test)) {
dependsOn(iosTest)
}
}
Expand All @@ -126,9 +133,9 @@ kotlin {
multiplatformSwiftPackage {
swiftToolsVersion("5.3")
targetPlatforms {
iOS { v("13") }
iOS { v("14") }
}
outputDirectory(File(projectDir, "build/xcframework"))
outputDirectory(File(projectDir, "build/XCFrameworks/release"))
}

// Configure GitHub Packages publishing
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/uk/gov/hmrc/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object Dependencies {
}

object Versions {
const val klockVersion = "2.0.7"
const val klockVersion = "2.4.13"
const val kermitVersion = "1.2.2"
const val junit5Version = "3.4.2"
const val jupiterEngineVersion = "5.7.1"
Expand Down
4 changes: 2 additions & 2 deletions build_xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [ -z "$GITHUB_TOKEN" ]; then
else
if echo $1 | grep -Eq $SEMVER_REGEX; then
# Run tests and build xcframework
if ./gradlew check && ./gradlew createXCFramework; then
if ./gradlew check && ./gradlew assembleHelpToSaveKalculatorXCFramework; then
DIRECTORY="swiftpm"
ZIP="HelpToSaveKalculator.xcframework.zip"
if [ -d "$DIRECTORY" ]; then
Expand All @@ -17,7 +17,7 @@ else
fi
mkdir $DIRECTORY
echo "INFO: Copying artifact"
cp -r build/xcframework/HelpToSaveKalculator.xcframework $DIRECTORY
cp -r build/XCFrameworks/release/HelpToSaveKalculator.xcframework $DIRECTORY
echo "INFO: Zipping"
cd $DIRECTORY
zip -r $ZIP .
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down

0 comments on commit 3a9a885

Please sign in to comment.