From 01c6f9fcec95bad9c2642b5967368b834f09eede Mon Sep 17 00:00:00 2001 From: Sylensky Date: Wed, 26 Feb 2025 22:41:53 +0100 Subject: [PATCH 1/6] doc: add building instructions for vs code --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index a9aa68e..ea2b35f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,27 @@ The OG Star Tracker app is designed to assist astrophotographers in setting up t * **Moshi** - parsing json * **Timber** - logging +## Build setup + +To prepare your environment to build the app locally you can use your IDE of choice. This guide walks you through the building of the app with the Visual Studio Code IDE. +Extensions you need: +- [Gradle for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle) +- [Kotlin Language](https://marketplace.visualstudio.com/items?itemName=mathiasfrohlich.Kotlin) + +What you need now is the android sdk. For that we are not required to use the android studio at all and only require the cli tools. +- Download the [cli-tools for windows](https://developer.android.com/studio?hl=de#command-line-tools-only) +- Extract them into **android/cmdline-tools/tools** +- Install the dependencies and the sdk with the sdkmanager +```shell +OG-star-tracker-App\android\cmdline-tools\tools\bin> .\sdkmanager.bat "platform-tools" +OG-star-tracker-App\android\cmdline-tools\tools\bin> .\sdkmanager.bat "platforms;android-34" +OG-star-tracker-App\android\cmdline-tools\tools\bin> .\sdkmanager.bat "build-tools;34.0.0" +``` +- Configure the **$ANDROID_HOME** variable in your PATH or alternatively set the **sdk.dir=android** in your **local.properties**. +- Now reload the window and and let the gradle extension configure the project. +- Once the **OG Star Tracker** project is configured you can check the **Tasks/other** directive and execute the **zipApksForDevDebug** to finally build the App. + + ## Contributing to the OG Star Tracker App We welcome contributions from the community! If you're looking to contribute to the OG Star Tracker app, here's how you can do so: From c3871f718e0ac212d57a9ae073cb5cce844e2bd0 Mon Sep 17 00:00:00 2001 From: Sylensky Date: Wed, 26 Feb 2025 22:42:29 +0100 Subject: [PATCH 2/6] gradle: disable android builder sdk download This requires the user to have the sdk downloaded. On the other hand it allows building the tools without android studio. --- gradle.properties | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 20e2a01..a371efe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,7 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true + +# Disable sdk download +android.builder.sdkDownload=false From d082bb4fb866b8245efc9b26a936198b29c7728f Mon Sep 17 00:00:00 2001 From: Sylensky Date: Wed, 26 Feb 2025 22:44:19 +0100 Subject: [PATCH 3/6] gitignore: add sdk download directory to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index db80f94..24e6729 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ app/dev/release/baselineProfiles app/dev/release app/ogstartracker.keystore app/prod.keystore +android From d0d03af619124e3cdaa7e53fe86129a5b30cc938 Mon Sep 17 00:00:00 2001 From: Sylensky Date: Wed, 26 Feb 2025 23:47:48 +0100 Subject: [PATCH 4/6] vscode: add tasks to create debug apk --- .vscode/tasks.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..b1b76fc --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Clean", + "type": "shell", + "command": "./gradlew clean", + "group": "build", + "problemMatcher": [] + }, + { + "label": "Build", + "type": "shell", + "command": "./gradlew buildDevDebugPreBundle", + "group": "build", + "dependsOn": "Clean", + "problemMatcher": [] + }, + { + "label": "Zip APK for Debug", + "type": "shell", + "command": "./gradlew zipApkForDebug", + "group": "build", + "dependsOn": "Build", + "problemMatcher": [] + } + ] +} \ No newline at end of file From 256a862d0da65fdb422e7db3db19700259d11282 Mon Sep 17 00:00:00 2001 From: Sylensky Date: Wed, 26 Feb 2025 23:48:13 +0100 Subject: [PATCH 5/6] github: add workflow to bundle and zip the debug apk --- .github/workflows/build-debug.yml | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/build-debug.yml diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml new file mode 100644 index 0000000..e368b72 --- /dev/null +++ b/.github/workflows/build-debug.yml @@ -0,0 +1,37 @@ +name: Build and Upload Debug APK + +on: + push: + branches: + - main + - beta + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: "8.7" + + - name: Clean project + run: ./gradlew clean + + - name: Build Debug Bundle + run: ./gradlew buildDevDebugPreBundle + + - name: Zip APK for Debug + run: ./gradlew zipApkForDebug + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + path: app/build/outputs/apk/dev/debug/OGStarTrackerApp-dev-debug.apk From f4a485708ddf421401a1c65880d863b1786d5dda Mon Sep 17 00:00:00 2001 From: Sylensky Date: Thu, 27 Feb 2025 01:00:08 +0100 Subject: [PATCH 6/6] app: add apk name variation based on build type --- app/build.gradle.kts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6a9a08a..376a953 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -67,6 +67,15 @@ android { buildConfigField("String", "TRACKER_URL", "\"http://www.tracker.com\"") } } + + applicationVariants.all { + outputs.all { + val outputImpl = this as com.android.build.gradle.internal.api.BaseVariantOutputImpl + val variantName = name + val newApkName = "OGStarTrackerApp-${variantName}.apk" + outputImpl.outputFileName = newApkName + } + } compileOptions { sourceCompatibility = JavaVersion.VERSION_17