@@ 2,15 2,74 @@
title: Building Husky
---
-This document will be empty until I refactor some parts of the application and
-improve the gradle files in order to provide a new version of Husky.
+This page contains all the necessary information for building Husky yourself.
-Stay tuned to the mailists in order to be informed of the progress!
+# Read before continuing with the guide
-Announcements: [lists.sr.ht/~captainepoch/husky-announce][lists_husky_announce].
+As I mentioned a lot of times the application will suffer a refactor. Therefore,
+tests are going to fail and will be re-done.
-Development: [lists.sr.ht/~captainepoch/husky-devel][lists_husky_devel].
+Please, do not use the `build` Gradle task because it will fail.
+# Android SDK
-[lists_husky_announce]: https://lists.sr.ht/~captainepoch/husky-announce
-[lists_husky_devel]: https://lists.sr.ht/~captainepoch/husky-devel
+You will need to setup the Android SDK before compiling this.
+
+Bear in mind that you will need the `build-tools` version `30.0.3`.
+
+# Flavors
+
+There are two flavors:
+
+- `huskyBeta`: flavor for beta releases.
+- `huskyStable`: flavor for stable releases.
+
+The old naming of the flavors did not make any sense, so I changed it.
+
+All the builds will generate **unsigned** APKs. You must sign the generated APK
+before installing it in any phone.
+
+# Structure of the project
+
+The project now resides in its own folder. Please change your CI/CD
+script/recipe/configuration to navigate inside the `husky` folder before
+executing any `gradle` task.
+
+## Assembling `beta` releases
+
+To assemble a `beta` APK:
+
+```
+$ ./gradlew assembleHuskyBeta --rerun-tasks
+```
+
+The release APK will be called `app-husky-beta-release-unsigned.apk`.
+
+## Assembling `stable` releases
+
+To assemble a `stable` APK:
+
+```
+$ ./gradlew assembleHuskyStable --rerun-tasks
+```
+
+The release APK will be called `app-husky-stable-release-unsigned.apk`.
+
+## Signing the APK
+
+Put in the `$PATH` variable the `build-tools` folder.
+
+```
+$ apksigner sign --ks <KEYSTORE> --ks-key-alias <ALIAS> --ks-pass <KEYSTORE_PASS> --key-pass <KEY_PASS> --in <UNSIGNED_APK> --out <SIGNED_APK>
+```
+
+Where:
+- `<KEYSTORE>`: Name of the keystore (i.e.: `android.keystore`).
+- `<ALIAS>`: Alias of the key (i.e.: `androiddebugkey`).
+- `<KEYSTORE_PASS>`: Password of the keystore (i.e.: `"pass:android"`). Change what is before
+ the `:` symbol.
+- `<KEY_PASS>`: Password of the key (i.e.: `"pass:android"`). Change what is before
+ the `:` symbol.
+- `<UNSIGNED_APK>`: The APK you want to sign. I recommend to execute a `find`
+ command to look for the APK file (i.e.: `$(find -name "*-unsigned.apk")`).
+- `<SIGNED_APK>`: The name of the APK signed (i.e.: `husky-beta.apk`).