diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index cfc58077..00000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git -.idea -Dockerfile -*.md \ No newline at end of file diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index c823f684..00000000 --- a/.editorconfig +++ /dev/null @@ -1,17 +0,0 @@ -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_size = 4 -indent_style = space -insert_final_newline = false -max_line_length = 160 -tab_width = 4 -ij_continuation_indent_size = 8 -ij_formatter_off_tag = @formatter:off -ij_formatter_on_tag = @formatter:on -ij_formatter_tags_enabled = true -ij_smart_tabs = false -ij_visual_guides = none -ij_wrap_on_typing = true diff --git a/.env b/.env deleted file mode 100644 index d5a2e80c..00000000 --- a/.env +++ /dev/null @@ -1,34 +0,0 @@ -POSTGRES_PORT=5432 -POSTGRES_DB=postgres -POSTGRES_USER=postgres -POSTGRES_PASSWORD=postgres - -JDBC_DATABASE_URL=jdbc:postgresql://0.0.0.0:5432/postgres?password=postgres&user=postgres -JDBC_DRIVER=org.postgresql.Driver - -HOST=0.0.0.0 -PORT=8080 -FORCE_HTTPS=false - -JWT_REALM=kotlin-mpp-app -JWT_SECRET=kotlin-mpp-app -JWT_AUDIENCE=0.0.0.0:8080 -JWT_ISSUER=0.0.0.0:8080 - -EMAIL_HOST=smtp.gmail.com -EMAIL_PORT=587 -EMAIL_USERNAME=mail@gmail.com -EMAIL_PASSWORD=password - -REQUIRE_EMAIL_VERIFY=false -SCHEME_EMAIL_VERIFY=http -HOST_EMAIL_VERIFY=0.0.0.0 - -BUMP_FILE_VERSION_CODE=false - -# Connect from Android emulator to localhost of computer via 10.0.2.2 -ANDROID_CLIENT_API_HOST=10.0.2.2:8080 -IOS_CLIENT_API_HOST=localhost:8080 -DESKTOP_CLIENT_API_HOST=localhost:8080 -REST_CLIENT_API_SCHEME=http -WEBSOCKET_CLIENT_API_SCHEME=ws diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml deleted file mode 100644 index ef51237b..00000000 --- a/.github/workflows/push-docker-image.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Push Docker Image - -on: - push: - tags: - - "v*.*.*" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout to push branch - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - fetch-depth: 0 - - - name: Extract version from tag - id: extract_version - uses: damienaicheh/extract-version-from-tag-action@v1.1.0 - - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Build and push - uses: docker/build-push-action@v4 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ secrets.DOCKER_USERNAME }}/mini-games:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} - - - name: Install and configure Koyeb CLI - uses: koyeb-community/install-koyeb-cli@v2 - with: - api_token: "${{ secrets.KOYEB_TOKEN }}" - github_token: "${{ secrets.GITHUB_TOKEN }}" - - - name: Deploy - run: koyeb services update ${{ secrets.SERVICE_ID }} --docker ${{ secrets.DOCKER_USERNAME }}/mini-games:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 08643f44..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,265 +0,0 @@ -name: Release - -on: - push: - tags: - - "v*.*.*" - -jobs: - release: - name: Create release - runs-on: ubuntu-latest - outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} - steps: - - name: Extract version name - id: extract_name - run: echo "name=$(echo ${GITHUB_REF##*/})" >>$GITHUB_OUTPUT - shell: bash - - - name: Create release - id: create_release - uses: ncipollo/release-action@v1 - with: - name: Release ${{ steps.extract_name.outputs.name }} - - build-server: - name: Build server - runs-on: ubuntu-latest - needs: release - steps: - - name: Checkout to push branch - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - fetch-depth: 0 - - - name: Extract version from tag - uses: damienaicheh/extract-version-from-tag-action@v1.1.0 - - - name: Set up JDK 19 - uses: actions/setup-java@v1 - with: - java-version: 19 - - - name: Build distribution file - if: job.status == 'success' - run: | - chmod +x ./gradlew - ./gradlew server:shadowJar - shell: bash - env: - VERSION: ${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} - - - name: Upload jar artifact file to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./server/build/libs/server-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-all.jar - asset_name: MiniGames-Server-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.jar - asset_content_type: application/x-java-archive - - - name: Upload jar artifact file to workflow run results - uses: actions/upload-artifact@v2 - with: - name: MiniGamesServer-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.jar - path: server/build/libs/server-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-all.jar - - build-desktop: - name: Build desktop release - strategy: - matrix: - platform: [ ubuntu-20.04, windows-2019, macos-12 ] - runs-on: ${{ matrix.platform }} - needs: release - steps: - - name: Checkout to push branch - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - fetch-depth: 0 - - - name: Extract version from tag - uses: damienaicheh/extract-version-from-tag-action@v1.1.0 - - - name: Set up JDK 19 - uses: actions/setup-java@v1 - with: - java-version: 19 - - - name: Build distribution file - if: job.status == 'success' - run: | - export GRADLE_USER_HOME=$(pwd)/.gradle - export DESKTOP_CLIENT_API_HOST=${{ secrets.API_HOST }} - export REST_CLIENT_API_SCHEME=https - export WEBSOCKET_CLIENT_API_SCHEME=wss - chmod +x ./gradlew - ./gradlew desktop-app:packageDistributionForCurrentOS - shell: bash - env: - VERSION: ${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} - - - name: Upload deb artifact file to workflow run results - uses: actions/upload-artifact@v2 - if: runner.os == 'Linux' - with: - name: MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.deb - path: desktop-app/build/compose/binaries/main/deb/minigames_${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}_amd64.deb - - - name: Upload deb artifact file to release - uses: actions/upload-release-asset@v1 - if: runner.os == 'Linux' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./desktop-app/build/compose/binaries/main/deb/minigames_${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}_amd64.deb - asset_name: MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.deb - asset_content_type: application/x-deb - - - name: Upload msi installer file to workflow run results - uses: actions/upload-artifact@v2 - if: runner.os == 'Windows' - with: - name: MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.msi - path: desktop-app/build/compose/binaries/main/msi/MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.msi - - - name: Upload msi installer file to release - uses: actions/upload-release-asset@v1 - if: runner.os == 'Windows' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./desktop-app/build/compose/binaries/main/msi/MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.msi - asset_name: MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.msi - asset_content_type: application/x-ms-dos-executable - - - name: Upload dmg image file to workflow run results - uses: actions/upload-artifact@v2 - if: runner.os == 'macOS' - with: - name: MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.dmg - path: desktop-app/build/compose/binaries/main/dmg/MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.dmg - - - name: Upload dmg image file to release - uses: actions/upload-release-asset@v1 - if: runner.os == 'macOS' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./desktop-app/build/compose/binaries/main/dmg/MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.dmg - asset_name: MiniGames-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.dmg - asset_content_type: application/octet-stream - - build-android: - name: Build android release - runs-on: ubuntu-latest - needs: release - steps: - - name: Checkout to push branch - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - fetch-depth: 0 - - - name: Extract version from tag - uses: damienaicheh/extract-version-from-tag-action@v1.1.0 - - - name: Set up JDK 19 - uses: actions/setup-java@v1 - with: - java-version: 19 - - - name: Decode Keystore - id: decode_keystore - uses: timheuer/base64-to-file@v1.2 - with: - fileName: 'mini-games.jks' - encodedString: ${{ secrets.KEYSTORE }} - - - name: Build APK file - if: job.status == 'success' - run: | - export GRADLE_USER_HOME=$(pwd)/.gradle - export ANDROID_CLIENT_API_HOST=${{ secrets.API_HOST }} - export REST_CLIENT_API_SCHEME=https - export WEBSOCKET_CLIENT_API_SCHEME=wss - chmod +x ./gradlew - ./gradlew android-app:assembleDebug - ./gradlew android-app:assembleRelease android-app:bundleRelease -Pandroid.injected.signing.store.file=$SIGNING_STORE_FILE -Pandroid.injected.signing.store.password=$SIGNING_STORE_PASSWORD -Pandroid.injected.signing.key.alias=$SIGNING_KEY_ALIAS -Pandroid.injected.signing.key.password=$SIGNING_KEY_PASSWORD - env: - SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} - SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} - SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} - SIGNING_STORE_FILE: ${{ steps.decode_keystore.outputs.filePath }} - VERSION: ${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} - BUMP_FILE_VERSION_CODE: true - - - name: Upload debug artifact file to workflow run results - uses: actions/upload-artifact@v2 - with: - name: MiniGames-Debug-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.apk - path: android-app/build/outputs/apk/debug/android-app-debug.apk - - - name: Upload release artifact file to workflow run results - uses: actions/upload-artifact@v2 - with: - name: MiniGames-Release-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.apk - path: android-app/build/outputs/apk/release/android-app-release.apk - - - name: Upload release bundle file to workflow run results - uses: actions/upload-artifact@v2 - with: - name: MiniGames-Release-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.aab - path: android-app/build/outputs/bundle/release/android-app-release.aab - - - name: Upload debug artifact file to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./android-app/build/outputs/apk/debug/android-app-debug.apk - asset_name: MiniGames-Debug-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.apk - asset_content_type: application/vnd.android.package-archive - - - name: Upload release artifact file to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./android-app/build/outputs/apk/release/android-app-release.apk - asset_name: MiniGames-Release-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.apk - asset_content_type: application/vnd.android.package-archive - - - name: Upload release bundle file to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./android-app/build/outputs/bundle/release/android-app-release.aab - asset_name: MiniGames-Release-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.aab - asset_content_type: application/x-authorware-bin - - - name: Upload release bundle file to Google Play - uses: r0adkll/upload-google-play@v1 - with: - serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} - packageName: ml.dev.kotlin.minigames - releaseFiles: ./android-app/build/outputs/bundle/release/android-app-release.aab - track: production - releaseName: ${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} - - - name: Commit version code changes - run: | - git config --global user.name "${{ secrets.CI_COMMIT_AUTHOR }}" - git config --global user.email "${{ secrets.CI_COMMIT_EMAIL }}" - git commit version.properties -m "update version properties" - git push origin HEAD:master diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 60cef66f..00000000 --- a/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -*.iml -.gradle/ -gradle/wrapper/dists/ -build/ -.idea/ -.idea/httpRequests -.DS_STORE -local.properties - -ios-app/Podfile.lock -ios-app/Pods/* -ios-app/iosApp.xcworkspace/* -ios-app/iosApp.xcodeproj/* -!ios-app/iosApp.xcodeproj/project.pbxproj - -shared/shared.podspec -shared-client/shared_client.podspec diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 3d4861c6..00000000 --- a/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -FROM openjdk:17-jdk-slim AS build -COPY . . -RUN chmod +x ./gradlew -RUN ./gradlew server:shadowJar - -FROM openjdk:17-jdk-slim - -ARG POSTGRES_PORT -ARG POSTGRES_DB -ARG POSTGRES_USER -ARG POSTGRES_PASSWORD -ARG JDBC_DATABASE_URL -ARG JDBC_DRIVER -ARG HOST -ARG PORT -ARG FORCE_HTTPS -ARG JWT_REALM -ARG JWT_SECRET -ARG JWT_AUDIENCE -ARG JWT_ISSUER -ARG EMAIL_HOST -ARG EMAIL_PORT -ARG EMAIL_USERNAME -ARG EMAIL_PASSWORD -ARG REQUIRE_EMAIL_VERIFY -ARG SCHEME_EMAIL_VERIFY -ARG HOST_EMAIL_VERIFY - -ENV POSTGRES_PORT=${POSTGRES_PORT} -ENV POSTGRES_DB=${POSTGRES_DB} -ENV POSTGRES_USER=${POSTGRES_USER} -ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -ENV JDBC_DATABASE_URL=${JDBC_DATABASE_URL} -ENV JDBC_DRIVER=${JDBC_DRIVER} -ENV HOST=${HOST} -ENV PORT=${PORT} -ENV FORCE_HTTPS=${FORCE_HTTPS} -ENV JWT_REALM=${JWT_REALM} -ENV JWT_SECRET=${JWT_SECRET} -ENV JWT_AUDIENCE=${JWT_AUDIENCE} -ENV JWT_ISSUER=${JWT_ISSUER} -ENV EMAIL_HOST=${EMAIL_HOST} -ENV EMAIL_PORT=${EMAIL_PORT} -ENV EMAIL_USERNAME=${EMAIL_USERNAME} -ENV EMAIL_PASSWORD=${EMAIL_PASSWORD} -ENV REQUIRE_EMAIL_VERIFY=${REQUIRE_EMAIL_VERIFY} -ENV SCHEME_EMAIL_VERIFY=${SCHEME_EMAIL_VERIFY} -ENV HOST_EMAIL_VERIFY=${HOST_EMAIL_VERIFY} -ENV PORT=${PORT} - -EXPOSE ${PORT} - -COPY --from=build ./server/build/libs/server-*-all.jar ./server.jar - -ENTRYPOINT ["java", "--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED", "-Dio.netty.tryReflectionSetAccessible=true", "-jar", "server.jar"] diff --git a/ESSAY.md b/ESSAY.md deleted file mode 100644 index a6a3106e..00000000 --- a/ESSAY.md +++ /dev/null @@ -1,39 +0,0 @@ -# Background - -My name is Maciej Procyk, and I'm a Computer Science Masters student at the University of Warsaw. - -I first learnt about Kotlin about 4 years ago and since then it has been my most loved -programming language. I've been programming a lot in Java, but I have a good background -in C and Python, while recently I got more familiar with Rust. - -I like programming web and android applications as well as work with programming languages. -I've written the [latte language compiler](https://github.com/avan1235/latte-compiler) -in Kotlin as well as [kotlin interpreter](https://gitlab.com/avan1235/kotlin-interpreter) -in Haskell - they're my most favourite projects that I'm really proud of. I did some -contributions to open-source project [KotlinDL](https://github.com/Kotlin/kotlindl). - -I've been working as Java developer for almost a year, and I've had two internships -as Kotlin developer during my studies. I've been also working as teaching assistant -at my faculty (Object-Oriented Programming classes and laboratories with students). - -I created Mini Games as a great sample how Kotlin code can be reused between multiple -platforms. I didn't find any Android online version of -[Set Game](https://en.wikipedia.org/wiki/Set_(card_game)), so I decided to build it myself, -and then it become building more generic approach to have different online games. - -Thanks to Compose UI it can be built for Android and Desktop with **single** -definition of view and view model as well as it has only single definition of http model and -client used to exchange data between clients and server. Thanks to this, there's no need to repeat -some model definitions for different platforms or for different parts of system. - -The most useful libraries used in build the project were: - -- [Jetpack Compose](https://github.com/JetBrains/compose-jb) - view layer (clients) -- [Decompose](https://github.com/arkivanov/Decompose/) - view-model layer (clients) -- [Essenty](https://github.com/arkivanov/Essenty/) - lifecycle and state managements (clients) -- [Kotlin Serialization](https://github.com/Kotlin/kotlinx.serialization) - shared model serialization (server & - clients) -- [Kotlin Coroutines](https://github.com/Kotlin/kotlinx.coroutines) - shared approach to concurrency (server & clients) -- [Ktor](https://github.com/ktorio/ktor) - web application framework (server) and http client (clients) -- [Exposed](https://github.com/JetBrains/Exposed) with [Krush](https://github.com/TouK/krush) - database layer for - server with auto table model generation diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 71d33941..00000000 --- a/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Mini-Games by Maciej Procyk - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index f5aa52ef..00000000 --- a/README.md +++ /dev/null @@ -1,209 +0,0 @@ -# Mini Games - -[![Release](https://github.com/avan1235/mini-games/actions/workflows/release.yml/badge.svg)](https://github.com/avan1235/mini-games/releases/latest) -[![Docker](https://github.com/avan1235/mini-games/actions/workflows/push-docker-image.yml/badge.svg)](https://hub.docker.com/repository/docker/avan1235/mini-games/tags?ordering=last_updated) - -## News - -[Compose Multiplatform](https://www.jetbrains.com/lp/compose-multiplatform/) just got released as an alpha version. -I highly encourage you to try to use this project as a starting point for your own multiplatform project. - -You can find here how to: - -- configure build files to build for Android, iOS, Linux, MacOS and Windows -- release your application with GitHub actions -- write and use multiplatform clients and share model code with the backend of your application - -I'm going to publish some blog posts at [my website](https://kotlin-dev.ml/) about the multipaltform project development so stay tuned and give a -star -to this repository to follow the latest changes! - -## Project description - -You can find project description in [Essay](ESSAY.md). - -## Project presentation - -### Android client - -![Android](https://user-images.githubusercontent.com/11787040/230712173-e8c3ff55-6d77-4fa4-a90e-4a7127732645.gif) - -### iOS client - -![iOS](https://user-images.githubusercontent.com/11787040/230871657-8b8ee025-bb77-446e-abd5-7d33023529f7.gif) - -### Local project compilation process - -https://user-images.githubusercontent.com/11787040/230044938-f243df3d-ecc7-47ce-b056-227405fc889b.mp4 - -## Download and run application - -Android released version is available on -[Google Play](https://play.google.com/store/apps/details?id=ml.dev.kotlin.minigames). - -Get it on Google Play - -You can download compiled version of application from -[release page](https://github.com/avan1235/mini-games/releases). - -Client applications are configured to work with the server deployed on test server. -You can download them to play with "production" version of application - to run it locally, -you should compile server and clients by yourself. - -Please note that for running unsigned version of macOS application, you need to temporarily -disable Gatekeeper, so executing command - -```shell -sudo xattr -dr com.apple.quarantine /Applications/MiniGames.app -``` - -is required to be able to run the app on macOS. You can learn more about this -[here](https://web.archive.org/web/20230318124537/https://disable-gatekeeper.github.io/). - -To install Linux version run: - -```shell -sudo dpkg -i minigames.deb -``` - -You can try playing with default login credentials which are publicly available: - -- user: **user** -- password: **pass** - -You need a fast internet connection to have a good play experience in _SnakeIO_ game. - -## Set up the project - -Project contains two parts - client app and the server app. - -[Intellij Ultimate](https://www.jetbrains.com/idea/download/) is highly -recommended when working with server app. - -In both cases, open main project directory when importing the project ( -not the `android-app`, `desktop-app` nor `server`) as the main directory contains the -configuration common to both projects and has to be loaded. - -**Remember:** -When working with project use **Rebase** strategy as long as you can -not to create extra merge commits. You'll be asked by the IDE probably -during first push when some other developer also made changes. - -## Compile and run application - -To compile client application you need Android SDK as well as JDK 15 (corretto version was used). - -### Server - -### Environment - -There is a docker environment configured in [docker-compose.yml](dev-env/docker-compose.yml) -required to run server application. It contains Postgres database for server data. -You can start it with - -```shell -./start.sh -``` - -on linux or some equivalent commands on other platform. - -#### Run from terminal - -The easiest way to run the instance of server is to start it from terminal by running -Gradle - -```shell -./gradlew server:run -``` - -from the root directory of project. - -#### Run from Intellij - -To run the server from the Intellij, go to the `Server` class and run the `main` -function (starting database manually before). - -**Notice:** -You need to have environment variables loaded to build configuration to start -application correctly. The easiest way is to copy the content of [.env](.env) -file and paste it in the build configuration in Intellij as committed version -contains the definition of developer environment. - -#### Compile to JAR file - -Just run `./gradlew stage` to build the server distribution. Build -result will be located in `server/build/libs/`. You can run it with `java -jar` -command, but you have to manually set the needed env variables to make application -working. - -### Desktop - -#### Run from terminal - -The easiest way to run the instance of desktop client is to start it from terminal by running -Gradle - -```shell -./gradlew desktop-app:runDistributable -``` - -from the root directory of project. - -### iOS - -#### Run from terminal - -To run iOS version of client cocoapods pod needs to be compiled and installed to XCode project -located in `ios-app`. The easiest way to compile and link all ios targets is to run - -```shell -./gradlew linkPodReleaseFrameworkIosFat linkPodDebugFrameworkIosFat -``` - -from the root directory of project and then - -```shell -./gradlew podInstall -``` - -to install the compiled resources to XCode. - -The last step is to set up the XCode project by first changing the value of `TEAM_ID` in -`ios-app/Configuration/Config.xcconfig` to your own and then open XCode workspace available -in `ios-app`. - -### Android - -#### Run from Intellij - -The easiest way to run the instance of android client is to start it from Android Studio by running -Gradle the generated build configuration `android-app`. It should build the debug version of application -and deploy it on available emulator of android device. This is the only advised method of running the -client application for android platform. - -## Project structure - -Projects is configured as Gradle modules that may depend on each other. -E.g. it contains module that is compiled to `.jar` distribution file of server -for the application and some other module that can be compiled to Android `.apk` -file. - -### Application modules - -- `build-src` - contains configuration of build logic (it's compiled before Gradle build of the other modules even - starts) -- `shared` - contains common logic for `server` and `shared-client` like domain model or rest api model, depends - on `build-src` -- `shared-client` - contains common logic for `android-app` (and future `ios-app`) like rest client, depends - on `build-src` and `shared` -- `android-app` - targets Android, depends on `shared-client` -- `desktop-app` - targets any JVM desktop, depends on `shared-client` -- `server` - targets JVM, depends on `build-src` and `shared` - -### Extra directories - -- `dev-env` - useful tools that **should** be used by developers that are working - locally to test their current code and solutions - - docker environment with Postgres database can be run with `start.sh` - - `http` contains http requests definitions that can be run from Intellij. They're - configured by the `http-client.env.json` to switch between different environments diff --git a/android-app/.gitignore b/android-app/.gitignore deleted file mode 100644 index 327034ee..00000000 --- a/android-app/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/build -/release -/debug diff --git a/android-app/build.gradle.kts b/android-app/build.gradle.kts deleted file mode 100644 index 15725d51..00000000 --- a/android-app/build.gradle.kts +++ /dev/null @@ -1,56 +0,0 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - kotlin("multiplatform") - id("com.android.application") - id("org.jetbrains.compose") - id("build-src-plugin") -} - -group = "ml.dev.kotlin.minigames" -version = VERSION - -android { - compileSdk = Constants.Android.compileSdk - namespace = "ml.dev.kotlin.minigames" - defaultConfig { - applicationId = "ml.dev.kotlin.minigames" - minSdk = Constants.Android.minSdk - targetSdk = Constants.Android.targetSdk - versionCode = VERSION_CODE - versionName = VERSION - } - buildTypes { - getByName("release") { - isMinifyEnabled = true - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") - } - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - tasks.withType { - kotlinOptions { - jvmTarget = "17" - } - } -} - -kotlin { - jvmToolchain(17) - - androidTarget() - - sourceSets { - androidMain.dependencies { - implementation(project(":shared")) - implementation(project(":shared-client")) - implementation(Dependencies.androidXActivity) - implementation(Dependencies.androidXActivityCompose) - implementation(Dependencies.decompose) - implementation("androidx.appcompat:appcompat:1.6.1") - implementation("androidx.appcompat:appcompat-resources:1.6.1") - } - } -} diff --git a/android-app/proguard-rules.pro b/android-app/proguard-rules.pro deleted file mode 100644 index c29e832c..00000000 --- a/android-app/proguard-rules.pro +++ /dev/null @@ -1,40 +0,0 @@ -# Keep `Companion` object fields of serializable classes. -# This avoids serializer lookup through `getDeclaredClasses` as done for named companion objects. --if @kotlinx.serialization.Serializable class ** --keepclassmembers class <1> { - static <1>$Companion Companion; -} - -# Keep `serializer()` on companion objects (both default and named) of serializable classes. --if @kotlinx.serialization.Serializable class ** { - static **$* *; -} --keepclassmembers class <1>$<3> { - kotlinx.serialization.KSerializer serializer(...); -} - -# Keep `INSTANCE.serializer()` of serializable objects. --if @kotlinx.serialization.Serializable class ** { - public static ** INSTANCE; -} --keepclassmembers class <1> { - public static <1> INSTANCE; - kotlinx.serialization.KSerializer serializer(...); -} - -# @Serializable and @Polymorphic are used at runtime for polymorphic serialization. --keepattributes RuntimeVisibleAnnotations,AnnotationDefault - --keepclassmembers class io.ktor.** { volatile ; } --keepclassmembers class kotlinx.** { volatile ; } - --dontwarn org.bouncycastle.jsse.BCSSLParameters --dontwarn org.bouncycastle.jsse.BCSSLSocket --dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider --dontwarn org.conscrypt.Conscrypt$Version --dontwarn org.conscrypt.Conscrypt --dontwarn org.conscrypt.ConscryptHostnameVerifier --dontwarn org.openjsse.javax.net.ssl.SSLParameters --dontwarn org.openjsse.javax.net.ssl.SSLSocket --dontwarn org.openjsse.net.ssl.OpenJSSE --dontwarn org.slf4j.impl.StaticLoggerBinder diff --git a/android-app/src/androidMain/AndroidManifest.xml b/android-app/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 3116978a..00000000 --- a/android-app/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/android-app/src/androidMain/kotlin/ml/dev/kotlin/minigames/activity/MainActivity.kt b/android-app/src/androidMain/kotlin/ml/dev/kotlin/minigames/activity/MainActivity.kt deleted file mode 100644 index 699680b2..00000000 --- a/android-app/src/androidMain/kotlin/ml/dev/kotlin/minigames/activity/MainActivity.kt +++ /dev/null @@ -1,18 +0,0 @@ -package ml.dev.kotlin.minigames.activity - -import android.os.Bundle -import androidx.activity.ComponentActivity -import com.arkivanov.decompose.defaultComponentContext -import ml.dev.kotlin.minigames.shared.component.MiniGamesAppComponentContext -import ml.dev.kotlin.minigames.shared.component.MiniGamesAppComponentImpl -import ml.dev.kotlin.minigames.shared.setMainAndroidApp - -class MainActivity : ComponentActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - val appContext = MiniGamesAppComponentContext(applicationContext, window) - val component = MiniGamesAppComponentImpl(appContext, defaultComponentContext()) - setMainAndroidApp(component) - } -} diff --git a/android-app/src/androidMain/res/drawable/ic_launcher_background.xml b/android-app/src/androidMain/res/drawable/ic_launcher_background.xml deleted file mode 100644 index c3ab1679..00000000 --- a/android-app/src/androidMain/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - diff --git a/android-app/src/androidMain/res/drawable/ic_launcher_foreground.xml b/android-app/src/androidMain/res/drawable/ic_launcher_foreground.xml deleted file mode 100644 index ef4791ba..00000000 --- a/android-app/src/androidMain/res/drawable/ic_launcher_foreground.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - diff --git a/android-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/android-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index bbd3e021..00000000 --- a/android-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index bbd3e021..00000000 --- a/android-app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/android-app/src/androidMain/res/values/themes.xml b/android-app/src/androidMain/res/values/themes.xml deleted file mode 100644 index 6ed03479..00000000 --- a/android-app/src/androidMain/res/values/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -