diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e5ef465..6367f18a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-java@v2 with: distribution: "adopt" - java-version: "11" + java-version: "17" - name: Install msys2 if: matrix.os == 'windows-latest' uses: msys2/setup-msys2@v2 @@ -73,4 +73,4 @@ jobs: shell: bash env: - GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m" + GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2bb776a4..7656f878 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,7 +27,7 @@ jobs: - uses: actions/setup-java@v2 with: distribution: "adopt" - java-version: "11" + java-version: "17" - name: Validate Gradle Wrapper uses: gradle/wrapper-validation-action@v1 - name: Cache gradle @@ -63,4 +63,4 @@ jobs: tag: ${{ steps.version-match.outputs.group1 }} env: - GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m" + GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m" diff --git a/build.gradle.kts b/build.gradle.kts index 271a4e1c..d51c4d05 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,18 +13,17 @@ buildscript { extra["kotlin_plugin_id"] = "co.touchlab.kermit" - dependencies { - classpath("com.vanniktech:gradle-maven-publish-plugin:0.23.1") - } } plugins { - kotlin("multiplatform") apply false - id("com.android.library") version "7.4.2" apply false - id("com.github.gmazzo.buildconfig") version "2.1.0" apply false - id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" - id("org.jetbrains.dokka") version "1.8.20" apply false - id("co.touchlab.touchlabtools.docusaurusosstemplate") version "0.1.10" + alias(libs.plugins.maven.publish) apply false + alias(libs.plugins.buildConfig) apply false + alias(libs.plugins.kotlin.multiplatform) apply false + alias(libs.plugins.binaryCompatability) + alias(libs.plugins.dokka) apply false + alias(libs.plugins.touchlab.docusaurus.template) + alias(libs.plugins.android.library) apply false + } apiValidation { nonPublicMarkers.add("co.touchlab.kermit.ExperimentalKermitApi") diff --git a/extensions/kermit-bugsnag/api/kermit-bugsnag.api b/extensions/kermit-bugsnag/api/kermit-bugsnag.api index 1f1dbf8f..e69de29b 100644 --- a/extensions/kermit-bugsnag/api/kermit-bugsnag.api +++ b/extensions/kermit-bugsnag/api/kermit-bugsnag.api @@ -1,7 +0,0 @@ -public final class co/touchlab/kermit/bugsnag/BuildConfig { - public static final field BUILD_TYPE Ljava/lang/String; - public static final field DEBUG Z - public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; - public fun ()V -} - diff --git a/extensions/kermit-bugsnag/build.gradle.kts b/extensions/kermit-bugsnag/build.gradle.kts index faa13f99..5660cdb7 100644 --- a/extensions/kermit-bugsnag/build.gradle.kts +++ b/extensions/kermit-bugsnag/build.gradle.kts @@ -14,36 +14,33 @@ plugins { id("com.android.library") kotlin("multiplatform") + id("com.vanniktech.maven.publish") } apply(from = "../../gradle/configure-crash-logger.gradle") kotlin { + targetHierarchy.default() androidTarget { publishAllLibraryVariants() } - val commonMain by sourceSets.getting { - dependencies { - api(libs.crashkios.bugsnag) - } - } - - val androidMain by sourceSets.getting { - dependencies { + sourceSets { + commonMain { + dependencies { + api(libs.crashkios.bugsnag) + } } } } android { namespace = "co.touchlab.kermit.bugsnag" - compileSdk = 30 + compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { - minSdk = 16 + minSdk = libs.versions.minSdk.get().toInt() } - - val main by sourceSets.getting { - manifest.srcFile("src/androidMain/AndroidManifest.xml") + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } -} - -apply(plugin = "com.vanniktech.maven.publish") +} \ No newline at end of file diff --git a/extensions/kermit-bugsnag/src/androidMain/AndroidManifest.xml b/extensions/kermit-bugsnag/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 17657636..00000000 --- a/extensions/kermit-bugsnag/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/extensions/kermit-crashlytics/api/kermit-crashlytics.api b/extensions/kermit-crashlytics/api/kermit-crashlytics.api index 46de89b7..e69de29b 100644 --- a/extensions/kermit-crashlytics/api/kermit-crashlytics.api +++ b/extensions/kermit-crashlytics/api/kermit-crashlytics.api @@ -1,7 +0,0 @@ -public final class co/touchlab/kermit/crashlytics/BuildConfig { - public static final field BUILD_TYPE Ljava/lang/String; - public static final field DEBUG Z - public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; - public fun ()V -} - diff --git a/extensions/kermit-crashlytics/build.gradle.kts b/extensions/kermit-crashlytics/build.gradle.kts index 17eb79d5..936ee1b4 100644 --- a/extensions/kermit-crashlytics/build.gradle.kts +++ b/extensions/kermit-crashlytics/build.gradle.kts @@ -14,37 +14,34 @@ plugins { id("com.android.library") kotlin("multiplatform") + id("com.vanniktech.maven.publish") } apply(from = "../../gradle/configure-crash-logger.gradle") kotlin { + targetHierarchy.default() androidTarget { publishAllLibraryVariants() } - val commonMain by sourceSets.getting { - dependencies { - api(libs.crashkios.crashlytics) - } - } - - val androidMain by sourceSets.getting { - dependencies { + sourceSets { + commonMain { + dependencies { + api(libs.crashkios.crashlytics) + } } } } android { namespace = "co.touchlab.kermit.crashlytics" - compileSdk = 30 + compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { - minSdk = 16 + minSdk = libs.versions.minSdk.get().toInt() } - - val main by sourceSets.getting { - manifest.srcFile("src/androidMain/AndroidManifest.xml") + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } -} - -apply(plugin = "com.vanniktech.maven.publish") +} \ No newline at end of file diff --git a/extensions/kermit-crashlytics/src/androidMain/AndroidManifest.xml b/extensions/kermit-crashlytics/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 9ff6437e..00000000 --- a/extensions/kermit-crashlytics/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - \ No newline at end of file diff --git a/extensions/kermit-koin/api/android/kermit-koin.api b/extensions/kermit-koin/api/android/kermit-koin.api index c7ec3ab2..751e2f31 100644 --- a/extensions/kermit-koin/api/android/kermit-koin.api +++ b/extensions/kermit-koin/api/android/kermit-koin.api @@ -1,10 +1,3 @@ -public final class co/touchlab/kermit/koin/BuildConfig { - public static final field BUILD_TYPE Ljava/lang/String; - public static final field DEBUG Z - public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; - public fun ()V -} - public final class co/touchlab/kermit/koin/GetLoggerWithTagKt { public static final fun kermitLoggerModule (Lco/touchlab/kermit/Logger;)Lorg/koin/core/module/Module; } diff --git a/extensions/kermit-koin/build.gradle.kts b/extensions/kermit-koin/build.gradle.kts index 67592d03..63b7db96 100644 --- a/extensions/kermit-koin/build.gradle.kts +++ b/extensions/kermit-koin/build.gradle.kts @@ -14,9 +14,11 @@ plugins { id("com.android.library") kotlin("multiplatform") + id("com.vanniktech.maven.publish") } kotlin { + targetHierarchy.default() androidTarget { publishAllLibraryVariants() } @@ -31,7 +33,6 @@ kotlin { iosX64() iosArm64() iosSimulatorArm64() - watchosArm32() watchosArm64() watchosSimulatorArm64() watchosX64() @@ -40,17 +41,17 @@ kotlin { tvosX64() linuxX64() - mingwX64() - // TODO: These targets aren't supported by Koin yet: + // TODO: These targets aren't supported by Koin yet or stopped the support: + // watchosArm32() // androidNativeArm32() // androidNativeArm64() // androidNativeX86() // androidNativeX64() sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation(project(":kermit")) implementation(libs.koin) @@ -61,14 +62,12 @@ kotlin { android { namespace = "co.touchlab.kermit.koin" - compileSdk = 30 + compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { - minSdk = 16 + minSdk = libs.versions.minSdk.get().toInt() } - - val main by sourceSets.getting { - manifest.srcFile("src/androidMain/AndroidManifest.xml") + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } -} - -apply(plugin = "com.vanniktech.maven.publish") +} \ No newline at end of file diff --git a/extensions/kermit-koin/src/androidMain/AndroidManifest.xml b/extensions/kermit-koin/src/androidMain/AndroidManifest.xml deleted file mode 100644 index b8959776..00000000 --- a/extensions/kermit-koin/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/gradle.properties b/gradle.properties index 47a232c7..579930b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,11 @@ kotlin.code.style=official android.useAndroidX=true -org.gradle.jvmargs=-Xmx2g +org.gradle.jvmargs=-Xmx4g SONATYPE_HOST=DEFAULT RELEASE_SIGNING_ENABLED=true GROUP=co.touchlab VERSION_NAME=2.0.0-RC5 -KOTLIN_VERSION=1.9.0 POM_NAME=Kermit POM_DESCRIPTION=Kermit The Log diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 82423874..dd70c327 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,41 +1,43 @@ [versions] ## SDK Versions minSdk = "21" -targetSdk = "33" -compileSdk = "33" +compileSdk = "34" # Dependencies -kotlin = "1.9.0" +kotlin = "1.9.10" binaryCompatability = "0.13.2" -androidx-core = "1.8.0" -androidx-appcompat = "1.5.1" +androidx-core = "1.12.0" +androidx-appcompat = "1.6.1" androidx-constraintLayout = "2.1.4" -androidx-navigationFragment = "2.5.2" -androidx-navigationUI = "2.5.2" +androidx-navigationFragment = "2.7.2" +androidx-navigationUI = "2.7.2" androidx-coordinatorLayout = "1.2.0" -android-material = "1.6.1" -android-gradle-plugin = "7.2.2" -android-library = "7.2.2" -google-services = "4.3.10" +android-gradle-plugin = "8.1.1" +android-test-runner="1.5.2" -stately = "2.0.0-rc3" -testhelp = "0.6.5" +google-services = "4.3.15" -crashkios = "0.8.2" -bugsnag = "5.26.0" +stately = "2.0.3" +testhelp = "0.6.9" -firebase-bom = "28.4.0" +crashkios = "0.8.3" +bugsnag = "5.31.1" +bugsnag-gradle-plugin = "8.0.1" -koin = "3.4.2" -coroutines = "1.6.4" -roboelectric = "4.8.2" -buildConfig = "2.1.0" -mavenPublish = "0.22.0" +koin-core = "3.5.0" +koin-android = "3.5.0" +koin-test = "3.5.0" +coroutines = "1.7.3" +roboelectric = "4.10.3" +buildConfig = "4.1.2" +mavenPublish = "0.25.3" -android-junitTest = "1.1.3" +android-junitTest = "1.1.5" junit = "4.13.2" +dokka = "1.9.0" +touchlab-docusaurus-template = "0.1.10" [libraries] androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } @@ -45,10 +47,9 @@ androidx-navigationFragment = { module = "androidx.navigation:navigation-fragmen androidx-navigationUI = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "androidx-navigationUI" } androidx-coordinatorLayout = { module = "androidx.coordinatorlayout:coordinatorlayout", version.ref = "androidx-coordinatorLayout" } -android-material = { module = "com.google.android.material:material", version.ref = "android-material" } - android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" } +androidx-runner = { module = "androidx.test:runner", version.ref = "android-test-runner" } google-services = { module = "com.google.gms:google-services", version.ref = "google-services" } crashkios-crashlytics = { module = "co.touchlab.crashkios:crashlytics", version.ref = "crashkios" } @@ -57,27 +58,26 @@ bugsnag-android = { module = "com.bugsnag:bugsnag-android", version.ref = "bugsn stately-collections = { module = "co.touchlab:stately-collections", version.ref = "stately"} testhelp = { module = "co.touchlab:testhelp", version.ref = "testhelp" } -firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" } -firebase-analytics = { module = "com.google.firebase:firebase-analytics-ktx" } -firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-ktx" } - -koin = { module = "io.insert-koin:koin-core", version.ref = "koin" } -koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } +koin = { module = "io.insert-koin:koin-core", version.ref = "koin-core" } +koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin-android" } coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } roboelectric = { module = "org.robolectric:robolectric", version.ref = "roboelectric" } -koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } +koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin-test" } coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } android-junitTest = { module = "androidx.test.ext:junit", version.ref = "android-junitTest" } junitTest = { module = "junit:junit", version.ref = "junit" } -maven-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "mavenPublish" } [plugins] +maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } -android-library = { id = "com.android.library", version.ref = "android-library" } +android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" } buildConfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildConfig" } binaryCompatability = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompatability" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +touchlab-docusaurus-template = { id = "co.touchlab.touchlabtools.docusaurusosstemplate", version.ref = "touchlab-docusaurus-template" } +bugsnag-gradle-plugin = { id = "com.bugsnag.android.gradle", version.ref = "bugsnag-gradle-plugin" } [bundles] android = [ diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c0..ccebba77 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070cb702..a3638774 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c..79a61d42 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# 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/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# 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"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + 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. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - 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 fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# 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 +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index ac1b06f9..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/kermit-core/api/android/kermit-core.api b/kermit-core/api/android/kermit-core.api index 92911bd8..47b15e44 100644 --- a/kermit-core/api/android/kermit-core.api +++ b/kermit-core/api/android/kermit-core.api @@ -150,10 +150,3 @@ public final class co/touchlab/kermit/Tag { public final synthetic fun unbox-impl ()Ljava/lang/String; } -public final class co/touchlab/kermit/core/BuildConfig { - public static final field BUILD_TYPE Ljava/lang/String; - public static final field DEBUG Z - public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; - public fun ()V -} - diff --git a/kermit-core/build.gradle.kts b/kermit-core/build.gradle.kts index f8db14aa..3b4ad8c6 100644 --- a/kermit-core/build.gradle.kts +++ b/kermit-core/build.gradle.kts @@ -14,9 +14,11 @@ plugins { id("com.android.library") kotlin("multiplatform") + id("com.vanniktech.maven.publish") } kotlin { + targetHierarchy.default() androidTarget { publishAllLibraryVariants() } @@ -47,125 +49,102 @@ kotlin { androidNativeArm64() androidNativeX86() androidNativeX64() - - val commonMain by sourceSets.getting - val commonTest by sourceSets.getting - - val commonJvmMain by sourceSets.creating { - dependsOn(commonMain) - } - val commonJvmTest by sourceSets.creating { - dependsOn(commonTest) - dependsOn(commonJvmMain) - } - - val jvmMain by sourceSets.getting { - dependsOn(commonJvmMain) - } - val jvmTest by sourceSets.getting { - dependsOn(jvmMain) - dependsOn(commonJvmTest) - } - - val androidMain by sourceSets.getting { - dependsOn(commonJvmMain) - } - val androidUnitTest by sourceSets.getting { - dependsOn(androidMain) - dependsOn(commonJvmTest) - } - - val jsMain by sourceSets.getting - val jsTest by sourceSets.getting - - val nativeMain by sourceSets.creating - nativeMain.dependsOn(commonMain) - - val darwinMain by sourceSets.creating { - dependsOn(nativeMain) - } - - val darwinTest by sourceSets.creating { - dependsOn(commonTest) - } - - val linuxMain by sourceSets.creating { - dependsOn(nativeMain) - } - - val mingwMain by sourceSets.creating { - dependsOn(nativeMain) - } - - val androidNativeMain by sourceSets.creating { - dependsOn(nativeMain) - } - - targets.withType().all { - val mainSourceSet = compilations.getByName("main").defaultSourceSet - val testSourceSet = compilations.getByName("test").defaultSourceSet - - mainSourceSet.dependsOn( - when { - konanTarget.family.isAppleFamily -> darwinMain - konanTarget.family == org.jetbrains.kotlin.konan.target.Family.LINUX -> linuxMain - konanTarget.family == org.jetbrains.kotlin.konan.target.Family.MINGW -> mingwMain - konanTarget.family == org.jetbrains.kotlin.konan.target.Family.ANDROID -> androidNativeMain - else -> nativeMain + + sourceSets { + val commonMain by getting + val commonTest by getting { + dependencies { + implementation(kotlin("test")) + implementation(libs.stately.collections) + implementation(libs.testhelp) + implementation(project(":kermit-test")) } - ) - - testSourceSet.dependsOn( - if (konanTarget.family.isAppleFamily) { - darwinTest - } else { - commonTest + } + + val commonJvmMain by creating { + dependsOn(commonMain) + } + val commonJvmTest by creating { + dependsOn(commonTest) + dependsOn(commonJvmMain) + dependencies { + implementation(kotlin("test-junit")) } - ) - } - - commonTest.dependencies { - implementation("org.jetbrains.kotlin:kotlin-test-common") - implementation("org.jetbrains.kotlin:kotlin-test-annotations-common") - implementation(libs.stately.collections) - implementation(libs.testhelp) - } - - androidUnitTest.dependencies { - implementation("org.jetbrains.kotlin:kotlin-test") - implementation("org.jetbrains.kotlin:kotlin-test-junit") - implementation("androidx.test:runner:1.4.0") - implementation("org.robolectric:robolectric:4.5.1") - } - - commonJvmTest.dependencies { - implementation("org.jetbrains.kotlin:kotlin-test") - implementation("org.jetbrains.kotlin:kotlin-test-junit") - } - - jvmTest.dependencies { - implementation("org.jetbrains.kotlin:kotlin-test") - implementation("org.jetbrains.kotlin:kotlin-test-junit") - } - - jsMain.dependencies { - } - - jsTest.dependencies { - implementation("org.jetbrains.kotlin:kotlin-test-js") + } + + val jvmMain by getting { + dependsOn(commonJvmMain) + } + val jvmTest by getting { + dependsOn(commonJvmTest) + dependsOn(jvmMain) + } + + val androidMain by getting { + dependsOn(commonJvmMain) + } + val androidUnitTest by getting { + dependsOn(androidMain) + // dependsOn(commonJvmTest) + dependencies { + implementation(libs.androidx.runner) + implementation(libs.roboelectric) + } + } + + val nativeMain by getting + val nativeTest by getting + + val darwinMain by creating { + dependsOn(nativeMain) + } + + val darwinTest by creating { + dependsOn(nativeTest) + } + + targets.withType().all { + val mainSourceSet = compilations.getByName("main").defaultSourceSet + val testSourceSet = compilations.getByName("test").defaultSourceSet + + mainSourceSet.dependsOn( + when { + konanTarget.family.isAppleFamily -> darwinMain + konanTarget.family == org.jetbrains.kotlin.konan.target.Family.LINUX -> { + val linuxMain by getting + linuxMain + } + konanTarget.family == org.jetbrains.kotlin.konan.target.Family.MINGW -> { + val mingwMain by getting + mingwMain + } + konanTarget.family == org.jetbrains.kotlin.konan.target.Family.ANDROID -> { + val androidNativeMain by getting + androidNativeMain + } + else -> nativeMain + } + ) + + testSourceSet.dependsOn( + if (konanTarget.family.isAppleFamily) { + darwinTest + } else { + commonTest + } + ) + } } } android { namespace = "co.touchlab.kermit.core" - compileSdk = 30 + compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { - minSdk = 16 + minSdk = libs.versions.minSdk.get().toInt() } - - val main by sourceSets.getting { - manifest.srcFile("src/androidMain/AndroidManifest.xml") + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } } - -apply(plugin = "com.vanniktech.maven.publish") diff --git a/kermit-core/src/androidMain/AndroidManifest.xml b/kermit-core/src/androidMain/AndroidManifest.xml deleted file mode 100644 index b8959776..00000000 --- a/kermit-core/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/kermit-core/src/androidTest/kotlin/co/touchlab/kermit/LogcatLoggerTest.kt b/kermit-core/src/androidUnitTest/kotlin/co/touchlab/kermit/LogcatLoggerTest.kt similarity index 100% rename from kermit-core/src/androidTest/kotlin/co/touchlab/kermit/LogcatLoggerTest.kt rename to kermit-core/src/androidUnitTest/kotlin/co/touchlab/kermit/LogcatLoggerTest.kt diff --git a/kermit-simple/build.gradle.kts b/kermit-simple/build.gradle.kts index 2083986d..372bcfef 100644 --- a/kermit-simple/build.gradle.kts +++ b/kermit-simple/build.gradle.kts @@ -13,9 +13,11 @@ plugins { kotlin("multiplatform") + id("com.vanniktech.maven.publish") } kotlin { + targetHierarchy.default() js { browser() nodejs() @@ -43,47 +45,39 @@ kotlin { androidNativeX86() androidNativeX64() - val commonMain by sourceSets.getting { - dependencies { - api(project(":kermit")) + sourceSets { + commonMain { + dependencies { + api(project(":kermit")) + } } - } - val commonTest by sourceSets.getting { - dependencies { - implementation("org.jetbrains.kotlin:kotlin-test-common") - implementation("org.jetbrains.kotlin:kotlin-test-annotations-common") - implementation(project(":kermit-test")) + commonTest { + dependencies { + implementation(kotlin("test")) + implementation(project(":kermit-test")) + } + } + val nonKotlinMain by creating { + dependsOn(getByName("commonMain")) } - } - - val nonKotlinMain by sourceSets.creating { - dependsOn(commonMain) - } - - val nonKotlinTest by sourceSets.creating { - dependsOn(commonTest) - } - val jsMain by sourceSets.getting { - dependsOn(nonKotlinMain) - dependencies { + val nonKotlinTest by creating { + dependsOn(getByName("commonTest")) } - } - val jsTest by sourceSets.getting { - dependsOn(nonKotlinTest) - dependencies { - implementation("org.jetbrains.kotlin:kotlin-test-js") + val jsMain by getting { + dependsOn(nonKotlinMain) } - } - targets.withType().all { - val mainSourceSet = compilations.getByName("main").defaultSourceSet - val testSourceSet = compilations.getByName("test").defaultSourceSet + val jsTest by getting { + dependsOn(nonKotlinTest) + } + targets.withType().all { + val mainSourceSet = compilations.getByName("main").defaultSourceSet + val testSourceSet = compilations.getByName("test").defaultSourceSet - mainSourceSet.dependsOn(nonKotlinMain) - testSourceSet.dependsOn(nonKotlinTest) + mainSourceSet.dependsOn(nonKotlinMain) + testSourceSet.dependsOn(nonKotlinTest) + } } } - -apply(plugin = "com.vanniktech.maven.publish") diff --git a/kermit-simple/src/androidMain/AndroidManifest.xml b/kermit-simple/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 02ebb406..00000000 --- a/kermit-simple/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/kermit-test/api/android/kermit-test.api b/kermit-test/api/android/kermit-test.api index 82b1b059..e69de29b 100644 --- a/kermit-test/api/android/kermit-test.api +++ b/kermit-test/api/android/kermit-test.api @@ -1,7 +0,0 @@ -public final class co/touchlab/kermit/test/BuildConfig { - public static final field BUILD_TYPE Ljava/lang/String; - public static final field DEBUG Z - public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; - public fun ()V -} - diff --git a/kermit-test/build.gradle.kts b/kermit-test/build.gradle.kts index a865c625..b089fa47 100644 --- a/kermit-test/build.gradle.kts +++ b/kermit-test/build.gradle.kts @@ -14,9 +14,11 @@ plugins { id("com.android.library") kotlin("multiplatform") + id("com.vanniktech.maven.publish") } kotlin { + targetHierarchy.default() androidTarget { publishAllLibraryVariants() } @@ -48,48 +50,25 @@ kotlin { androidNativeX86() androidNativeX64() - val commonMain by sourceSets.getting - val commonTest by sourceSets.getting - - val jsMain by sourceSets.getting - val jsTest by sourceSets.getting - - val jvmMain by sourceSets.getting { - dependsOn(commonMain) - } - - val androidMain by sourceSets.getting { - dependsOn(commonMain) - } - - commonMain.dependencies { - implementation(kotlin("test")) - api(project(":kermit-core")) - implementation(libs.stately.collections) - } - - jsMain.dependencies { - } - - jvmMain.dependencies { - implementation(kotlin("test-junit")) - } - - androidMain.dependencies { - implementation(kotlin("test-junit")) + sourceSets { + commonMain { + dependencies { + implementation(kotlin("test")) + api(project(":kermit-core")) + implementation(libs.stately.collections) + } + } } } android { namespace = "co.touchlab.kermit.test" - compileSdk = 30 + compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { - minSdk = 16 + minSdk = libs.versions.minSdk.get().toInt() } - - val main by sourceSets.getting { - manifest.srcFile("src/androidMain/AndroidManifest.xml") + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } -} - -apply(plugin = "com.vanniktech.maven.publish") +} \ No newline at end of file diff --git a/kermit-test/src/androidMain/AndroidManifest.xml b/kermit-test/src/androidMain/AndroidManifest.xml deleted file mode 100644 index b8959776..00000000 --- a/kermit-test/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/kermit/.idea/.gitignore b/kermit/.idea/.gitignore deleted file mode 100644 index 26d33521..00000000 --- a/kermit/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/kermit/.idea/.name b/kermit/.idea/.name deleted file mode 100644 index c5dbaefb..00000000 --- a/kermit/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -kermit \ No newline at end of file diff --git a/kermit/api/android/kermit.api b/kermit/api/android/kermit.api index e312d8e1..c7a73ecf 100644 --- a/kermit/api/android/kermit.api +++ b/kermit/api/android/kermit.api @@ -1,10 +1,3 @@ -public final class co/touchlab/kermit/BuildConfig { - public static final field BUILD_TYPE Ljava/lang/String; - public static final field DEBUG Z - public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; - public fun ()V -} - public class co/touchlab/kermit/Logger : co/touchlab/kermit/BaseLogger { public static final field Companion Lco/touchlab/kermit/Logger$Companion; public fun (Lco/touchlab/kermit/LoggerConfig;Ljava/lang/String;)V diff --git a/kermit/build.gradle.kts b/kermit/build.gradle.kts index 92022ce0..f4daa1f4 100644 --- a/kermit/build.gradle.kts +++ b/kermit/build.gradle.kts @@ -14,9 +14,11 @@ plugins { id("com.android.library") kotlin("multiplatform") + id("com.vanniktech.maven.publish") } kotlin { + targetHierarchy.default() androidTarget { publishAllLibraryVariants() } @@ -47,81 +49,74 @@ kotlin { androidNativeArm64() androidNativeX86() androidNativeX64() - - val commonMain by sourceSets.getting { - dependencies { - api(project(":kermit-core")) + + sourceSets { + val commonMain by getting { + dependencies { + api(project(":kermit-core")) + } } - } - val commonTest by sourceSets.getting { - dependencies { - implementation("org.jetbrains.kotlin:kotlin-test-common") - implementation("org.jetbrains.kotlin:kotlin-test-annotations-common") - implementation(libs.testhelp) - implementation(project(":kermit-test")) + val commonTest by getting { + dependencies { + implementation(kotlin("test")) + implementation(libs.testhelp) + implementation(project(":kermit-test")) + } } - } - val nonKotlinMain by sourceSets.creating { - dependsOn(commonMain) - } + val nonKotlinMain by creating { + dependsOn(commonMain) + } - val nonKotlinTest by sourceSets.creating { - dependsOn(commonTest) - } + val nonKotlinTest by creating { + dependsOn(commonTest) + } - val nativeMain by sourceSets.creating { - dependsOn(nonKotlinMain) - } + val nativeMain by getting { + dependsOn(nonKotlinMain) + } - val jsMain by sourceSets.getting { - dependsOn(nonKotlinMain) - dependencies { + val jsMain by getting { + dependsOn(nonKotlinMain) } - } - val jsTest by sourceSets.getting { - dependsOn(nonKotlinTest) - dependencies { - implementation("org.jetbrains.kotlin:kotlin-test-js") + val jsTest by getting { + dependsOn(nonKotlinTest) } - } - val commonJvmMain by sourceSets.creating { - dependsOn(commonMain) - dependencies { - implementation("org.jetbrains.kotlin:kotlin-test") - implementation("org.jetbrains.kotlin:kotlin-test-junit") + val commonJvmMain by creating { + dependsOn(commonMain) + dependencies { + implementation(kotlin("test-junit")) + } } - } - val jvmMain by sourceSets.getting { - dependsOn(commonJvmMain) - } + val jvmMain by getting { + dependsOn(commonJvmMain) + } - val androidMain by sourceSets.getting { - dependsOn(commonJvmMain) - } + val androidMain by getting { + dependsOn(commonJvmMain) + } - targets.withType().all { - val mainSourceSet = compilations.getByName("main").defaultSourceSet - val testSourceSet = compilations.getByName("test").defaultSourceSet + targets.withType().all { + val mainSourceSet = compilations.getByName("main").defaultSourceSet + val testSourceSet = compilations.getByName("test").defaultSourceSet - mainSourceSet.dependsOn(nativeMain) - testSourceSet.dependsOn(nonKotlinTest) + mainSourceSet.dependsOn(nativeMain) + testSourceSet.dependsOn(nonKotlinTest) + } } } android { namespace = "co.touchlab.kermit" - compileSdk = 30 + compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { - minSdk = 16 + minSdk = libs.versions.minSdk.get().toInt() } - - val main by sourceSets.getting { - manifest.srcFile("src/androidMain/AndroidManifest.xml") + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } -} - -apply(plugin = "com.vanniktech.maven.publish") +} \ No newline at end of file diff --git a/kermit/src/androidMain/AndroidManifest.xml b/kermit/src/androidMain/AndroidManifest.xml deleted file mode 100644 index b8959776..00000000 --- a/kermit/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/samples/sample-production/app/build.gradle.kts b/samples/sample-production/app/build.gradle.kts index ecfa1137..531f0f5b 100644 --- a/samples/sample-production/app/build.gradle.kts +++ b/samples/sample-production/app/build.gradle.kts @@ -14,18 +14,11 @@ plugins { id("com.bugsnag.android.gradle") } -repositories { - mavenLocal() - google() - mavenCentral() -} - android { - namespace = "co.touchlab.KermitSample" + namespace = "co.touchlab.kermitSample" compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { minSdk = libs.versions.minSdk.get().toInt() - targetSdk = libs.versions.targetSdk.get().toInt() versionCode = 1 versionName = "0.0.1" } @@ -39,18 +32,19 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } buildFeatures { viewBinding = true + buildConfig = true } } dependencies { implementation(project(":shared")) implementation(libs.bundles.android) - implementation("com.bugsnag:bugsnag-android:5.+") + implementation(libs.bugsnag.android) } diff --git a/samples/sample-production/app/src/androidTest/java/co/touchlab/KermitSample/ExampleInstrumentedTest.kt b/samples/sample-production/app/src/androidTest/java/co/touchlab/KermitSample/ExampleInstrumentedTest.kt deleted file mode 100644 index eb6bba16..00000000 --- a/samples/sample-production/app/src/androidTest/java/co/touchlab/KermitSample/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2020 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ - -package co.touchlab.KermitSample - -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("co.touchlab.KermitSample", appContext.packageName) - } -} \ No newline at end of file diff --git a/samples/sample-production/app/src/main/java/co/touchlab/KermitSample/FirstFragment.kt b/samples/sample-production/app/src/main/java/co/touchlab/kermitSample/FirstFragment.kt similarity index 93% rename from samples/sample-production/app/src/main/java/co/touchlab/KermitSample/FirstFragment.kt rename to samples/sample-production/app/src/main/java/co/touchlab/kermitSample/FirstFragment.kt index 47228420..9feda8b5 100644 --- a/samples/sample-production/app/src/main/java/co/touchlab/KermitSample/FirstFragment.kt +++ b/samples/sample-production/app/src/main/java/co/touchlab/kermitSample/FirstFragment.kt @@ -8,12 +8,12 @@ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package co.touchlab.KermitSample +package co.touchlab.kermitSample import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment -import co.touchlab.KermitSample.databinding.FragmentFirstBinding +import co.touchlab.kermitSample.databinding.FragmentFirstBinding import co.touchlab.kermit.Logger import co.touchlab.kermitsample.SampleCommon diff --git a/samples/sample-production/app/src/main/java/co/touchlab/KermitSample/MainActivity.kt b/samples/sample-production/app/src/main/java/co/touchlab/kermitSample/MainActivity.kt similarity index 94% rename from samples/sample-production/app/src/main/java/co/touchlab/KermitSample/MainActivity.kt rename to samples/sample-production/app/src/main/java/co/touchlab/kermitSample/MainActivity.kt index 68e1de57..ecb5a258 100644 --- a/samples/sample-production/app/src/main/java/co/touchlab/KermitSample/MainActivity.kt +++ b/samples/sample-production/app/src/main/java/co/touchlab/kermitSample/MainActivity.kt @@ -8,18 +8,16 @@ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package co.touchlab.KermitSample +package co.touchlab.kermitSample import android.os.Bundle import android.view.Menu import android.view.MenuItem import androidx.appcompat.app.AppCompatActivity -import co.touchlab.KermitSample.databinding.ActivityMainBinding +import co.touchlab.kermitSample.databinding.ActivityMainBinding class MainActivity : AppCompatActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val binding = ActivityMainBinding.inflate(layoutInflater) diff --git a/samples/sample-production/app/src/main/java/co/touchlab/KermitSample/SampleApplication.kt b/samples/sample-production/app/src/main/java/co/touchlab/kermitSample/SampleApplication.kt similarity index 96% rename from samples/sample-production/app/src/main/java/co/touchlab/KermitSample/SampleApplication.kt rename to samples/sample-production/app/src/main/java/co/touchlab/kermitSample/SampleApplication.kt index 72a67fb0..c0d87f69 100644 --- a/samples/sample-production/app/src/main/java/co/touchlab/KermitSample/SampleApplication.kt +++ b/samples/sample-production/app/src/main/java/co/touchlab/kermitSample/SampleApplication.kt @@ -8,7 +8,7 @@ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package co.touchlab.KermitSample +package co.touchlab.kermitSample import android.app.Application import co.touchlab.kermitsample.startApp diff --git a/samples/sample-production/app/src/main/res/menu/menu_main.xml b/samples/sample-production/app/src/main/res/menu/menu_main.xml index a36fa891..dca843d9 100644 --- a/samples/sample-production/app/src/main/res/menu/menu_main.xml +++ b/samples/sample-production/app/src/main/res/menu/menu_main.xml @@ -11,7 +11,7 @@ + tools:context="co.touchlab.kermitSample.MainActivity"> diff --git a/samples/sample-production/build.gradle.kts b/samples/sample-production/build.gradle.kts index 21f988ed..4d8d990b 100644 --- a/samples/sample-production/build.gradle.kts +++ b/samples/sample-production/build.gradle.kts @@ -8,26 +8,19 @@ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ buildscript { - repositories { - mavenLocal() - google() - mavenCentral() - maven(url = "https://oss.sonatype.org/content/repositories/snapshots") - } extra.apply { val parentKermit = java.util.Properties().apply { load(java.io.StringReader(File("${projectDir.path}/../../gradle.properties").readText())) }.get("VERSION_NAME") as String set("KERMIT_VERSION", parentKermit) } - dependencies { - classpath(libs.android.gradle.plugin) - classpath(kotlin("gradle-plugin", libs.versions.kotlin.get())) - classpath("com.bugsnag:bugsnag-android-gradle-plugin:7.4.1") - } +} +plugins { + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.multiplatform) apply false + alias(libs.plugins.bugsnag.gradle.plugin) apply false } allprojects { repositories { - mavenLocal() mavenCentral() maven(url = "https://oss.sonatype.org/content/repositories/snapshots") google() diff --git a/samples/sample-production/gradle/wrapper/gradle-wrapper.jar b/samples/sample-production/gradle/wrapper/gradle-wrapper.jar index 457aad0d..41d9927a 100644 Binary files a/samples/sample-production/gradle/wrapper/gradle-wrapper.jar and b/samples/sample-production/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/sample-production/gradle/wrapper/gradle-wrapper.properties b/samples/sample-production/gradle/wrapper/gradle-wrapper.properties index b43152f2..15de9024 100644 --- a/samples/sample-production/gradle/wrapper/gradle-wrapper.properties +++ b/samples/sample-production/gradle/wrapper/gradle-wrapper.properties @@ -1,15 +1,5 @@ -# -# Copyright (c) 2020 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -# - distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/sample-production/gradlew b/samples/sample-production/gradlew index af6708ff..1b6c7873 100755 --- a/samples/sample-production/gradlew +++ b/samples/sample-production/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# 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 +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# 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 +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # 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"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + 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. Please set the JAVA_HOME variable in your environment to match the @@ -89,84 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi +# 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 +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/sample-production/gradlew.bat b/samples/sample-production/gradlew.bat index 6d57edc7..ac1b06f9 100644 --- a/samples/sample-production/gradlew.bat +++ b/samples/sample-production/gradlew.bat @@ -1,84 +1,89 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/sample-production/settings.gradle.kts b/samples/sample-production/settings.gradle.kts index fbff8167..f40b13a5 100644 --- a/samples/sample-production/settings.gradle.kts +++ b/samples/sample-production/settings.gradle.kts @@ -17,3 +17,11 @@ dependencyResolutionManagement { } } } + +pluginManagement { + repositories { + google() + gradlePluginPortal() + mavenCentral() + } +} diff --git a/samples/sample-production/shared/build.gradle.kts b/samples/sample-production/shared/build.gradle.kts index 793bcff0..e505b9d3 100644 --- a/samples/sample-production/shared/build.gradle.kts +++ b/samples/sample-production/shared/build.gradle.kts @@ -19,18 +19,19 @@ android { compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { minSdk = libs.versions.minSdk.get().toInt() - targetSdk = libs.versions.targetSdk.get().toInt() } - - val main by sourceSets.getting { - manifest.srcFile("src/androidMain/AndroidManifest.xml") + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } } val KERMIT_VERSION: String by project +version = "0.0.1" + kotlin { - version = "0.0.1" + targetHierarchy.default() androidTarget() ios() iosSimulatorArm64() @@ -44,44 +45,18 @@ kotlin { } val commonTest by getting { - dependencies { - implementation(kotlin("test-common")) - implementation(kotlin("test-annotations-common")) - - implementation("co.touchlab:kermit-test:${KERMIT_VERSION}") - } - } - - val androidMain by sourceSets.getting { - dependencies { - } - } - val androidUnitTest by sourceSets.getting { dependencies { implementation(kotlin("test")) - implementation(kotlin("test-junit")) + implementation("co.touchlab:kermit-test:${KERMIT_VERSION}") } } - val iosMain by sourceSets.getting { + val iosMain by getting { dependencies { // Only if you want to talk to Kermit from Swift api("co.touchlab:kermit-simple:${KERMIT_VERSION}") } } - - val iosTest by sourceSets.getting { - dependencies { - - } - } - - val iosSimulatorArm64Main by getting { - dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - dependsOn(iosTest) - } } cocoapods { diff --git a/samples/sample-production/shared/src/androidMain/AndroidManifest.xml b/samples/sample-production/shared/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 13c29cb0..00000000 --- a/samples/sample-production/shared/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/samples/sample-production/shared/src/commonMain/kotlin/co/touchlab/kermitsample/Helpers.kt b/samples/sample-production/shared/src/commonMain/kotlin/co/touchlab/kermitsample/Helpers.kt index 443f49d4..56e0f10b 100644 --- a/samples/sample-production/shared/src/commonMain/kotlin/co/touchlab/kermitsample/Helpers.kt +++ b/samples/sample-production/shared/src/commonMain/kotlin/co/touchlab/kermitsample/Helpers.kt @@ -13,6 +13,7 @@ package co.touchlab.kermitsample import co.touchlab.kermit.* import co.touchlab.kermit.bugsnag.BugsnagLogWriter +@OptIn(ExperimentalKermitApi::class) internal fun configApp(production: Boolean) { val logSeverity = if (production) { Severity.Info diff --git a/samples/sample/KermitSampleIOS/Podfile.lock b/samples/sample/KermitSampleIOS/Podfile.lock index 10df1dea..eb34e809 100644 --- a/samples/sample/KermitSampleIOS/Podfile.lock +++ b/samples/sample/KermitSampleIOS/Podfile.lock @@ -13,4 +13,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: eb18a5a396ff91b77d2f3b607dba9c4cf5f57893 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/samples/sample/app-browser/build.gradle.kts b/samples/sample/app-browser/build.gradle.kts index 9a8dc2d0..39092da6 100644 --- a/samples/sample/app-browser/build.gradle.kts +++ b/samples/sample/app-browser/build.gradle.kts @@ -27,8 +27,7 @@ kotlin { val jsMain by getting { dependencies { implementation(project(":shared")) - implementation("org.jetbrains.kotlinx:kotlinx-html-js:0.7.3") - + implementation("org.jetbrains.kotlinx:kotlinx-html-js:0.9.1") implementation("co.touchlab:kermit-simple:${KERMIT_VERSION}") } } diff --git a/samples/sample/app/build.gradle.kts b/samples/sample/app/build.gradle.kts index 33c6510b..6c0b1a32 100644 --- a/samples/sample/app/build.gradle.kts +++ b/samples/sample/app/build.gradle.kts @@ -26,7 +26,6 @@ android { compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { minSdk = libs.versions.minSdk.get().toInt() - targetSdk = libs.versions.targetSdk.get().toInt() versionCode = 1 versionName = "0.0.1" } @@ -40,8 +39,8 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } buildFeatures { viewBinding = true diff --git a/samples/sample/app/src/androidTest/java/co/touchlab/KermitSample/ExampleInstrumentedTest.kt b/samples/sample/app/src/androidTest/java/co/touchlab/KermitSample/ExampleInstrumentedTest.kt deleted file mode 100644 index eb6bba16..00000000 --- a/samples/sample/app/src/androidTest/java/co/touchlab/KermitSample/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2020 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ - -package co.touchlab.KermitSample - -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("co.touchlab.KermitSample", appContext.packageName) - } -} \ No newline at end of file diff --git a/samples/sample/build.gradle.kts b/samples/sample/build.gradle.kts index 686ce75c..a95312d0 100644 --- a/samples/sample/build.gradle.kts +++ b/samples/sample/build.gradle.kts @@ -8,23 +8,17 @@ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ buildscript { - repositories { - google() - mavenCentral() - maven(url = "https://oss.sonatype.org/content/repositories/snapshots") - } extra.apply { val parentKermit = java.util.Properties().apply { load(java.io.StringReader(File("${projectDir.path}/../../gradle.properties").readText())) }.get("VERSION_NAME") as String set("KERMIT_VERSION", parentKermit) } - dependencies { - classpath(libs.android.gradle.plugin) - classpath(kotlin("gradle-plugin", libs.versions.kotlin.get())) - } +} +plugins { + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.multiplatform) apply false } allprojects { repositories { - mavenLocal() mavenCentral() maven(url = "https://oss.sonatype.org/content/repositories/snapshots") google() diff --git a/samples/sample/gradle.properties b/samples/sample/gradle.properties index 784df992..93b81b11 100644 --- a/samples/sample/gradle.properties +++ b/samples/sample/gradle.properties @@ -11,7 +11,7 @@ kotlin.code.style=official android.useAndroidX=true -org.gradle.jvmargs=-Xmx3g +org.gradle.jvmargs=-Xmx4g kotlin.js.compiler=ir diff --git a/samples/sample/gradle/wrapper/gradle-wrapper.jar b/samples/sample/gradle/wrapper/gradle-wrapper.jar index 457aad0d..41d9927a 100644 Binary files a/samples/sample/gradle/wrapper/gradle-wrapper.jar and b/samples/sample/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/sample/gradle/wrapper/gradle-wrapper.properties b/samples/sample/gradle/wrapper/gradle-wrapper.properties index b43152f2..15de9024 100644 --- a/samples/sample/gradle/wrapper/gradle-wrapper.properties +++ b/samples/sample/gradle/wrapper/gradle-wrapper.properties @@ -1,15 +1,5 @@ -# -# Copyright (c) 2020 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -# - distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/sample/gradlew b/samples/sample/gradlew index af6708ff..1b6c7873 100755 --- a/samples/sample/gradlew +++ b/samples/sample/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# 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 +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# 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 +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # 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"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + 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. Please set the JAVA_HOME variable in your environment to match the @@ -89,84 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi +# 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 +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/sample/gradlew.bat b/samples/sample/gradlew.bat index 6d57edc7..ac1b06f9 100644 --- a/samples/sample/gradlew.bat +++ b/samples/sample/gradlew.bat @@ -1,84 +1,89 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/sample/settings.gradle.kts b/samples/sample/settings.gradle.kts index 3169dffa..094d039f 100644 --- a/samples/sample/settings.gradle.kts +++ b/samples/sample/settings.gradle.kts @@ -17,3 +17,11 @@ dependencyResolutionManagement { } } } + +pluginManagement { + repositories { + google() + gradlePluginPortal() + mavenCentral() + } +} diff --git a/samples/sample/shared/build.gradle.kts b/samples/sample/shared/build.gradle.kts index 9d82e6d8..f1fde537 100644 --- a/samples/sample/shared/build.gradle.kts +++ b/samples/sample/shared/build.gradle.kts @@ -19,11 +19,10 @@ android { compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { minSdk = libs.versions.minSdk.get().toInt() - targetSdk = libs.versions.targetSdk.get().toInt() } - - val main by sourceSets.getting { - manifest.srcFile("src/androidMain/AndroidManifest.xml") + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } } @@ -32,6 +31,7 @@ val KERMIT_VERSION: String by project version = "0.0.1" kotlin { + targetHierarchy.default() androidTarget() ios() iosSimulatorArm64() @@ -53,43 +53,12 @@ kotlin { implementation("co.touchlab:kermit-test:${KERMIT_VERSION}") } } - - val androidMain by sourceSets.getting { - dependencies { - } - } - val androidUnitTest by sourceSets.getting { - dependencies { - implementation(kotlin("test-junit")) - } - } - val iosMain by sourceSets.getting { - dependsOn(commonMain) + val iosMain by getting { dependencies { // Only if you want to talk to Kermit from Swift api("co.touchlab:kermit-simple:${KERMIT_VERSION}") } } - val iosTest by sourceSets.getting { - dependencies { - } - } - - val iosSimulatorArm64Main by getting { - dependsOn(iosMain) - } - val iosSimulatorArm64Test by getting { - dependsOn(iosTest) - } - - val jsMain by sourceSets.getting { - dependencies { - } - } - val jsTest by sourceSets.getting { - dependencies { - } - } } cocoapods { summary = "Sample for Kermit" diff --git a/samples/sample/shared/shared.podspec b/samples/sample/shared/shared.podspec index 52e94401..cd3c4d7f 100644 --- a/samples/sample/shared/shared.podspec +++ b/samples/sample/shared/shared.podspec @@ -36,4 +36,4 @@ Pod::Spec.new do |spec| } ] -end +end \ No newline at end of file diff --git a/samples/sample/shared/src/androidMain/AndroidManifest.xml b/samples/sample/shared/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 13c29cb0..00000000 --- a/samples/sample/shared/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 6774e22a..0b1c8005 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -32,20 +32,9 @@ project(":kermit-koin").projectDir = File("extensions/kermit-koin") //project(":kermit-ir-plugin-native").projectDir = File("plugin/kermit-ir-plugin-native") pluginManagement { - resolutionStrategy { - eachPlugin { - when (requested.id.id) { - "com.android.library" -> useModule("com.android.tools.build:gradle:${requested.version}") - } - } - } repositories { google() gradlePluginPortal() mavenCentral() } - val KOTLIN_VERSION: String by settings - plugins { - kotlin("multiplatform") version KOTLIN_VERSION - } }