Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kotlin to 1.9.22 and other dependencies #61

Merged
merged 2 commits into from
Jan 30, 2024
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
25 changes: 10 additions & 15 deletions bugsnag/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Touchlab
* Copyright (c) 2024 Touchlab
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
Expand All @@ -10,6 +10,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -25,7 +26,10 @@ group = GROUP
version = VERSION_NAME

kotlin {
targetHierarchy.default()
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
androidTarget {
publishAllLibraryVariants()
}
Expand All @@ -47,39 +51,30 @@ kotlin {
tvosX64()

sourceSets {
val commonMain by getting {
commonMain {
dependencies {
implementation(project(":core"))
}
}
val commonTest by getting {
commonTest {
dependencies {
implementation(kotlin("test"))
}
}
val darwinMain by creating {
dependsOn(commonMain)
appleMain {
dependencies {
implementation(libs.nsexceptionKt.core)
}
}
val darwinTest by creating {
dependsOn(commonTest)
}

val androidMain by getting {
androidMain {
dependencies {
compileOnly(libs.bugsnag.android)
}
}

targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>().all {
val mainCompilation = compilations.getByName("main")
val mainSourceSet = mainCompilation.defaultSourceSet
val testSourceSet = compilations.getByName("test").defaultSourceSet

mainSourceSet.dependsOn(darwinMain)
testSourceSet.dependsOn(darwinTest)

mainCompilation.cinterops.create("bugsnag") {
includeDirs("$projectDir/src/include")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package co.touchlab.crashkios.bugsnag

import com.rickclephas.kmp.nsexceptionkt.core.asNSException
import com.rickclephas.kmp.nsexceptionkt.core.causes
import kotlinx.cinterop.ExperimentalForeignApi

@OptIn(ExperimentalForeignApi::class)
actual class BugsnagCallsActual : BugsnagCalls {

override fun logMessage(message: String) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@file:OptIn(ExperimentalForeignApi::class)

package co.touchlab.crashkios.bugsnag

import com.rickclephas.kmp.nsexceptionkt.core.asNSException
import com.rickclephas.kmp.nsexceptionkt.core.causes
import com.rickclephas.kmp.nsexceptionkt.core.wrapUnhandledExceptionHook
import kotlinx.cinterop.ExperimentalForeignApi
import platform.Foundation.NSException

public fun startBugsnag(config: BugsnagConfiguration){
Expand Down
24 changes: 7 additions & 17 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Touchlab
* Copyright (c) 2024 Touchlab
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
Expand All @@ -10,6 +10,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -24,6 +25,10 @@ group = GROUP
version = VERSION_NAME

kotlin {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
androidTarget {
publishAllLibraryVariants()
}
Expand All @@ -45,26 +50,11 @@ kotlin {
tvosX64()

sourceSets {
val commonMain by getting
val commonTest by getting {
commonTest {
dependencies {
implementation(kotlin("test"))
}
}
val darwinMain by creating {
dependsOn(commonMain)
}
val darwinTest by creating {
dependsOn(commonTest)
}

targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>().all {
val mainSourceSet = compilations.getByName("main").defaultSourceSet
val testSourceSet = compilations.getByName("test").defaultSourceSet

mainSourceSet.dependsOn(darwinMain)
testSourceSet.dependsOn(darwinTest)
}
}
}

Expand Down
26 changes: 10 additions & 16 deletions crashlytics/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Touchlab
* Copyright (c) 2024 Touchlab
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
Expand All @@ -10,6 +10,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -25,7 +26,10 @@ group = GROUP
version = VERSION_NAME

kotlin {
targetHierarchy.default()
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
androidTarget {
publishAllLibraryVariants()
}
Expand All @@ -47,40 +51,30 @@ kotlin {
tvosX64()

sourceSets {
val commonMain by getting {
commonMain {
dependencies {
implementation(project(":core"))
}
}
val commonTest by getting {
commonTest {
dependencies {
implementation(kotlin("test"))
}
}
val darwinMain by creating {
dependsOn(commonMain)
appleMain {
dependencies {
implementation(libs.nsexceptionKt.core)
}
}
val darwinTest by creating {
dependsOn(commonTest)
}

val androidMain by getting {
androidMain {
dependencies {
compileOnly(libs.firebase.crashlytics)
}
}

targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>().all {
val mainCompilation = compilations.getByName("main")
val mainSourceSet = mainCompilation.defaultSourceSet
val testSourceSet = compilations.getByName("test").defaultSourceSet

mainSourceSet.dependsOn(darwinMain)
testSourceSet.dependsOn(darwinTest)

mainCompilation.cinterops.create("crashlytics") {
includeDirs("$projectDir/src/include")
compilerOpts("-DNS_FORMAT_ARGUMENT(A)=", "-D_Nullable_result=_Nullable")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package co.touchlab.crashkios.crashlytics

import com.rickclephas.kmp.nsexceptionkt.core.asNSException
import com.rickclephas.kmp.nsexceptionkt.core.getFilteredStackTraceAddresses
import kotlinx.cinterop.UnsafeNumber
import kotlinx.cinterop.convert

@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
Expand All @@ -10,6 +11,7 @@ actual class CrashlyticsCallsActual : CrashlyticsCalls {
FIRCrashlytics.crashlytics().log(message)
}

@OptIn(UnsafeNumber::class)
override fun sendHandledException(throwable: Throwable) {
val exceptionClassName = throwable::class.qualifiedName
val exModel = FIRExceptionModel.exceptionModelWithName(exceptionClassName, throwable.message)!!
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kotlin.code.style=official
SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true
GROUP=co.touchlab.crashkios
VERSION_NAME=0.8.5
VERSION_NAME=0.9.0

POM_URL=https://github.com/touchlab/CrashKios
POM_DESCRIPTION=Kotlin Native iOS Crash Report Library
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ targetSdk = "34"
compileSdk = "34"

# Dependencies
kotlin = "1.9.10"
android-gradle-plugin = "8.1.0"
mavenPublish = "0.25.3"
kotlin = "1.9.22"
android-gradle-plugin = "8.2.1"
mavenPublish = "0.26.0"
touchlab-docusaurus-template = "0.1.10"
gradlePublish = "1.2.1"
nsexceptionKt = "0.1.10"
firebase-crashlytics = "18.4.1"
bugsnag = "5.31.1"
crashkios = "0.8.3"
crashkios = "0.9.0"

# Sample Apps
androidx-core = "1.12.0"
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,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
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 @@ -85,9 +85,6 @@ done
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"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -133,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down Expand Up @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# 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"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
4 changes: 1 addition & 3 deletions samples/sample-bugsnag/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ android.useAndroidX=true

org.gradle.jvmargs=-Xmx4g

kotlin.native.cacheKind.iosX64=none
kotlin.native.cacheKind.iosSimulatorArm64=none

kotlin.native.cacheKind=none

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hello folks, is this the new recommended way of disabling K/N caches for CrashKiOS? Should the website be updated as well?

Thank you!

17 changes: 4 additions & 13 deletions samples/sample-bugsnag/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,24 @@ tasks.withType<KotlinCompile> {
version = "0.0.1"

kotlin {
targetHierarchy.default()
androidTarget()
ios()
iosX64()
iosArm64()
// Note: iosSimulatorArm64 target requires that all dependencies have M1 support
iosSimulatorArm64()

sourceSets {
val commonMain by getting {
commonMain {
dependencies {
api("co.touchlab.crashkios:bugsnag")
}
}

val commonTest by getting {
commonTest {
dependencies {
implementation(kotlin("test"))
}
}

val iosMain by getting
val iosTest by getting
val iosSimulatorArm64Main by getting {
dependsOn(iosMain)
}
val iosSimulatorArm64Test by getting {
dependsOn(iosTest)
}
}

cocoapods {
Expand Down
11 changes: 11 additions & 0 deletions samples/sample-bugsnag/shared/shared.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ Pod::Spec.new do |spec|



if !Dir.exist?('build/cocoapods/framework/shared.framework') || Dir.empty?('build/cocoapods/framework/shared.framework')
raise "

Kotlin framework 'shared' doesn't exist yet, so a proper Xcode project can't be generated.
'pod install' should be executed after running ':generateDummyFramework' Gradle task:

./gradlew :shared:generateDummyFramework

Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
end

spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':shared',
'PRODUCT_MODULE_NAME' => 'shared',
Expand Down
3 changes: 1 addition & 2 deletions samples/sample-crashlytics/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ android.useAndroidX=true

org.gradle.jvmargs=-Xmx4g

kotlin.native.cacheKind.iosX64=none
kotlin.native.cacheKind.iosSimulatorArm64=none
kotlin.native.cacheKind=none
Loading
Loading