├── .github └── workflows │ └── publish.yml ├── .gitignore ├── README.md ├── build.gradle.kts ├── cover.jpeg ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── sample ├── composeApp │ ├── build.gradle.kts │ └── src │ │ ├── commonMain │ │ └── kotlin │ │ │ └── sample │ │ │ └── app │ │ │ └── App.kt │ │ ├── iosMain │ │ └── kotlin │ │ │ └── sample │ │ │ └── app │ │ │ └── main.kt │ │ ├── jsMain │ │ ├── kotlin │ │ │ └── sample │ │ │ │ └── app │ │ │ │ └── main.kt │ │ └── resources │ │ │ └── index.html │ │ └── jvmMain │ │ └── kotlin │ │ └── sample │ │ └── app │ │ └── main.kt └── iosApp │ ├── iosApp.xcodeproj │ └── project.pbxproj │ └── iosApp │ ├── Info.plist │ └── iosApp.swift ├── settings.gradle.kts └── shared ├── build.gradle.kts └── src ├── commonMain └── kotlin │ └── io │ └── github │ └── theapache64 │ └── slog │ ├── Core.kt │ └── Slog.kt ├── iosMain └── kotlin │ └── io │ └── github │ └── theapache64 │ └── slog │ └── Slog.actual.kt ├── jsMain └── kotlin │ └── io │ └── github │ └── theapache64 │ └── slog │ └── Slog.actual.kt └── jvmMain └── kotlin └── io └── github └── theapache64 └── slog └── Slog.actual.kt /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | versionName: 6 | description: 'Version Name' 7 | required: true 8 | 9 | jobs: 10 | publish: 11 | name: Publish 12 | runs-on: macos-latest 13 | 14 | steps: 15 | - name: Checkout repository 16 | uses: actions/checkout@v3 17 | 18 | - name: Set up JDK 17 19 | uses: actions/setup-java@v3 20 | with: 21 | java-version: '17' 22 | distribution: 'adopt' 23 | 24 | - name: Grant Permission to Execute Gradle 25 | run: chmod +x gradlew 26 | 27 | - name: Build with Gradle 28 | uses: gradle/gradle-build-action@v2 29 | with: 30 | arguments: build 31 | 32 | - name: Publish Library 33 | run: | 34 | echo "Publishing and Releasing library 🚀" 35 | ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache 36 | echo "Published and Released ✅" 37 | env: 38 | ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }} 39 | ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} 40 | ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} 41 | ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} 42 | ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} 43 | 44 | - name: Create and push tag 45 | run: | 46 | git config --global user.email "theapache64@gmail.com" 47 | git config --global user.name "$GITHUB_ACTOR" 48 | 49 | git tag -a $TAG -m "Release v$TAG" 50 | git push origin $TAG 51 | env: 52 | TAG: ${{ github.event.inputs.versionName }} 53 | 54 | - name: Create Release on GitHub 55 | id: create_release 56 | uses: actions/create-release@v1 57 | env: 58 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 59 | with: 60 | tag_name: ${{ github.event.inputs.versionName }} 61 | release_name: ${{ github.event.inputs.versionName }} 62 | draft: true 63 | prerelease: false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.iml 3 | .gradle 4 | .idea 5 | .kotlin 6 | .DS_Store 7 | build 8 | */build 9 | captures 10 | .externalNativeBuild 11 | .cxx 12 | local.properties 13 | xcuserdata/ 14 | Pods/ 15 | *.jks 16 | *.gpg 17 | *yarn.lock 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](cover.jpeg) 2 | 3 | # 🪵 slog 4 | 5 | > GoogleSheet based Logging Library for Android, iOS, JVM and JS 6 | 7 | ### ✨ Demo 8 | 9 | ```kotlin 10 | Slog.d { "Your log message goes here" } 11 | ``` 12 | 13 | 14 | ## ⌨️ Usage 15 | 16 | 1. Create a Google form with `message` field, link the form with Google Sheet and copy the public URL 17 | 18 | ![image](https://github.com/user-attachments/assets/93184b12-01d6-45a4-b71a-d234bd93cfc9) 19 | 20 | ![image](https://github.com/user-attachments/assets/4b4cfdf9-777f-4183-a191-f70ff683648f) 21 | 22 | 23 | 24 | 2. Install the dependency 25 | 26 | ![latestVersion](https://img.shields.io/github/v/release/theapache64/slog) 27 | 28 | ```kotlin 29 | repositories { 30 | mavenCentral() 31 | } 32 | 33 | dependencies { 34 | implementation("io.github.theapache64:slog:") 35 | } 36 | ``` 37 | 38 | 3. Init the library and pass the Google form link 39 | 40 | ```kotlin 41 | Slog.init(formUrl = "https://docs.google.com/forms/d/e/32423sdfsd6757/viewform?usp=dialog") 42 | ``` 43 | 44 | 4. Finally, start logging 🚀 45 | 46 | ```kotlin 47 | Slog.d { "Your Log Goes Here" } 48 | ``` 49 | 50 | and you'll see your logs in the destination sheet like this 51 | 52 | ![image](https://github.com/user-attachments/assets/5e6719e8-12ed-4696-b2a0-fe84346c8930) 53 | 54 | ## ✍️ Author 55 | 56 | 👤 **theapache64** 57 | 58 | * Twitter: @theapache64 59 | * Email: theapache64@gmail.com 60 | 61 | Feel free to ping me 😉 62 | 63 | ## 🤝 Contributing 64 | 65 | Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any 66 | contributions you make are **greatly appreciated**. 67 | 68 | 1. Open an issue first to discuss what you would like to change. 69 | 1. Fork the Project 70 | 1. Create your feature branch (`git checkout -b feature/amazing-feature`) 71 | 1. Commit your changes (`git commit -m 'Add some amazing feature'`) 72 | 1. Push to the branch (`git push origin feature/amazing-feature`) 73 | 1. Open a pull request 74 | 75 | Please make sure to update tests as appropriate. 76 | 77 | ## ❤ Show your support 78 | 79 | Give a ⭐️ if this project helped you! 80 | 81 | 82 | Buy Me A Coffee 83 | 84 | 85 | 86 | ## 📝 License 87 | 88 | ``` 89 | Copyright © 2025 - theapache64 90 | 91 | Licensed under the Apache License, Version 2.0 (the "License"); 92 | you may not use this file except in compliance with the License. 93 | You may obtain a copy of the License at 94 | 95 | http://www.apache.org/licenses/LICENSE-2.0 96 | 97 | Unless required by applicable law or agreed to in writing, software 98 | distributed under the License is distributed on an "AS IS" BASIS, 99 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 100 | See the License for the specific language governing permissions and 101 | limitations under the License. 102 | ``` 103 | 104 | _This README was generated by [readgen](https://github.com/theapache64/readgen)_ ❤ 105 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.multiplatform).apply(false) 3 | alias(libs.plugins.serialization) apply false 4 | alias(libs.plugins.ksp) apply false 5 | alias(libs.plugins.ktorfit) apply false 6 | } -------------------------------------------------------------------------------- /cover.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theapache64/slog/b30584595ddc2b92c627b3aceb8ef9ef572dfd51/cover.jpeg -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | #Gradle 2 | org.gradle.jvmargs=-Xmx5g -Dfile.encoding=UTF-8 3 | org.gradle.caching=true 4 | org.gradle.unsafe.configuration-cache-problems=warn 5 | 6 | #Kotlin 7 | kotlin.code.style=official 8 | kotlin.daemon.jvmargs=-Xmx4G 9 | 10 | #Android 11 | android.useAndroidX=true 12 | android.nonTransitiveRClass=true 13 | 14 | #Compose 15 | org.jetbrains.compose.experimental.jscanvas.enabled=true 16 | 17 | 18 | #Sonatype 19 | SONATYPE_HOST=S01 20 | RELEASE_SIGNING_ENABLED=true 21 | SONATYPE_AUTOMATIC_RELEASE=true 22 | 23 | GROUP=io.github.theapache64 24 | POM_ARTIFACT_ID=slog 25 | VERSION_NAME=1.0.0-alpha01 26 | 27 | POM_NAME=slow 28 | POM_DESCRIPTION=GoogleSheet based Logging Library for Android, iOS, JVM and JS 29 | POM_INCEPTION_YEAR=2025 30 | POM_URL=https://github.com/theapache64/slog/ 31 | 32 | POM_LICENSE_NAME=The Apache Software License, Version 2.0 33 | POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt 34 | POM_LICENSE_DIST=repo 35 | 36 | POM_SCM_URL=https://github.com/theapache64/slog/ 37 | POM_SCM_CONNECTION=scm:git:git://github.com/theapache64/slog.git 38 | POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/theapache64/slog.git 39 | 40 | POM_DEVELOPER_ID=theapache64 41 | POM_DEVELOPER_NAME=theapache64 42 | POM_DEVELOPER_URL=https://github.com/theapache64/ -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | 3 | kotlin = "2.1.20" 4 | agp = "8.6.1" 5 | compose = "1.7.3" 6 | androidx-activityCompose = "1.9.3" 7 | retrosheet = "3.0.0-alpha02" 8 | ktorfit = "2.5.0" 9 | ksp = "2.1.20-1.0.32" 10 | ktor = "3.1.0" 11 | coroutines = "1.10.1" 12 | publish = "0.31.0" 13 | 14 | [libraries] 15 | 16 | retrosheet = { module = "io.github.theapache64:retrosheet", version.ref = "retrosheet" } 17 | ktorfit = { module = "de.jensklingenberg.ktorfit:ktorfit-lib", version.ref = "ktorfit" } 18 | ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } 19 | coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } 20 | 21 | [plugins] 22 | 23 | multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } 24 | compose = { id = "org.jetbrains.compose", version.ref = "compose" } 25 | compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } 26 | ktorfit = { id = "de.jensklingenberg.ktorfit", version.ref = "ktorfit" } 27 | ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } 28 | serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } 29 | publish = {id = "com.vanniktech.maven.publish", version.ref= "publish"} 30 | 31 | 32 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theapache64/slog/b30584595ddc2b92c627b3aceb8ef9ef572dfd51/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /sample/composeApp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.compose.desktop.application.dsl.TargetFormat 2 | 3 | plugins { 4 | alias(libs.plugins.multiplatform) 5 | alias(libs.plugins.compose.compiler) 6 | alias(libs.plugins.compose) 7 | } 8 | 9 | kotlin { 10 | jvmToolchain(17) 11 | 12 | jvm() 13 | js { 14 | browser() 15 | binaries.executable() 16 | } 17 | listOf( 18 | iosX64(), 19 | iosArm64(), 20 | iosSimulatorArm64() 21 | ).forEach { 22 | it.binaries.framework { 23 | baseName = "ComposeApp" 24 | isStatic = true 25 | } 26 | } 27 | 28 | sourceSets { 29 | commonMain.dependencies { 30 | implementation(compose.runtime) 31 | implementation(compose.foundation) 32 | implementation(compose.ui) 33 | implementation(compose.material3) 34 | implementation(project(":shared")) 35 | } 36 | 37 | jvmMain.dependencies { 38 | implementation(compose.desktop.currentOs) 39 | } 40 | 41 | } 42 | } 43 | 44 | compose.desktop { 45 | application { 46 | mainClass = "MainKt" 47 | 48 | nativeDistributions { 49 | targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) 50 | packageName = "sample" 51 | packageVersion = "1.0.0" 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /sample/composeApp/src/commonMain/kotlin/sample/app/App.kt: -------------------------------------------------------------------------------- 1 | package sample.app 2 | 3 | import androidx.compose.foundation.background 4 | import androidx.compose.foundation.layout.Box 5 | import androidx.compose.foundation.layout.fillMaxSize 6 | import androidx.compose.material3.Button 7 | import androidx.compose.material3.Text 8 | import androidx.compose.runtime.Composable 9 | import androidx.compose.ui.Alignment 10 | import androidx.compose.ui.Modifier 11 | import androidx.compose.ui.graphics.Color 12 | import io.github.theapache64.slog.Slog 13 | 14 | @Composable 15 | fun App() { 16 | Box( 17 | modifier = Modifier.fillMaxSize().background(Color.White), 18 | contentAlignment = Alignment.Center 19 | ) { 20 | Button( 21 | onClick = { 22 | Slog.d { "Hello Slog!" } 23 | } 24 | ) { 25 | Text("Slog Me! 🚀") 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /sample/composeApp/src/iosMain/kotlin/sample/app/main.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.ui.window.ComposeUIViewController 2 | import platform.UIKit.UIViewController 3 | import sample.app.App 4 | 5 | fun MainViewController(): UIViewController = ComposeUIViewController { App() } -------------------------------------------------------------------------------- /sample/composeApp/src/jsMain/kotlin/sample/app/main.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.ui.ExperimentalComposeUiApi 2 | import androidx.compose.ui.window.ComposeViewport 3 | import kotlinx.browser.document 4 | import sample.app.App 5 | 6 | @OptIn(ExperimentalComposeUiApi::class) 7 | fun main() { 8 | val body = document.body ?: return 9 | ComposeViewport(body) { 10 | App() 11 | } 12 | } -------------------------------------------------------------------------------- /sample/composeApp/src/jsMain/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | sample 7 | 8 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /sample/composeApp/src/jvmMain/kotlin/sample/app/main.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.ui.unit.dp 2 | import androidx.compose.ui.window.Window 3 | import androidx.compose.ui.window.application 4 | import androidx.compose.ui.window.rememberWindowState 5 | import io.github.theapache64.slog.Slog 6 | import sample.app.App 7 | 8 | fun main() = application { 9 | 10 | Slog.init("https://docs.google.com/forms/d/e/1FAIpQLSdzQmv-q-IjY9w_VCkkuyo716junf7ukNeQu3KQ1YGKfHPSfA/viewform?usp=dialog") 11 | 12 | Window( 13 | title = "sample", 14 | state = rememberWindowState(width = 800.dp, height = 600.dp), 15 | onCloseRequest = ::exitApplication, 16 | ) { 17 | App() 18 | } 19 | } -------------------------------------------------------------------------------- /sample/iosApp/iosApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A93A953B29CC810C00F8E227 /* iosApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93A953A29CC810C00F8E227 /* iosApp.swift */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXFileReference section */ 14 | A93A953729CC810C00F8E227 /* Multiplatform App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Multiplatform App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 15 | A93A953A29CC810C00F8E227 /* iosApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosApp.swift; sourceTree = ""; }; 16 | /* End PBXFileReference section */ 17 | 18 | /* Begin PBXFrameworksBuildPhase section */ 19 | A93A953429CC810C00F8E227 /* Frameworks */ = { 20 | isa = PBXFrameworksBuildPhase; 21 | buildActionMask = 2147483647; 22 | files = ( 23 | ); 24 | runOnlyForDeploymentPostprocessing = 0; 25 | }; 26 | /* End PBXFrameworksBuildPhase section */ 27 | 28 | /* Begin PBXGroup section */ 29 | A93A952E29CC810C00F8E227 = { 30 | isa = PBXGroup; 31 | children = ( 32 | A93A953929CC810C00F8E227 /* iosApp */, 33 | A93A953829CC810C00F8E227 /* Products */, 34 | C4127409AE3703430489E7BC /* Frameworks */, 35 | ); 36 | sourceTree = ""; 37 | }; 38 | A93A953829CC810C00F8E227 /* Products */ = { 39 | isa = PBXGroup; 40 | children = ( 41 | A93A953729CC810C00F8E227 /* Multiplatform App.app */, 42 | ); 43 | name = Products; 44 | sourceTree = ""; 45 | }; 46 | A93A953929CC810C00F8E227 /* iosApp */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | A93A953A29CC810C00F8E227 /* iosApp.swift */, 50 | ); 51 | path = iosApp; 52 | sourceTree = ""; 53 | }; 54 | C4127409AE3703430489E7BC /* Frameworks */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | ); 58 | name = Frameworks; 59 | sourceTree = ""; 60 | }; 61 | /* End PBXGroup section */ 62 | 63 | /* Begin PBXNativeTarget section */ 64 | A93A953629CC810C00F8E227 /* iosApp */ = { 65 | isa = PBXNativeTarget; 66 | buildConfigurationList = A93A954529CC810D00F8E227 /* Build configuration list for PBXNativeTarget "iosApp" */; 67 | buildPhases = ( 68 | A9D80A052AAB5CDE006C8738 /* ShellScript */, 69 | A93A953329CC810C00F8E227 /* Sources */, 70 | A93A953429CC810C00F8E227 /* Frameworks */, 71 | ); 72 | buildRules = ( 73 | ); 74 | dependencies = ( 75 | ); 76 | name = iosApp; 77 | productName = iosApp; 78 | productReference = A93A953729CC810C00F8E227 /* Multiplatform App.app */; 79 | productType = "com.apple.product-type.application"; 80 | }; 81 | /* End PBXNativeTarget section */ 82 | 83 | /* Begin PBXProject section */ 84 | A93A952F29CC810C00F8E227 /* Project object */ = { 85 | isa = PBXProject; 86 | attributes = { 87 | LastSwiftUpdateCheck = 1420; 88 | LastUpgradeCheck = 1420; 89 | TargetAttributes = { 90 | A93A953629CC810C00F8E227 = { 91 | CreatedOnToolsVersion = 14.2; 92 | }; 93 | }; 94 | }; 95 | buildConfigurationList = A93A953229CC810C00F8E227 /* Build configuration list for PBXProject "iosApp" */; 96 | compatibilityVersion = "Xcode 14.0"; 97 | developmentRegion = en; 98 | hasScannedForEncodings = 0; 99 | knownRegions = ( 100 | en, 101 | Base, 102 | ); 103 | mainGroup = A93A952E29CC810C00F8E227; 104 | productRefGroup = A93A953829CC810C00F8E227 /* Products */; 105 | projectDirPath = ""; 106 | projectRoot = ""; 107 | targets = ( 108 | A93A953629CC810C00F8E227 /* iosApp */, 109 | ); 110 | }; 111 | /* End PBXProject section */ 112 | 113 | /* Begin PBXShellScriptBuildPhase section */ 114 | A9D80A052AAB5CDE006C8738 /* ShellScript */ = { 115 | isa = PBXShellScriptBuildPhase; 116 | buildActionMask = 2147483647; 117 | files = ( 118 | ); 119 | inputFileListPaths = ( 120 | ); 121 | inputPaths = ( 122 | ); 123 | outputFileListPaths = ( 124 | ); 125 | outputPaths = ( 126 | ); 127 | runOnlyForDeploymentPostprocessing = 0; 128 | shellPath = /bin/sh; 129 | shellScript = "cd \"$SRCROOT/..\"\n./../gradlew :sample:composeApp:embedAndSignAppleFrameworkForXcode\n"; 130 | }; 131 | /* End PBXShellScriptBuildPhase section */ 132 | 133 | /* Begin PBXSourcesBuildPhase section */ 134 | A93A953329CC810C00F8E227 /* Sources */ = { 135 | isa = PBXSourcesBuildPhase; 136 | buildActionMask = 2147483647; 137 | files = ( 138 | A93A953B29CC810C00F8E227 /* iosApp.swift in Sources */, 139 | ); 140 | runOnlyForDeploymentPostprocessing = 0; 141 | }; 142 | /* End PBXSourcesBuildPhase section */ 143 | 144 | /* Begin XCBuildConfiguration section */ 145 | A93A954329CC810D00F8E227 /* Debug */ = { 146 | isa = XCBuildConfiguration; 147 | buildSettings = { 148 | ALWAYS_SEARCH_USER_PATHS = NO; 149 | CLANG_ANALYZER_NONNULL = YES; 150 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 151 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 152 | CLANG_ENABLE_MODULES = YES; 153 | CLANG_ENABLE_OBJC_ARC = YES; 154 | CLANG_ENABLE_OBJC_WEAK = YES; 155 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 156 | CLANG_WARN_BOOL_CONVERSION = YES; 157 | CLANG_WARN_COMMA = YES; 158 | CLANG_WARN_CONSTANT_CONVERSION = YES; 159 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 160 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 161 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 162 | CLANG_WARN_EMPTY_BODY = YES; 163 | CLANG_WARN_ENUM_CONVERSION = YES; 164 | CLANG_WARN_INFINITE_RECURSION = YES; 165 | CLANG_WARN_INT_CONVERSION = YES; 166 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 167 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 168 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 169 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 170 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 171 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 172 | CLANG_WARN_STRICT_PROTOTYPES = YES; 173 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 174 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 175 | CLANG_WARN_UNREACHABLE_CODE = YES; 176 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 177 | COPY_PHASE_STRIP = NO; 178 | DEBUG_INFORMATION_FORMAT = dwarf; 179 | ENABLE_STRICT_OBJC_MSGSEND = YES; 180 | ENABLE_TESTABILITY = YES; 181 | GCC_C_LANGUAGE_STANDARD = gnu11; 182 | GCC_DYNAMIC_NO_PIC = NO; 183 | GCC_NO_COMMON_BLOCKS = YES; 184 | GCC_OPTIMIZATION_LEVEL = 0; 185 | GCC_PREPROCESSOR_DEFINITIONS = ( 186 | "DEBUG=1", 187 | "$(inherited)", 188 | ); 189 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 190 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 191 | GCC_WARN_UNDECLARED_SELECTOR = YES; 192 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 193 | GCC_WARN_UNUSED_FUNCTION = YES; 194 | GCC_WARN_UNUSED_VARIABLE = YES; 195 | IPHONEOS_DEPLOYMENT_TARGET = 16.2; 196 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 197 | MTL_FAST_MATH = YES; 198 | ONLY_ACTIVE_ARCH = YES; 199 | SDKROOT = iphoneos; 200 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 201 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 202 | }; 203 | name = Debug; 204 | }; 205 | A93A954429CC810D00F8E227 /* Release */ = { 206 | isa = XCBuildConfiguration; 207 | buildSettings = { 208 | ALWAYS_SEARCH_USER_PATHS = NO; 209 | CLANG_ANALYZER_NONNULL = YES; 210 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 211 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 212 | CLANG_ENABLE_MODULES = YES; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_ENABLE_OBJC_WEAK = YES; 215 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 216 | CLANG_WARN_BOOL_CONVERSION = YES; 217 | CLANG_WARN_COMMA = YES; 218 | CLANG_WARN_CONSTANT_CONVERSION = YES; 219 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 220 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 221 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 222 | CLANG_WARN_EMPTY_BODY = YES; 223 | CLANG_WARN_ENUM_CONVERSION = YES; 224 | CLANG_WARN_INFINITE_RECURSION = YES; 225 | CLANG_WARN_INT_CONVERSION = YES; 226 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 227 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 228 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 229 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 230 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 231 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 232 | CLANG_WARN_STRICT_PROTOTYPES = YES; 233 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 234 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 235 | CLANG_WARN_UNREACHABLE_CODE = YES; 236 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 237 | COPY_PHASE_STRIP = NO; 238 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 239 | ENABLE_NS_ASSERTIONS = NO; 240 | ENABLE_STRICT_OBJC_MSGSEND = YES; 241 | GCC_C_LANGUAGE_STANDARD = gnu11; 242 | GCC_NO_COMMON_BLOCKS = YES; 243 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 244 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 245 | GCC_WARN_UNDECLARED_SELECTOR = YES; 246 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 247 | GCC_WARN_UNUSED_FUNCTION = YES; 248 | GCC_WARN_UNUSED_VARIABLE = YES; 249 | IPHONEOS_DEPLOYMENT_TARGET = 16.2; 250 | MTL_ENABLE_DEBUG_INFO = NO; 251 | MTL_FAST_MATH = YES; 252 | SDKROOT = iphoneos; 253 | SWIFT_COMPILATION_MODE = wholemodule; 254 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 255 | VALIDATE_PRODUCT = YES; 256 | }; 257 | name = Release; 258 | }; 259 | A93A954629CC810D00F8E227 /* Debug */ = { 260 | isa = XCBuildConfiguration; 261 | buildSettings = { 262 | CODE_SIGN_STYLE = Automatic; 263 | CURRENT_PROJECT_VERSION = 1; 264 | ENABLE_PREVIEWS = YES; 265 | GENERATE_INFOPLIST_FILE = YES; 266 | INFOPLIST_FILE = iosApp/Info.plist; 267 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 268 | LD_RUNPATH_SEARCH_PATHS = ( 269 | "$(inherited)", 270 | "@executable_path/Frameworks", 271 | ); 272 | MARKETING_VERSION = 1.0; 273 | PRODUCT_BUNDLE_IDENTIFIER = sample.app.iosApp; 274 | PRODUCT_NAME = "Multiplatform App"; 275 | SWIFT_EMIT_LOC_STRINGS = YES; 276 | SWIFT_VERSION = 5.0; 277 | TARGETED_DEVICE_FAMILY = "1,2"; 278 | }; 279 | name = Debug; 280 | }; 281 | A93A954729CC810D00F8E227 /* Release */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | CODE_SIGN_STYLE = Automatic; 285 | CURRENT_PROJECT_VERSION = 1; 286 | ENABLE_PREVIEWS = YES; 287 | GENERATE_INFOPLIST_FILE = YES; 288 | INFOPLIST_FILE = iosApp/Info.plist; 289 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 290 | LD_RUNPATH_SEARCH_PATHS = ( 291 | "$(inherited)", 292 | "@executable_path/Frameworks", 293 | ); 294 | MARKETING_VERSION = 1.0; 295 | PRODUCT_BUNDLE_IDENTIFIER = sample.app.iosApp; 296 | PRODUCT_NAME = "Multiplatform App"; 297 | SWIFT_EMIT_LOC_STRINGS = YES; 298 | SWIFT_VERSION = 5.0; 299 | TARGETED_DEVICE_FAMILY = "1,2"; 300 | }; 301 | name = Release; 302 | }; 303 | /* End XCBuildConfiguration section */ 304 | 305 | /* Begin XCConfigurationList section */ 306 | A93A953229CC810C00F8E227 /* Build configuration list for PBXProject "iosApp" */ = { 307 | isa = XCConfigurationList; 308 | buildConfigurations = ( 309 | A93A954329CC810D00F8E227 /* Debug */, 310 | A93A954429CC810D00F8E227 /* Release */, 311 | ); 312 | defaultConfigurationIsVisible = 0; 313 | defaultConfigurationName = Release; 314 | }; 315 | A93A954529CC810D00F8E227 /* Build configuration list for PBXNativeTarget "iosApp" */ = { 316 | isa = XCConfigurationList; 317 | buildConfigurations = ( 318 | A93A954629CC810D00F8E227 /* Debug */, 319 | A93A954729CC810D00F8E227 /* Release */, 320 | ); 321 | defaultConfigurationIsVisible = 0; 322 | defaultConfigurationName = Release; 323 | }; 324 | /* End XCConfigurationList section */ 325 | }; 326 | rootObject = A93A952F29CC810C00F8E227 /* Project object */; 327 | } -------------------------------------------------------------------------------- /sample/iosApp/iosApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CADisableMinimumFrameDurationOnPhone 6 | 7 | 8 | -------------------------------------------------------------------------------- /sample/iosApp/iosApp/iosApp.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import ComposeApp 3 | 4 | @main 5 | class AppDelegate: UIResponder, UIApplicationDelegate { 6 | var window: UIWindow? 7 | 8 | func application( 9 | _ application: UIApplication, 10 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 11 | ) -> Bool { 12 | window = UIWindow(frame: UIScreen.main.bounds) 13 | if let window = window { 14 | window.rootViewController = MainKt.MainViewController() 15 | window.makeKeyAndVisible() 16 | } 17 | return true 18 | } 19 | } -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "slog" 2 | include(":shared") 3 | include(":sample:composeApp") 4 | 5 | pluginManagement { 6 | repositories { 7 | google { 8 | content { 9 | includeGroupByRegex("com\\.android.*") 10 | includeGroupByRegex("com\\.google.*") 11 | includeGroupByRegex("androidx.*") 12 | includeGroupByRegex("android.*") 13 | } 14 | } 15 | gradlePluginPortal() 16 | mavenCentral() 17 | } 18 | } 19 | 20 | plugins { 21 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" 22 | } 23 | 24 | dependencyResolutionManagement { 25 | repositories { 26 | google { 27 | content { 28 | includeGroupByRegex("com\\.android.*") 29 | includeGroupByRegex("com\\.google.*") 30 | includeGroupByRegex("androidx.*") 31 | includeGroupByRegex("android.*") 32 | } 33 | } 34 | mavenCentral() 35 | } 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /shared/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.multiplatform) 3 | alias(libs.plugins.ksp) 4 | alias(libs.plugins.ktorfit) 5 | alias(libs.plugins.serialization) 6 | alias(libs.plugins.publish) 7 | } 8 | 9 | kotlin { 10 | jvmToolchain(17) 11 | jvm() 12 | js { 13 | browser() 14 | binaries.executable() 15 | } 16 | listOf( 17 | iosX64(), 18 | iosArm64(), 19 | iosSimulatorArm64() 20 | ).forEach { 21 | it.binaries.framework { 22 | baseName = "slog" 23 | isStatic = true 24 | } 25 | } 26 | 27 | sourceSets { 28 | commonMain.dependencies { 29 | implementation(libs.ktorfit) 30 | implementation(libs.retrosheet) 31 | implementation(libs.ktor.core) 32 | implementation(libs.coroutines.core) 33 | } 34 | 35 | commonTest.dependencies { 36 | implementation(kotlin("test")) 37 | } 38 | 39 | } 40 | } 41 | 42 | tasks.named("sourcesJar") { 43 | dependsOn("kspCommonMainKotlinMetadata") 44 | } -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/io/github/theapache64/slog/Core.kt: -------------------------------------------------------------------------------- 1 | package io.github.theapache64.slog 2 | 3 | import de.jensklingenberg.ktorfit.http.Body 4 | import de.jensklingenberg.ktorfit.http.POST 5 | import io.github.theapache64.retrosheet.annotations.Write 6 | import kotlinx.serialization.SerialName 7 | import kotlinx.serialization.Serializable 8 | 9 | @Serializable 10 | internal data class Log( 11 | @SerialName("message") 12 | val msg : String 13 | ) 14 | 15 | internal interface SlogApi { 16 | @Write 17 | @POST(SLOG_ENDPOINT) 18 | suspend fun addLog(@Body log: Log): Log 19 | } -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/io/github/theapache64/slog/Slog.kt: -------------------------------------------------------------------------------- 1 | package io.github.theapache64.slog 2 | 3 | import de.jensklingenberg.ktorfit.Ktorfit 4 | import io.github.theapache64.retrosheet.core.RetrosheetConfig 5 | import io.github.theapache64.retrosheet.core.RetrosheetConverter 6 | import io.github.theapache64.retrosheet.core.createRetrosheetPlugin 7 | import io.ktor.client.* 8 | import kotlinx.coroutines.CoroutineDispatcher 9 | import kotlinx.coroutines.CoroutineScope 10 | import kotlinx.coroutines.launch 11 | 12 | internal const val SLOG_ENDPOINT = "add_log" 13 | 14 | expect val IODispatcher: CoroutineDispatcher 15 | 16 | object Slog { 17 | private lateinit var slogApi: SlogApi 18 | private val scope = CoroutineScope(IODispatcher) 19 | 20 | fun init(formUrl: String) { 21 | val config = RetrosheetConfig.Builder() 22 | .setLogging(true) 23 | // For writing to sheet 24 | .addForm( 25 | SLOG_ENDPOINT, 26 | formUrl // form link 27 | ) 28 | .build() 29 | 30 | val ktorClient = HttpClient { 31 | install(createRetrosheetPlugin(config)) {} 32 | } 33 | 34 | slogApi = Ktorfit.Builder() 35 | .httpClient(ktorClient) 36 | .converterFactories(RetrosheetConverter(config)) 37 | .build() 38 | .createSlogApi() 39 | } 40 | 41 | 42 | fun d(msg: () -> String) { 43 | scope.launch { 44 | slogApi.addLog(Log(msg())) 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /shared/src/iosMain/kotlin/io/github/theapache64/slog/Slog.actual.kt: -------------------------------------------------------------------------------- 1 | package io.github.theapache64.slog 2 | 3 | import kotlinx.coroutines.Dispatchers 4 | 5 | actual val IODispatcher = Dispatchers.Default -------------------------------------------------------------------------------- /shared/src/jsMain/kotlin/io/github/theapache64/slog/Slog.actual.kt: -------------------------------------------------------------------------------- 1 | package io.github.theapache64.slog 2 | 3 | import kotlinx.coroutines.Dispatchers 4 | 5 | actual val IODispatcher = Dispatchers.Default -------------------------------------------------------------------------------- /shared/src/jvmMain/kotlin/io/github/theapache64/slog/Slog.actual.kt: -------------------------------------------------------------------------------- 1 | package io.github.theapache64.slog 2 | 3 | import kotlinx.coroutines.Dispatchers 4 | 5 | actual val IODispatcher = Dispatchers.IO --------------------------------------------------------------------------------