-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(android): enable minify on release, add proguard rules (#6257)
- Loading branch information
1 parent
7258a64
commit bef4ef5
Showing
16 changed files
with
87 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"cli.rs": patch | ||
"cli.js": patch | ||
--- | ||
|
||
Change the Android template to enable minification on release and pull ProGuard rules from proguard-tauri.pro. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"tauri": patch | ||
--- | ||
|
||
Inject `proguard-tauri.pro` file in the Android project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
# 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 | ||
-keep class app.tauri.** { | ||
@app.tauri.JniMethod public <methods>; | ||
} | ||
|
||
# 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 *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile | ||
-keep class app.tauri.JSArray,app.tauri.JSObject { | ||
public <init>(...); | ||
} |
4 changes: 4 additions & 0 deletions
4
core/tauri/mobile/android/src/main/java/app/tauri/JniMethod.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package app.tauri | ||
|
||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class JniMethod() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
core/tauri/mobile/android/src/main/java/app/tauri/plugin/TauriPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package app.tauri.plugin | ||
|
||
@Retention(AnnotationRetention.RUNTIME) | ||
annotation class TauriPlugin() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
|
||
-keep class $PACKAGE.TauriActivity { | ||
getAppClass(...); | ||
getVersion(); | ||
} | ||
|
||
-keep class $PACKAGE.RustWebView { | ||
public <init>(...); | ||
loadUrlMainThread(...); | ||
} | ||
|
||
-keep class $PACKAGE.Ipc { | ||
public <init>(...); | ||
@android.webkit.JavascriptInterface public <methods>; | ||
} | ||
|
||
-keep class $PACKAGE.RustWebChromeClient,$PACKAGE.RustWebViewClient { | ||
public <init>(...); | ||
} | ||
|
||
-keep class $PACKAGE.MainActivity { | ||
public getPluginManager(); | ||
} | ||
|
||
-keep @app.tauri.plugin.TauriPlugin public class * { | ||
@app.tauri.plugin.PluginMethod public <methods>; | ||
public <init>(...); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters