5.5 KiB
Description
This document describes how to update Status APK builds for the F-Droid Android application catalogue.
Intro
In simplest terms F-Droid requires a YAML file that defines the steps necessary to create a universal unsigned APK build. This is achieved by submitting a new app versions into the metadata/im.status.ethereum.yml
file in the fdroiddata repository.
The app builds defined this way run on servers that generate the unsigned APKs using the fdroidserver software. The server setup is quite involved but is not necessary unless you want to run your own instance. Normally the applications defines in fdroiddata
are built by servers maintained by the F-Droid volunteers.
First release of Status app was merged in fdroid/fdroiddata#7179.
Adding New Versions
You can find our configuration file at metadata/im.status.ethereum.yml
The file defines all the necessary metadata like SourceCode
, Website
, or License
, but the most important key is Builds
, which looks like this:
Builds:
- versionName: 1.12.0
versionCode: 2021022512
commit: cfb825a11b61d312af8cb5d36686af540c31f481
sudo: make fdroid-nix-dir
init: nix/scripts/setup.sh
output: result/app-release-unsigned.apk
scanignore: android/build.gradle
scandelete: ios
build: make release-fdroid BUILD_NUMBER=$$VERCODE$$
It contains a list of objects defining each release of the application. In order to add a new release simply copy a previous release object and adjust the following values:
versionName
- String version like1.12.0
.versionCode
- AndroidversionCode
. We use a timestamp generated by a script.commit
- Specific commit SHA1 from which the given release was built.
The versionCode
should be the same as the one in build that was uploaded to Play Store.
It can be found in the build logs or by using:
> apkanalyzer manifest version-code StatusIm-Mobile-v1.12.0.apk
2021022512
At the bottom of the file you should also update the following keys:
CurrentVersion
- Same as the newversionName
addedCurrentVersionCode
- Same as theversionCode
added
Then submit a merge request to the fdroid/fdroiddata repository.
Checking Builds
The simplest way to test if the app builds via F-Droid is to use the Docker image: https://gitlab.com/fdroid/docker-executable-fdroidserver
Which is available under registry.gitlab.com/fdroid/docker-executable-fdroidserver:latest
.
Because we use Nix to build the mobile app we need to slightly modify the image with this Dockerfile
:
FROM registry.gitlab.com/fdroid/docker-executable-fdroidserver:latest
ARG BUILDER_UID=1000
ENV BUILDER_USER=vagrant
RUN useradd -u $BUILDER_UID $BUILDER_USER
RUN mkdir -m 0755 /nix /home/$BUILDER_USER \
&& chown -R $BUILDER_USER /nix /home/$BUILDER_USER
Build it using:
docker build --build-arg=BUILDER_UID=$UID -t statusteam/docker-executable-fdroidserver:latest .
Then clone the fdroiddata and fdroidserver repos and use it to test the build of a specific Status Android app version: 1.12.0
git clone https://gitlab.com/fdroid/fdroidserver
git clone https://gitlab.com/fdroid/fdroiddata
docker run --rm \
-u $UID:$GID -e USER=vagrant \
-v $PWD/fdroiddata:/repo \
-v $PWD/fdroidserver:/fdroidserver \
statusteam/docker-executable-fdroidserver:latest \
build im.status.ethereum:1.12.0
We have to create a user and specify the UID because Nix cannot run as root
and that is the default user for the F-Droid Docker image. By adding our own user and setting the UID we also make it possible to mount folders like fdroiddata
and fdroidserver
.
You can specify a --vebose
flag for build
command for additional information.
You can provide --storage-opt size=30G
flag if Docker complains about running out of space.
You should also run lint im.status.ethereum
to verify the YAML format is correct.
Details
The original research was done in #8512.
Normally F-Droid server wants to run Gradle itself, but we do not specify the gradle
key in order to run make release-fdroid
ourselves in build
step. We also add android/build.gradle
to scanignore
to avoid F-Droid trying to use Gradle directly.
Once the PR is merged it may take a few days for the F-Droid server farm to build and deploy the new version to their site and app. You can look up the current state of builds here and look for your App ID and a deploy
change after it.
F-Droid Build
F-Droid requires submitted applications to be free of non Open Source software. For this reason we need to exclude certain Google libraries at build time.
This is achieved by setting GOOGLE_FREE=1
in the .env.release
file. This affects two things:
- Clojure code conditional which stops use of
get-referrer
. - Gradle build configuration by excluding Google libraries.
Both are affected by the .env
file and both are required.