Skip to content

Colota - Android GPS Location tracker

fix: improve FOSS build reproducibility

Max Dietrich34ff2ce0240d
diff --git a/.github/workflows/build-latest-release.yml b/.github/workflows/build-latest-release.yml
index 682c135a..2d0b42a8 100644
--- a/.github/workflows/build-latest-release.yml
+++ b/.github/workflows/build-latest-release.yml
@@ -71,16 +71,14 @@ jobs:
- name: Build shared package
run: npm run build -w @colota/shared
- - name: Create gradle.properties
+ - name: Pin dev server IP for reproducible builds
run: |
- cat <<EOF >> apps/mobile/android/gradle.properties
- org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m
- android.useAndroidX=true
- android.enableJetifier=true
- hermesEnabled=true
- newArchEnabled=true
- reactNativeArchitectures=arm64-v8a,armeabi-v7a
+ sed -i 's/getHostIpAddress()/project.properties["reactNativeDevServerIp"]?.toString() ?: "localhost"/' \
+ node_modules/@react-native/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt
+ - name: Append signing config to gradle.properties
+ run: |
+ cat <<EOF >> apps/mobile/android/gradle.properties
MYAPP_UPLOAD_STORE_FILE=release.keystore
MYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}
MYAPP_UPLOAD_KEY_ALIAS=${{ secrets.KEY_ALIAS }}
@@ -103,24 +101,17 @@ jobs:
run: |
cd apps/mobile/android
chmod +x gradlew
- ./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon \
- -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=512m"
+ ./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon
- name: Build GMS Release APKs
run: |
cd apps/mobile/android
- ./gradlew assembleGmsRelease --no-daemon \
- -PhermesEnabled=true \
- -Pandroid.useAndroidX=true \
- -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=512m"
+ ./gradlew assembleGmsRelease --no-daemon
- name: Build FOSS Release APKs
run: |
cd apps/mobile/android
- ./gradlew assembleFossRelease --no-daemon \
- -PhermesEnabled=true \
- -Pandroid.useAndroidX=true \
- -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=512m"
+ ./gradlew clean assembleFossRelease --no-daemon
- name: Update Latest Tag
run: |
diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml
index f54a14ea..7c8734bc 100644
--- a/.github/workflows/build-release.yml
+++ b/.github/workflows/build-release.yml
@@ -63,16 +63,14 @@ jobs:
- name: Build shared package
run: npm run build -w @colota/shared
- - name: Create gradle.properties
+ - name: Pin dev server IP for reproducible builds
run: |
- cat <<EOF >> apps/mobile/android/gradle.properties
- org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m
- android.useAndroidX=true
- android.enableJetifier=true
- hermesEnabled=true
- newArchEnabled=true
- reactNativeArchitectures=arm64-v8a,armeabi-v7a
+ sed -i 's/getHostIpAddress()/project.properties["reactNativeDevServerIp"]?.toString() ?: "localhost"/' \
+ node_modules/@react-native/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt
+ - name: Append signing config to gradle.properties
+ run: |
+ cat <<EOF >> apps/mobile/android/gradle.properties
MYAPP_UPLOAD_STORE_FILE=release.keystore
MYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}
MYAPP_UPLOAD_KEY_ALIAS=${{ secrets.KEY_ALIAS }}
@@ -95,24 +93,17 @@ jobs:
run: |
cd apps/mobile/android
chmod +x gradlew
- ./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon \
- -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=512m"
+ ./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon
- name: Build GMS Release APKs
run: |
cd apps/mobile/android
- ./gradlew assembleGmsRelease --no-daemon \
- -PhermesEnabled=true \
- -Pandroid.useAndroidX=true \
- -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=512m"
+ ./gradlew assembleGmsRelease --no-daemon
- name: Build FOSS Release APKs
run: |
cd apps/mobile/android
- ./gradlew assembleFossRelease --no-daemon \
- -PhermesEnabled=true \
- -Pandroid.useAndroidX=true \
- -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=512m"
+ ./gradlew clean assembleFossRelease --no-daemon
- name: Upload APKs
uses: actions/upload-artifact@v4
diff --git a/README.md b/README.md
index 623d0204..3b7b55fb 100644
--- a/README.md
+++ b/README.md
@@ -80,7 +80,8 @@ Full docs at **[colota.app](https://colota.app)** covers configuration, server i
```bash
git clone https://github.com/dietrichmax/colota.git
cd colota
-npm install
+npm ci
+npm run build -w @colota/shared
cd apps/mobile/android
./gradlew assembleGmsRelease # Google Play variant
./gradlew assembleFossRelease # F-Droid variant (no Google Play Services)
diff --git a/apps/docs/docs/development/local-setup.md b/apps/docs/docs/development/local-setup.md
index 29baefdd..6cfe8de4 100644
--- a/apps/docs/docs/development/local-setup.md
+++ b/apps/docs/docs/development/local-setup.md
@@ -19,7 +19,7 @@ sidebar_position: 2
```bash
git clone https://github.com/dietrichmax/colota.git
cd colota
-npm install
+npm ci
```
This installs dependencies for all workspace packages (`apps/mobile`, `apps/docs`, `packages/shared`).
@@ -29,8 +29,7 @@ This installs dependencies for all workspace packages (`apps/mobile`, `apps/docs
The shared package must be compiled before other packages can use it:
```bash
-cd packages/shared
-npm run build
+npm run build -w @colota/shared
```
This runs `tsc` and outputs compiled JavaScript to `packages/shared/dist/`.
diff --git a/apps/docs/docs/getting-started/build-from-source.md b/apps/docs/docs/getting-started/build-from-source.md
index d583caf2..dfd29bf9 100644
--- a/apps/docs/docs/getting-started/build-from-source.md
+++ b/apps/docs/docs/getting-started/build-from-source.md
@@ -15,7 +15,8 @@ sidebar_position: 3
```bash
git clone https://github.com/dietrichmax/colota.git
cd colota
-npm install
+npm ci
+npm run build -w @colota/shared
cd apps/mobile/android
```
diff --git a/apps/mobile/android/gradle.properties b/apps/mobile/android/gradle.properties
index d318cf58..386ab56b 100644
--- a/apps/mobile/android/gradle.properties
+++ b/apps/mobile/android/gradle.properties
@@ -38,6 +38,11 @@ newArchEnabled=true
# If set to false, you will be using JSC instead.
hermesEnabled=true
+# Pin dev server IP for reproducible builds (F-Droid).
+# Without this, the RN gradle plugin bakes the build machine's IP into resources.
+# Requires RN 0.85+ (PR #55531). No-op on older versions.
+reactNativeDevServerIp=localhost
+
# Use this property to enable edge-to-edge display support.
# This allows your app to draw behind system bars for an immersive UI.
# Note: Only works with ReactActivity and should not be used with custom Activity.