Skip to content

Commit 4f27ac5

Browse files
author
Adrián García
authored
Add proguard rules to modules (#14)
* Add proguard rules to modules * Update changelog * Update README
1 parent 5638db4 commit 4f27ac5

File tree

11 files changed

+35
-3
lines changed

11 files changed

+35
-3
lines changed

CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8-
- No new features, yet!
8+
### Added
9+
- Add proguard rules for most modules that need them.
10+
### Changed
11+
- No changed features!
12+
### Deprecated
13+
- No deprecated features!
14+
### Removed
15+
- No removed features!
16+
### Fixed
17+
- No fixed issues!
18+
### Security
19+
- No security issues fixed!
920

1021
## [1.3.2] - 2020-05-27
1122
### Added
12-
- Added `allTerminal`, `onAllTerminal` and `firstExceptionOrNull` functions to lists of `Resource`s
23+
- Add `allTerminal`, `onAllTerminal` and `firstExceptionOrNull` functions to lists of `Resource`s
1324

1425
## [1.3.1] - 2020-04-22
1526
### Added

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ dispatcher.addInterceptor(LoggerInterceptor(stores)) { tag, msg ->
247247
}
248248
```
249249

250+
### \[Android] Proguard/R8
251+
Each of the libraries contain a sensible proguard file that your project can consume in order to run you app on Proguard or R8.
252+
No additional steps have to be done in order to use them apart from enabling minify in your project.
253+
250254
## License
251255
```
252256
Copyright 2019 BQ

mini-android/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ android {
1212
versionCode android_version_code
1313
versionName android_version_name
1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15+
consumerProguardFiles "mini-android.pro"
1516
}
17+
1618
buildTypes {
1719
release {
1820
minifyEnabled false

mini-android/mini-android.pro

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ViewModel's empty constructor is considered to be unused by proguard, so keep it
2+
-keepclassmembers,allowobfuscation class * extends androidx.lifecycle.ViewModel {
3+
<init>();
4+
}
5+
-keepclassmembers,allowobfuscation class * extends androidx.lifecycle.AndroidViewModel {
6+
<init>(android.app.Application);
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-keepnames class * extends mini.Store { *; }
2+
-keepnames class * extends mini.BaseAction { *; }
3+
-keep class mini.BaseAction { *; }
4+
-keep class mini.Task { *; }

mini-kodein-android/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ android {
1212
versionCode android_version_code
1313
versionName android_version_name
1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15+
consumerProguardFiles "mini-kodein-android.pro"
1516
}
17+
1618
buildTypes {
1719
release {
1820
minifyEnabled false
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Needed for injection
2+
-keep class * extends androidx.lifecycle.ViewModel { *; }

mini-rx2-android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
versionName android_version_name
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17-
consumerProguardFiles 'consumer-rules.pro'
17+
consumerProguardFiles "mini-rx2-android.pro"
1818
}
1919

2020
buildTypes {

mini-rx2/src/main/resources/META-INF/proguard/mini-rx2.pro

Whitespace-only changes.

0 commit comments

Comments
 (0)