Skip to content

Commit

Permalink
Fix proguard/r8 rules for Android (#300)
Browse files Browse the repository at this point in the history
Libraries that require proguard rules should publish them automatically
to r8 by using consumerProguardFiles. Currently, Ferrostar declared
this, but left the corresponding rules files empty. This patch moves the
rules from proguard-rules.pro so that R8 automatically picks them up
without apps using Ferrostar needing to do anything.

Moreover, it removes proguard-rules.pro and the corresponding release
block from Android libraries, since whether the build type is release or
debug (and whether or not r8 is enabled) is dependant on the app module.
  • Loading branch information
ahmedre authored Oct 17, 2024
1 parent adb74ca commit 02657e3
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 117 deletions.
6 changes: 0 additions & 6 deletions android/composeui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ android {
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
21 changes: 0 additions & 21 deletions android/composeui/proguard-rules.pro

This file was deleted.

6 changes: 0 additions & 6 deletions android/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ android {
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
8 changes: 8 additions & 0 deletions android/core/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ferrostar & JNA
# TODO: This needs validation from a publishing app. Ticket https://github.com/stadiamaps/ferrostar/issues/185
-keep class com.sun.jna.** { *; }
-keep class uniffi.ferrostar.** { *; }
-dontwarn java.awt.Component
-dontwarn java.awt.GraphicsEnvironment
-dontwarn java.awt.HeadlessException
-dontwarn java.awt.Window
30 changes: 0 additions & 30 deletions android/core/proguard-rules.pro

This file was deleted.

6 changes: 0 additions & 6 deletions android/google-play-services/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ android {
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
21 changes: 0 additions & 21 deletions android/google-play-services/proguard-rules.pro

This file was deleted.

6 changes: 0 additions & 6 deletions android/maplibreui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ android {
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
21 changes: 0 additions & 21 deletions android/maplibreui/proguard-rules.pro

This file was deleted.

0 comments on commit 02657e3

Please sign in to comment.