Add nightly build variant

This commit is contained in:
MM20 2023-01-30 20:32:30 +01:00
parent 36d917c124
commit 0efd25b919
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
6 changed files with 32 additions and 41 deletions

View File

@ -1,4 +1,6 @@
import android.annotation.SuppressLint
import java.time.LocalDate
import java.time.format.DateTimeFormatter
plugins {
id("com.android.application")
@ -45,6 +47,12 @@ android {
// This somehow seems to resolve that issue.
isDebuggable = false
}
create("nightly") {
initWith(getByName("release"))
matchingFallbacks += "release"
applicationIdSuffix = ".nightly"
versionNameSuffix = "-${LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))}-nightly"
}
flavorDimensions += "variant"
productFlavors {

View File

@ -1,21 +0,0 @@
package de.mm20.launcher2.debug
import android.os.StrictMode
import android.util.Log
class Debug {
init {
Log.d("MM20", "MM20Launcher2 is running in debug mode.")
StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build())
StrictMode.setVmPolicy(StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.build())
}
companion object {
const val DEBUG_MODE = true
}
}

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="debug">true</bool>
</resources>

View File

@ -13,7 +13,6 @@ import de.mm20.launcher2.calculator.calculatorModule
import de.mm20.launcher2.calendar.calendarModule
import de.mm20.launcher2.contacts.contactsModule
import de.mm20.launcher2.data.customattrs.customAttrsModule
import de.mm20.launcher2.debug.Debug
import de.mm20.launcher2.favorites.favoritesModule
import de.mm20.launcher2.files.filesModule
import de.mm20.launcher2.icons.iconsModule
@ -24,6 +23,7 @@ import de.mm20.launcher2.websites.websitesModule
import de.mm20.launcher2.widgets.widgetsModule
import de.mm20.launcher2.wikipedia.wikipediaModule
import de.mm20.launcher2.database.databaseModule
import de.mm20.launcher2.debug.initDebugMode
import de.mm20.launcher2.globalactions.globalActionsModule
import de.mm20.launcher2.notifications.notificationsModule
import de.mm20.launcher2.permissions.permissionsModule
@ -46,7 +46,8 @@ class LauncherApplication : Application(), CoroutineScope, ImageLoaderFactory {
override fun onCreate() {
super.onCreate()
Debug()
if (BuildConfig.BUILD_TYPE == "debug") initDebugMode()
startKoin {
androidLogger(if (BuildConfig.DEBUG) Level.ERROR else Level.NONE)

View File

@ -0,0 +1,21 @@
package de.mm20.launcher2.debug
import android.os.StrictMode
import android.util.Log
// This class does nothing in release builds
fun initDebugMode() {
Log.d("MM20", "MM20Launcher2 is running in debug mode.")
StrictMode.setThreadPolicy(
StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build()
)
StrictMode.setVmPolicy(
StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.build()
)
}

View File

@ -1,14 +0,0 @@
package de.mm20.launcher2.debug
import android.content.Context
import android.content.res.Resources
import android.os.StrictMode
import android.util.Log
import de.mm20.launcher2.R
// This class does nothing in release builds
class Debug() {
companion object {
const val DEBUG_MODE = false
}
}