Add f-droid local build scripts for debugging

This commit is contained in:
Leendert de Borst
2025-11-03 17:46:01 +01:00
parent 97d8d4d15d
commit 376d38ef07
7 changed files with 181 additions and 1 deletions

View File

@@ -24,6 +24,6 @@
}
],
"settings": {
"java.configuration.updateBuildConfiguration": "interactive"
"java.configuration.updateBuildConfiguration": "disabled"
}
}

View File

@@ -0,0 +1,2 @@
fdroiddata
fdroidserver

View File

@@ -0,0 +1,43 @@
FROM registry.gitlab.com/fdroid/fdroidserver:buildserver
# Switch to root to install packages
USER root
# Install required tools
RUN apt-get update && apt-get install -y \
wget \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Set Android SDK environment variables
ENV ANDROID_SDK_ROOT=/opt/android-sdk
ENV ANDROID_HOME=/opt/android-sdk
ENV PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools
# Create Android SDK directory
RUN mkdir -p $ANDROID_SDK_ROOT
# Download and install Android command line tools
RUN wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/cmdline-tools.zip && \
unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools && \
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools/latest && \
mv /tmp/cmdline-tools/cmdline-tools/* $ANDROID_SDK_ROOT/cmdline-tools/latest/ && \
rm -rf /tmp/cmdline-tools.zip /tmp/cmdline-tools
# Accept Android SDK licenses
RUN yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses || true
# Install required Android SDK components
# These versions should match what your app needs
RUN $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager \
"platform-tools" \
"platforms;android-34" \
"platforms;android-33" \
"platforms;android-30" \
"build-tools;34.0.0" \
"build-tools;33.0.0" \
"ndk;28.0.12433566" \
"cmake;3.22.1"
# Set proper permissions
RUN chown -R vagrant:vagrant $ANDROID_SDK_ROOT

View File

@@ -0,0 +1,38 @@
1. Clone
```bash
git clone https://gitlab.com/fdroid/fdroiddata.git --depth=1
git clone https://gitlab.com/fdroid/fdroidserver.git --depth=1
```
2. Build docker image and run docker compose in attach mode
```bash
docker compose build && docker compose run --rm fdroid-buildserver
```
3. Inside the Docker container, run this:
```bash
./build.sh
```
The build process can take a while, upwards of 30min. Final output should look like this:
```bash
Task :app:packageRelease
> Task :app:createReleaseApkListingFileRedirect
> Task :app:lintVitalAnalyzeRelease
> Task :app:lintVitalReportRelease
> Task :app:lintVitalRelease
> Task :app:assembleRelease
[Incubating] Problems report is available at: file:///build/build/net.aliasvault.app/apps/mobile-app/android/build/reports/problems/problems-report.html
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 30m 25s
1564 actionable tasks: 1563 executed, 1 up-to-date
2025-11-03 16:40:56,157 INFO: Successfully built version 0.99.0-test1 of net.aliasvault.app from 97d8d4d15df88cd759b62489368e857291a27078
```

View File

@@ -0,0 +1,19 @@
#! /bin/bash
source /etc/profile.d/bsenv.sh
export GRADLE_USER_HOME=$home_vagrant/.gradle
export fdroid="sudo --preserve-env --user vagrant
env PATH=$fdroidserver:$PATH
env PYTHONPATH=$fdroidserver:$fdroidserver/examples
env PYTHONUNBUFFERED=true
env TERM=$TERM
env HOME=$home_vagrant
fdroid"
# Go to build directory
cd build
# Fetch dependent libraries (if any)
$fdroid fetchsrclibs net.aliasvault.app --verbose
# Format build receipe
$fdroid rewritemeta net.aliasvault.app
# Build app and scan for any binary files that are prohibited
$fdroid build --verbose --latest --scan-binary --on-server --no-tarball net.aliasvault.app

View File

@@ -0,0 +1,25 @@
services:
fdroid-buildserver:
build:
context: .
dockerfile: Dockerfile
container_name: fdroid-buildserver
entrypoint: ["/bin/bash"]
stdin_open: true # equivalent to -i
tty: true # equivalent to -t
volumes:
- ./fdroidserver:/home/vagrant/fdroidserver:Z
- ./fdroiddata:/build:z
# Overwrite the net.aliasvault.app.yml file with the local one which forces build to use latest commit from main branch
- ./net.aliasvault.app.yml:/build/metadata/net.aliasvault.app.yml
# Add build script to the container
- ./build.sh:/build.sh:Z
# Increase memory limits for Gradle builds
shm_size: '2gb'
mem_limit: 12g
memswap_limit: 12g
cpus: 4
environment:
- GRADLE_OPTS=-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError
- JAVA_OPTS=-Xmx4g -XX:MaxMetaspaceSize=1g
restart: "no"

View File

@@ -0,0 +1,53 @@
Categories:
- Password & 2FA
- Security
License: AGPL-3.0-or-later
AuthorName: Leendert de Borst
SourceCode: https://github.com/lanedirt/AliasVault
IssueTracker: https://github.com/lanedirt/AliasVault/issues
Changelog: https://github.com/lanedirt/AliasVault/releases
AutoName: AliasVault
RepoType: git
Repo: https://github.com/lanedirt/AliasVault.git
Builds:
- versionName: 0.99.0-test1
versionCode: 9999
commit: main
subdir: apps/mobile-app/android/app/
sudo:
- sysctl fs.inotify.max_user_watches=524288 || true
- curl -Lo node.tar.gz https://nodejs.org/download/release/v20.19.3/node-v20.19.3-linux-x64.tar.gz
- echo "76272878069683c3a36b933d2f4842436a26b527daa930ae9346b477011ee2f3 node.tar.gz"
| sha256sum -c -
- tar xzf node.tar.gz --strip-components=1 -C /usr/local/
init:
- cd ../..
- sed -i -e '/signingConfig /d' android/app/build.gradle
- npm install --build-from-source
gradle:
- yes
scanignore:
- apps/mobile-app/android/build.gradle
- apps/mobile-app/node_modules/react-native/sdks/hermesc/linux64-bin/hermesc
- apps/mobile-app/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle
- apps/mobile-app/node_modules/expo-modules-core/android/ExpoModulesCorePlugin.gradle
- apps/mobile-app/node_modules/react-native-reanimated/android/build.gradle
- apps/mobile-app/node_modules/@react-native-async-storage/async-storage/android/build.gradle
- apps/mobile-app/node_modules/react-native-safe-area-context/android/build.gradle
- apps/mobile-app/node_modules/react-native-screens/android/build.gradle
- apps/mobile-app/node_modules/react-native-edge-to-edge/android/build.gradle
- apps/mobile-app/node_modules/react-native-webview/android/build.gradle
- apps/mobile-app/node_modules/react-native-aes-gcm-crypto/android/build.gradle
- apps/mobile-app/node_modules/react-native-context-menu-view/android/build.gradle
- apps/mobile-app/node_modules/react-native-get-random-values/android/build.gradle
- apps/mobile-app/node_modules/react-native-svg/android/build.gradle
- apps/mobile-app/node_modules/expo-dev-launcher/android/build.gradle
- apps/mobile-app/node_modules/expo-dev-menu/android/build.gradle
scandelete:
- apps/mobile-app/node_modules/
AutoUpdateMode: None
UpdateCheckMode: None