mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
adjust build and add a variant that doesn't allow user-added libraries
This commit is contained in:
parent
53022afdab
commit
978d76ed7c
6 changed files with 39 additions and 52 deletions
|
@ -15,21 +15,27 @@ android {
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||||
}
|
}
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
//shrinkResources true todo: test before enabling, a lot of resources are accessed via getIdentifier and possibly not all have been marked with "keep"
|
shrinkResources true
|
||||||
|
debuggable false
|
||||||
|
jniDebuggable false
|
||||||
|
renderscriptDebuggable false
|
||||||
|
}
|
||||||
|
nouserlib { // same as release, but does not allow the user to provide a library
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
debuggable false
|
debuggable false
|
||||||
jniDebuggable false
|
jniDebuggable false
|
||||||
renderscriptDebuggable false
|
renderscriptDebuggable false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'src/main/proguard.flags'
|
|
||||||
}
|
}
|
||||||
debug {
|
debug {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
jniDebuggable false
|
jniDebuggable false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'src/main/proguard.flags'
|
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
}
|
}
|
||||||
archivesBaseName = "openboard_" + defaultConfig.versionName
|
archivesBaseName = "openboard_" + defaultConfig.versionName
|
||||||
|
@ -82,7 +88,7 @@ dependencies {
|
||||||
implementation 'androidx.preference:preference:1.2.1' // includes appcompat
|
implementation 'androidx.preference:preference:1.2.1' // includes appcompat
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.3.2'
|
implementation 'androidx.recyclerview:recyclerview:1.3.2'
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.1"
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
|
||||||
implementation 'com.github.martin-stone:hsv-alpha-color-picker-android:3.1.0'
|
implementation 'com.github.martin-stone:hsv-alpha-color-picker-android:3.1.0'
|
||||||
implementation 'androidx.autofill:autofill:1.1.0'
|
implementation 'androidx.autofill:autofill:1.1.0'
|
||||||
|
|
||||||
|
|
40
app/proguard-rules.pro
vendored
40
app/proguard-rules.pro
vendored
|
@ -1,17 +1,27 @@
|
||||||
# Add project specific ProGuard rules here.
|
# Keep classes and methods that have the @UsedForTesting annotation
|
||||||
# By default, the flags in this file are appended to flags specified
|
-keep @helium314.keyboard.annotations.UsedForTesting class *
|
||||||
# in /home/iwo/android-sdk/tools/proguard/proguard-android.txt
|
-keepclassmembers class * {
|
||||||
# You can edit the include path and order by changing the proguardFiles
|
@helium314.keyboard.annotations.UsedForTesting *;
|
||||||
# directive in build.gradle.
|
}
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# Add any project specific keep options here:
|
# Keep classes and methods that have the @ExternallyReferenced annotation
|
||||||
|
-keep @helium314.keyboard.annotations.ExternallyReferenced class *
|
||||||
|
-keepclassmembers class * {
|
||||||
|
@helium314.keyboard.annotations.ExternallyReferenced *;
|
||||||
|
}
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
# Keep native methods
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
-keepclassmembers class * {
|
||||||
# class:
|
native <methods>;
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
}
|
||||||
# public *;
|
|
||||||
#}
|
# Keep classes that are used as a parameter type of methods that are also marked as keep
|
||||||
|
# to preserve changing those methods' signature.
|
||||||
|
-keep class helium314.keyboard.latin.Dictionary
|
||||||
|
-keep class helium314.keyboard.latin.NgramContext
|
||||||
|
-keep class helium314.keyboard.latin.makedict.ProbabilityInfo
|
||||||
|
-keep class helium314.keyboard.latin.utils.LanguageModelParam
|
||||||
|
|
||||||
|
# after upgrading to gradle 8, stack traces contain "unknown source"
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
-dontobfuscate
|
||||||
|
|
|
@ -18,8 +18,6 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* KeyboardLayout maintains the keyboard layout information.
|
* KeyboardLayout maintains the keyboard layout information.
|
||||||
*/
|
*/
|
||||||
// todo: this seems completely unused, see whether it can be removed, or re-purposed to contain
|
|
||||||
// some useful information about the layout (currently that's in KeyboardParser.LayoutInfos)
|
|
||||||
public class KeyboardLayout {
|
public class KeyboardLayout {
|
||||||
|
|
||||||
private final int[] mKeyCodes;
|
private final int[] mKeyCodes;
|
||||||
|
|
|
@ -117,6 +117,9 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
removePreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON)
|
removePreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON)
|
||||||
}
|
}
|
||||||
|
if (BuildConfig.BUILD_TYPE == "nouserlib") {
|
||||||
|
removePreference("load_gesture_library")
|
||||||
|
}
|
||||||
setupKeyLongpressTimeoutSettings()
|
setupKeyLongpressTimeoutSettings()
|
||||||
findPreference<Preference>("load_gesture_library")?.setOnPreferenceClickListener { onClickLoadLibrary() }
|
findPreference<Preference>("load_gesture_library")?.setOnPreferenceClickListener { onClickLoadLibrary() }
|
||||||
findPreference<Preference>("backup_restore")?.setOnPreferenceClickListener { showBackupRestoreDialog() }
|
findPreference<Preference>("backup_restore")?.setOnPreferenceClickListener { showBackupRestoreDialog() }
|
||||||
|
|
|
@ -57,7 +57,7 @@ public final class JniUtils {
|
||||||
if (app != null) // use the actual path if possible
|
if (app != null) // use the actual path if possible
|
||||||
filesDir = app.getFilesDir().getAbsolutePath();
|
filesDir = app.getFilesDir().getAbsolutePath();
|
||||||
final File userSuppliedLibrary = new File(filesDir + File.separator + JNI_LIB_IMPORT_FILE_NAME);
|
final File userSuppliedLibrary = new File(filesDir + File.separator + JNI_LIB_IMPORT_FILE_NAME);
|
||||||
if (userSuppliedLibrary.exists()) {
|
if (!BuildConfig.BUILD_TYPE.equals("nouserlib") && userSuppliedLibrary.exists()) {
|
||||||
String wantedChecksum = expectedDefaultChecksum();
|
String wantedChecksum = expectedDefaultChecksum();
|
||||||
try {
|
try {
|
||||||
if (app != null) {
|
if (app != null) {
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Keep classes and methods that have the @UsedForTesting annotation
|
|
||||||
-keep @helium314.keyboard.annotations.UsedForTesting class *
|
|
||||||
-keepclassmembers class * {
|
|
||||||
@helium314.keyboard.annotations.UsedForTesting *;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Keep classes and methods that have the @ExternallyReferenced annotation
|
|
||||||
-keep @helium314.keyboard.annotations.ExternallyReferenced class *
|
|
||||||
-keepclassmembers class * {
|
|
||||||
@helium314.keyboard.annotations.ExternallyReferenced *;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Keep native methods
|
|
||||||
-keepclassmembers class * {
|
|
||||||
native <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Keep classes that are used as a parameter type of methods that are also marked as keep
|
|
||||||
# to preserve changing those methods' signature.
|
|
||||||
-keep class helium314.keyboard.latin.Dictionary
|
|
||||||
-keep class helium314.keyboard.latin.NgramContext
|
|
||||||
-keep class helium314.keyboard.latin.makedict.ProbabilityInfo
|
|
||||||
-keep class helium314.keyboard.latin.utils.LanguageModelParam
|
|
||||||
|
|
||||||
# TODO: remove once used in code.
|
|
||||||
-keep class helium314.keyboard.keyboard.KeyboardLayout { *; }
|
|
||||||
|
|
||||||
# after upgrading to gradle 8, stack traces contain "unknown source", which is horribly bad making them rather useless
|
|
||||||
-keepattributes SourceFile,LineNumberTable
|
|
||||||
-dontobfuscate
|
|
Loading…
Add table
Add a link
Reference in a new issue