Skip to content

Commit

Permalink
feat: app minification (#988)
Browse files Browse the repository at this point in the history
* feat: app minification

* fix: remove allowaccessmodification rule

* fix: minifyEnabled for android

* fix: remove keepattributes and add renamesourcefileattribute for ofuscation

* fix: add ios minification flags

* fix: add ios minification flags

* fix: remove DEVELOPMENT_TEAM flag

* fix: remove DEVELOPMENT_TEAM flag

* fix: add NX bit flags

* feat: update .gitignore

* feat: add SYMBOLS STRIPPED flags

* feat: add RUNPATH, RPATH, RELRO flags

* fix: add missing PIE flag

* fix: add missing FORTIFY flag
  • Loading branch information
jimcase authored Mar 4, 2025
1 parent 76ddc31 commit 43497c9
Show file tree
Hide file tree
Showing 40 changed files with 728 additions and 298 deletions.
5 changes: 4 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ android {
}
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
}
}
}

Expand Down
57 changes: 44 additions & 13 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
# Add project specific ProGuard rules here.
# Add project-specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Basic ProGuard rules for optimization and minification
-optimizationpasses 5
-dontpreverify
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile # Uncomment to hide original source file names for extra obfuscation

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Rules for WebView with JavaScript (if your app uses WebView)
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
-dontwarn android.webkit.**

# Rules for Capacitor and its plugins
-keep class com.getcapacitor.** { *; }
-keep class org.apache.cordova.** { *; }
-dontwarn com.getcapacitor.**
-dontwarn org.apache.cordova.**

# Rules for specific dependencies from your package.json
-keep class androidx.** { *; }
-dontwarn androidx.**
-keep class com.google.android.material.** { *; }
-dontwarn com.google.android.material.**

# Rules for Capacitor plugins used in your project
-keep class com.aparajita.capacitor.biometricauth.** { *; }
-dontwarn com.aparajita.capacitor.biometricauth.**
-keep class com.capacitorjs.plugins.** { *; }
-dontwarn com.capacitorjs.plugins.**
-keep class io.evva.capacitor.securestorage.** { *; }
-dontwarn io.evva.capacitor.securestorage.**

# Suppress warnings from common libraries
-dontwarn com.google.**
-dontwarn org.chromium.**

# Keep annotated classes (useful for libraries like SQLite or MLKit)
-keep class * {
@androidx.annotation.Keep *;
}
34 changes: 34 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,40 @@ App/App/public
DerivedData
xcuserdata

# Pods config files
!App/Pods/Target Support Files/AparajitaCapacitorBiometricAuth/AparajitaCapacitorBiometricAuth.release.xcconfig
!App/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig
!App/Pods/Target Support Files/CapacitorApp/CapacitorApp.release.xcconfig
!App/Pods/Target Support Files/CapacitorBrowser/CapacitorBrowser.release.xcconfig
!App/Pods/Target Support Files/CapacitorClipboard/CapacitorClipboard.release.xcconfig
!App/Pods/Target Support Files/CapacitorCommunityPrivacyScreen/CapacitorCommunityPrivacyScreen.release.xcconfig
!App/Pods/Target Support Files/CapacitorCommunitySqlite/CapacitorCommunitySqlite.release.xcconfig
!App/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig
!App/Pods/Target Support Files/CapacitorDevice/CapacitorDevice.release.xcconfig
!App/Pods/Target Support Files/CapacitorKeyboard/CapacitorKeyboard.release.xcconfig
!App/Pods/Target Support Files/CapacitorMlkitBarcodeScanning/CapacitorMlkitBarcodeScanning.release.xcconfig
!App/Pods/Target Support Files/CapacitorNativeSettings/CapacitorNativeSettings.release.xcconfig
!App/Pods/Target Support Files/CapacitorScreenOrientation/CapacitorScreenOrientation.release.xcconfig
!App/Pods/Target Support Files/CapacitorShare/CapacitorShare.release.xcconfig
!App/Pods/Target Support Files/CapacitorSplashScreen/CapacitorSplashScreen.release.xcconfig
!App/Pods/Target Support Files/CapacitorStatusBar/CapacitorStatusBar.release.xcconfig
!App/Pods/Target Support Files/EvvaCapacitorSecureStoragePlugin/EvvaCapacitorSecureStoragePlugin.release.xcconfig
!App/Pods/Target Support Files/GoogleDataTransport/GoogleDataTransport.release.xcconfig
!App/Pods/Target Support Files/GoogleMLKit/GoogleMLKit.release.xcconfig
!App/Pods/Target Support Files/GoogleToolboxForMac/GoogleToolboxForMac.release.xcconfig
!App/Pods/Target Support Files/GoogleUtilities/GoogleUtilities.release.xcconfig
!App/Pods/Target Support Files/GTMSessionFetcher/GTMSessionFetcher.release.xcconfig
!App/Pods/Target Support Files/MLImage/MLImage.release.xcconfig
!App/Pods/Target Support Files/MLKitBarcodeScanning/MLKitBarcodeScanning.release.xcconfig
!App/Pods/Target Support Files/MLKitCommon/MLKitCommon.release.xcconfig
!App/Pods/Target Support Files/MLKitVision/MLKitVision.release.xcconfig
!App/Pods/Target Support Files/nanopb/nanopb.release.xcconfig
!App/Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig
!App/Pods/Target Support Files/PromisesObjC/PromisesObjC.release.xcconfig
!App/Pods/Target Support Files/SimpleKeychain/SimpleKeychain.release.xcconfig
!App/Pods/Target Support Files/SQLCipher/SQLCipher.release.xcconfig
!App/Pods/Target Support Files/ZIPFoundation/ZIPFoundation.release.xcconfig

# Cordova plugins for Capacitor
capacitor-cordova-ios-plugins

Expand Down
5 changes: 4 additions & 1 deletion ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,13 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
COPY_PHASE_STRIP = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
Expand All @@ -335,6 +337,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
STRIP_STYLE = all;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 43497c9

Please sign in to comment.