Files
IronFox/scripts/deglean.sh
celenity 870c6342f3 IronFox v146.0.1
ironfox-oss/IronFox!112
____

## Changes

- [Enabled memory tagging](e24a24e63c) *(via [Android's Arm Memory Tagging Extension](https://developer.android.com/ndk/guides/arm-mte))* to improve security for supported devices *(such as the Pixel 8 and newer)*.
- [Fixed an issue with Obtainium app installation](6026d6524f).
- Updated Bundletool to [`1.18.3`](https://github.com/google/bundletool/releases/tag/1.18.3).
- Updated to Firefox [`146.0.1`](https://firefox.com/firefox/android/146.0.1/releasenotes/).
- Updated microG to [`v0.3.11.250932`](https://github.com/microg/GmsCore/releases/tag/v0.3.11.250932).
- Updated Rust to [`1.92.0`](https://releases.rs/docs/1.92.0/).
- [Various tweaks, fixes, and refinements - especially to the build process](https://gitlab.com/ironfox-oss/IronFox/-/merge_requests/112/diffs).

MR-author: celenity <celenity@celenity.dev>
Co-authored-by: Weblate <hosted@weblate.org>
Co-authored-by: Akash Yadav <itsaky01@gmail.com>
Co-authored-by: techaddict <20232669-techaddict@users.noreply.gitlab.com>
Co-authored-by: user <user@localhost.localdomain>
Approved-by: Akash Yadav <itsaky01@gmail.com>
Merged-by: celenity <celenity@celenity.dev>
2025-12-19 16:16:28 +00:00

154 lines
7.6 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
function deglean() {
local dir="$1"
local gradle_files=$(find "${dir}" -type f -name "*.gradle")
local kt_files=$(find "${dir}" -type f -name "*.kt")
local yaml_files=$(find "${dir}" -type f -name "metrics.yaml" -o -name "pings.yaml")
if [ -n "$gradle_files" ]; then
for file in $gradle_files; do
local modified=false
python3 "$rootdir/scripts/deglean.py" "$file"
if grep -q 'apply plugin.*glean' "$file"; then
$SED -i -r 's/^(.*apply plugin:.*glean.*)$/\/\/ \1/' "$file"
modified=true
fi
if grep -q 'classpath.*glean' "$file"; then
$SED -i -r 's/^(.*classpath.*glean.*)$/\/\/ \1/' "$file"
modified=true
fi
if grep -q 'compileOnly.*glean' "$file"; then
$SED -i -r 's/^(.*compileOnly.*glean.*)$/\/\/ \1/' "$file"
modified=true
fi
if grep -q 'implementation.*glean' "$file"; then
$SED -i -r 's/^(.*implementation.*glean.*)$/\/\/ \1/' "$file"
modified=true
fi
if grep -q 'testImplementation.*glean' "$file"; then
$SED -i -r 's/^(.*testImplementation.*glean.*)$/\/\/ \1/' "$file"
modified=true
fi
if [ "$modified" = true ]; then
echo "De-gleaned $file."
fi
done
else
echo "No *.gradle files found in $dir."
fi
if [ -n "$kt_files" ]; then
for file in $kt_files; do
local modified=false
if grep -q 'import mozilla.telemetry.*' "$file"; then
$SED -i -r 's/^(.*import mozilla.telemetry.*)$/\/\/ \1/' "$file"
modified=true
fi
if grep -q 'import .*GleanMetrics' "$file"; then
$SED -i -r 's/^(.*GleanMetrics.*)$/\/\/ \1/' "$file"
modified=true
fi
if [ "$modified" = true ]; then
echo "De-gleaned $file."
fi
done
else
echo "No *.kt files found in $dir."
fi
if [ -n "$yaml_files" ]; then
for yaml_file in $yaml_files; do
rm -vf "$yaml_file"
echo "De-gleaned $yaml_file."
done
else
echo "No metrics.yaml or pings.yaml files found in $dir."
fi
}
function deglean_fenix() {
local dir="$1"
local gradle_files=$(find "${dir}" -type f -name "*.gradle")
if [ -n "$gradle_files" ]; then
for file in $gradle_files; do
local modified=false
if grep -q 'implementation.*service-glean' "$file"; then
$SED -i -r 's/^(.*implementation.*service-glean.*)$/\/\/ \1/' "$file"
modified=true
fi
if grep -q 'testImplementation.*glean' "$file"; then
$SED -i -r 's/^(.*testImplementation.*glean.*)$/\/\/ \1/' "$file"
modified=true
fi
if [ "$modified" = true ]; then
echo "De-gleaned $file."
fi
done
else
echo "No *.gradle files found in $dir."
fi
}
deglean "${application_services}"
deglean "${mozilla_release}/mobile/android/android-components"
deglean "${mozilla_release}/mobile/android/fenix/app/src/main/java/org/mozilla/gecko"
deglean "${mozilla_release}/mobile/android/geckoview"
deglean "${mozilla_release}/mobile/android/gradle"
deglean_fenix "${mozilla_release}/mobile/android/fenix"
$SED -i 's|mozilla-glean|# mozilla-glean|g' "${application_services}/gradle/libs.versions.toml"
$SED -i 's|glean|# glean|g' "${application_services}/gradle/libs.versions.toml"
$SED -i 's|classpath libs.glean.gradle.plugin|// classpath libs.glean.gradle.plugin|g' "${mozilla_release}/build.gradle"
# Remove the Glean service
## https://searchfox.org/firefox-main/source/mobile/android/android-components/components/service/glean/README.md
$SED -i 's|- components:service-glean|# - components:service-glean|g' "${mozilla_release}/mobile/android/fenix/.buildconfig.yml"
rm -rvf "${mozilla_release}/mobile/android/android-components/components/service/glean"
rm -rvf "${mozilla_release}/mobile/android/android-components/samples/glean"
# Remove unused/unnecessary Glean components (Application Services)
rm -vf "${application_services}/components/sync_manager/android/src/main/java/mozilla/appservices/syncmanager/BaseGleanSyncPing.kt"
# Remove unused/unnecessary Glean components (Fenix)
rm -vf "${mozilla_release}/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/ext/Configuration.kt"
rm -vf "${mozilla_release}/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt"
rm -vf "${mozilla_release}/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/GleanUsageReporting.kt"
rm -vf "${mozilla_release}/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/GleanUsageReportingApi.kt"
rm -vf "${mozilla_release}/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/GleanUsageReportingLifecycleObserver.kt"
rm -vf "${mozilla_release}/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/GleanUsageReportingMetricsService.kt"
# Remove Glean classes (Android Components)
$SED -i -e 's|GleanMessaging|// GleanMessaging|' "${mozilla_release}/mobile/android/android-components/components/service/nimbus/src/main/java/mozilla/components/service/nimbus/messaging/NimbusMessagingController.kt"
$SED -i -e 's|Microsurvey.confirmation|// Microsurvey.confirmation|' "${mozilla_release}/mobile/android/android-components/components/service/nimbus/src/main/java/mozilla/components/service/nimbus/messaging/NimbusMessagingController.kt"
$SED -i -e 's|Microsurvey.dismiss|// Microsurvey.dismiss|' "${mozilla_release}/mobile/android/android-components/components/service/nimbus/src/main/java/mozilla/components/service/nimbus/messaging/NimbusMessagingController.kt"
$SED -i -e 's|Microsurvey.privacy|// Microsurvey.privacy|' "${mozilla_release}/mobile/android/android-components/components/service/nimbus/src/main/java/mozilla/components/service/nimbus/messaging/NimbusMessagingController.kt"
$SED -i -e 's|Microsurvey.shown|// Microsurvey.shown|' "${mozilla_release}/mobile/android/android-components/components/service/nimbus/src/main/java/mozilla/components/service/nimbus/messaging/NimbusMessagingController.kt"
$SED -i -e 's|GleanMessaging|// GleanMessaging|' "${mozilla_release}/mobile/android/android-components/components/service/nimbus/src/main/java/mozilla/components/service/nimbus/messaging/NimbusMessagingStorage.kt"
rm -vf "${mozilla_release}/mobile/android/android-components/components/lib/crash/src/main/java/mozilla/components/lib/crash/service/GleanCrashReporterService.kt"
# Remove Glean classes (Application Services)
$SED -i 's|FxaClientMetrics|// FxaClientMetrics|g' "${application_services}/components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/FxaClient.kt"
$SED -i 's|LoginsStoreMetrics|// LoginsStoreMetrics|g' "${application_services}/components/logins/android/src/main/java/mozilla/appservices/logins/DatabaseLoginsStorage.kt"
$SED -i 's|NimbusEvents.isReady|// NimbusEvents.isReady|g' "${application_services}/components/nimbus/android/src/main/java/org/mozilla/experiments/nimbus/NimbusInterface.kt"
$SED -i 's|PlacesManagerMetrics|// PlacesManagerMetrics|g' "${application_services}/components/places/android/src/main/java/mozilla/appservices/places/PlacesConnection.kt"
# Remove Glean classes (Gecko)
$SED -i -e 's|Metrics|// Metrics|' "${mozilla_release}/mobile/android/fenix/app/src/main/java/org/mozilla/gecko/search/SearchWidgetProvider.kt"