From 1b6e291370cb8e813aff24bcb1a606521307f256 Mon Sep 17 00:00:00 2001 From: Kaoru Shoji <0x0badc0de@gmail.com> Date: Mon, 8 Apr 2024 18:56:39 +0900 Subject: [PATCH] Add proguard configuration --- MIDIDriver/build.gradle | 15 +++++++++++++++ MIDIDriver/proguard-rules.pro | 32 ++++++++++++++++++++++++++++++++ build.gradle | 2 +- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 MIDIDriver/proguard-rules.pro diff --git a/MIDIDriver/build.gradle b/MIDIDriver/build.gradle index 77bab7c..d2434b5 100644 --- a/MIDIDriver/build.gradle +++ b/MIDIDriver/build.gradle @@ -51,6 +51,21 @@ android { release.setRoot('build-types/release') } + defaultConfig { + consumerProguardFiles 'proguard-rules.pro' + } + + buildTypes { + debug { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + publishing { singleVariant('release') { withSourcesJar() diff --git a/MIDIDriver/proguard-rules.pro b/MIDIDriver/proguard-rules.pro new file mode 100644 index 0000000..99a1099 --- /dev/null +++ b/MIDIDriver/proguard-rules.pro @@ -0,0 +1,32 @@ +-keep public class jp.kshoji.driver.midi.** { + public protected *; +} +-keep public class jp.kshoji.driver.usb.util.** { + public protected *; +} +-keep public class jp.kshoji.javax.sound.midi.** { + public protected *; +} +-keep public class jp.kshoji.unity.midi.** { + public protected *; +} + +-keepparameternames +-renamesourcefileattribute SourceFile +-keepattributes Signature,Exceptions,*Annotation*, + InnerClasses,PermittedSubclasses,EnclosingMethod, + Deprecated,SourceFile,LineNumberTable + +-keepclassmembers,allowoptimization enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keepclassmembers class * implements java.io.Serializable { + static final long serialVersionUID; + private static final java.io.ObjectStreamField[] serialPersistentFields; + private void writeObject(java.io.ObjectOutputStream); + private void readObject(java.io.ObjectInputStream); + java.lang.Object writeReplace(); + java.lang.Object readResolve(); +} diff --git a/build.gradle b/build.gradle index 109ff5e..e0b7d16 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.3.0' + classpath 'com.android.tools.build:gradle:8.3.1' } }