<NME> build.gradle
<BEF> import com.github.spotbugs.SpotBugsTask

import java.nio.file.Files

apply plugin: "com.android.application"
apply plugin: "com.github.spotbugs"
apply plugin: "pmd"
apply plugin: 'com.google.protobuf'

def ABORT_ON_CHECK_FAILURE = false

tasks.withType(Test) {
    systemProperty "MiFirmwareDir", System.getProperty("MiFirmwareDir", null)
    systemProperty "logback.configurationFile", System.getProperty("user.dir", null) + "/app/src/main/assets/logback.xml"
    systemProperty "GB_LOGFILES_DIR", Files.createTempDirectory("gblog").toString()
}
def getVersionCode = { ->
    try {
        def stdout = new ByteArrayOutputStream()
        exec {
            commandLine 'git', 'rev-list', 'HEAD', '--count'
            standardOutput = stdout
        }
        return Integer.valueOf(stdout.toString().trim())
        targetSdkVersion 27

        // Note: always bump BOTH versionCode and versionName!
        versionName "0.40.0"
        versionCode 163
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        exec {
            commandLine 'git', 'rev-parse', '--short', 'HEAD'
            standardOutput = stdout
        }
        return stdout.toString().trim()
    } catch (ignored){
        return null
    }
}

android {
    compileOptions {
        // for Android 5+
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    compileSdkVersion 29
    buildToolsVersion "31.0.0"

    defaultConfig {
        applicationId "nodomain.freeyourgadget.gadgetbridge"
        minSdkVersion 21
        targetSdkVersion 29

        // Note: always bump BOTH versionCode and versionName!
        versionName "0.71.0"
        versionCode 216
        vectorDrawables.useSupportLibrary = true
        buildConfigField "String", "GIT_HASH_SHORT", "\"${getGitHashShort()}\""
        buildConfigField "boolean", "INTERNET_ACCESS", "false"
        resValue "string", "pebble_content_provider", "com.getpebble.android.provider"
        resValue "string", "app_name", "@string/application_name_generic"
        resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_generic"
        resValue "string", "about_activity_title", "@string/about_activity_title_generic"
        resValue "string", "about_description", "@string/about_description_generic"
        resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_generic"
    }
    signingConfigs {
        nightly {
            if (System.getProperty("nightly_store_file") != null) {
                storeFile file(System.getProperty("nightly_store_file"))
                storePassword System.getProperty("nightly_store_password")
                keyAlias System.getProperty("nightly_key_alias")
                keyPassword System.getProperty("nightly_key_password")
            }
        }
    }

    flavorDimensions "device_type"
    productFlavors {
        main {
            // Ensure that when starting from scratch, 'main' is selected, not 'banglejs'
            getIsDefault().set(true)
            // the default build product flavor
            dimension "device_type"
            //applicationIdSuffix ""
            //versionNameSuffix ""
        }
        banglejs {
            dimension "device_type"
            applicationId "com.espruino.gadgetbridge"
            applicationIdSuffix ".banglejs"
            versionNameSuffix "-banglejs"
            buildConfigField "boolean", "INTERNET_ACCESS", "true"
            // Disable pebble provider to allow Bangle.js Gadgetbridge to coexist with Gadgetbridge
            resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.bangle.provider"
            resValue "string", "app_name", "@string/application_name_banglejs_main"
            resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_banglejs_main"
            resValue "string", "about_activity_title", "@string/about_activity_title_banglejs_main"
            resValue "string", "about_description", "@string/about_description_banglejs_main"
            resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_banglejs_main"
            targetSdkVersion 30 // Bangle.js flavor only - We need SDK 30 for play store
            // Note: app/src/banglejs/AndroidManifest.xml contains some extra permissions we need to make SDK 30 work
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            resValue "string", "pebble_content_provider", "com.getpebble.android.provider"
        }

        nightly {
            applicationIdSuffix ".nightly"
            versionNameSuffix "-${getGitHashShort}"
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            resValue "string", "pebble_content_provider", "com.getpebble.android.provider"
            resValue "string", "app_name", "@string/application_name_main_nightly"
            resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_main_nightly"
            resValue "string", "about_activity_title", "@string/about_activity_title_main_nightly"
            resValue "string", "about_description", "@string/about_description_main_nightly"
            resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_main_nightly"
            
            debuggable true

            if (System.getProperty("nightly_store_file") != null) {
                signingConfig signingConfigs.nightly

                //this was conflicting with regular debug type (it should not), so it is only available for CI builds:
                productFlavors.main.resValue "string", "pebble_content_provider", "com.getpebble.android.provider"
                productFlavors.main.resValue "string", "app_name", "@string/application_name_main_nightly"
                productFlavors.main.resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_main_nightly"
                productFlavors.main.resValue "string", "about_activity_title", "@string/about_activity_title_main_nightly"
                productFlavors.main.resValue "string", "about_description", "@string/about_description_main_nightly"
                productFlavors.main.resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_main_nightly"
                
                //keep the pebble provider for people who want this. In case of need we can create Banglejs Nopebble
                productFlavors.banglejs.resValue "string", "pebble_content_provider", "com.getpebble.android.provider"
                productFlavors.banglejs.resValue "string", "app_name", "@string/application_name_banglejs_nightly"
                productFlavors.banglejs.resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_banglejs_nightly"
                productFlavors.banglejs.resValue "string", "about_activity_title", "@string/about_activity_title_banglejs_nightly"
                productFlavors.banglejs.resValue "string", "about_description", "@string/about_description_banglejs_nightly"
                productFlavors.banglejs.resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_banglejs_nightly"
            } else {
                signingConfig signingConfigs.debug
            }
        }
        nopebble {
            applicationIdSuffix ".nightly_nopebble"
            versionNameSuffix "-${getGitHashShort}"
            minifyEnabled true
            if (System.getProperty("nightly_store_file") != null) {
                signingConfig signingConfigs.nightly
            } else {
                signingConfig signingConfigs.debug
            }
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.provider"
            resValue "string", "app_name", "@string/application_name_main_nopebble"
            resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_main_nopebble"
            resValue "string", "about_activity_title", "@string/about_activity_title_main_nopebble"
            resValue "string", "about_description", "@string/about_description_main_nopebble"
            resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_main_nopebble"
            debuggable true
        }

        applicationVariants.all { variant ->
            variant.resValue "string", "applicationId", variant.applicationId

            if (variant.buildType.name == 'nightly' || variant.buildType.name == 'nopebble') {
                variant.outputs.all {
                    setVersionCodeOverride(getVersionCode())
                    //setVersionNameOverride(getGitHashShort())
                    setVersionNameOverride(variant.versionName)
                    outputFileName = "${applicationId}_${variant.versionName}.apk"
                }
            }
        }

    }


    lintOptions {
        abortOnError ABORT_ON_CHECK_FAILURE
        lintConfig file("${project.rootDir}/config/lint/lint.xml")
// If true, generate an HTML report (with issue explanations, sourcecode, etc)
        htmlReport true
// Optional path to report (default will be lint-results.html in the builddir)
        htmlOutput file("$project.buildDir/reports/lint/lint.html")
    }

    testOptions {
        unitTests {
            returnDefaultValues = true
            includeAndroidResources = true
        }
    }
}

pmd {
    toolVersion = "5.5.5"
}

dependencies {
//    testImplementation "ch.qos.logback:logback-classic:1.1.3"
//    testImplementation "ch.qos.logback:logback-core:1.1.3"
    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    testImplementation "junit:junit:4.13.2"
    testImplementation "org.mockito:mockito-core:1.10.19"
    testImplementation "org.robolectric:robolectric:4.8.2"
    testImplementation "org.hamcrest:hamcrest-library:1.3"
    testImplementation "com.google.code.gson:gson:2.8.6"

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "androidx.appcompat:appcompat:1.3.1"
    implementation "androidx.preference:preference:1.1.1"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation "androidx.legacy:legacy-support-v4:1.0.0"
    implementation "androidx.gridlayout:gridlayout:1.0.0"
    implementation "androidx.palette:palette:1.0.0"

    implementation "com.google.android.material:material:1.4.0"
    implementation 'com.google.android.flexbox:flexbox:3.0.0'
    implementation "com.google.code.gson:gson:2.8.6"

    implementation "no.nordicsemi.android:dfu:1.11.1"
    implementation("com.github.tony19:logback-android:2.0.0") {
        exclude group: "com.google.android", module: "android"
    }
    implementation "org.slf4j:slf4j-api:1.7.36"
    implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
    implementation "com.github.pfichtner:durationformatter:0.1.1"
    implementation "de.cketti.library.changelog:ckchangelog:1.2.2"
    implementation "net.e175.klaus:solarpositioning:0.0.9"
    implementation "co.nstant.in:cbor:0.9"
    // use pristine greendao instead of our custom version, since our custom jitpack-packaged
    // version contains way too much and our custom patches are in the generator only.
    implementation "org.greenrobot:greendao:2.2.1"
    implementation "org.apache.commons:commons-lang3:3.7"
    implementation "org.cyanogenmod:platform.sdk:6.0"
    implementation 'com.jaredrummler:colorpicker:1.0.2'
//    implementation project(":DaoCore")
    implementation 'com.github.wax911:android-emojify:0.1.7'
    implementation 'com.google.protobuf:protobuf-javalite:3.10.0'
    implementation 'com.android.volley:volley:1.2.1'
    implementation 'androidx.core:core-google-shortcuts:1.0.1'

    // JSR-310 timezones backport for Android, since we're still API 21
    implementation 'com.jakewharton.threetenabp:threetenabp:1.4.0'
    testImplementation 'org.threeten:threetenbp:1.6.0'

    // Android SDK bundles org.json, but we need an actual implementation to replace the stubs in tests
    testImplementation 'org.json:json:20180813'
}

preBuild.dependsOn(":GBDaoGenerator:genSources")

gradle.beforeProject {
    preBuild.dependsOn(":GBDaoGenerator:genSources")
}

check.dependsOn "spotbugsMain", "pmd", "lint"

task pmd(type: Pmd) {
    ruleSetFiles = files("${project.rootDir}/config/pmd/pmd-ruleset.xml")
    ignoreFailures = !ABORT_ON_CHECK_FAILURE
    ruleSets = [
            "java-android",
            "java-basic",
            "java-braces",
            "java-clone",
            "java-codesize",
            "java-controversial",
            "java-coupling",
            "java-design",
            "java-empty",
            "java-finalizers",
            "java-imports",
            "java-junit",
            "java-optimizations",
            "java-strictexception",
            "java-strings",
            "java-sunsecure",
            "java-typeresolution",
            "java-unnecessary",
            "java-unusedcode"
    ]

    source "src"
    include "**/*.java"
    exclude "**/gen/**"

    reports {
        xml.enabled = false
        html.enabled = true
        xml {
            destination file("$project.buildDir/reports/pmd/pmd.xml")
        }
        html {
            destination file("$project.buildDir/reports/pmd/pmd.html")
        }
    }
}

// this is just for spotbugs to let the plugin create the task
sourceSets {
    main {
        main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite"
    }
}

spotbugs {
    toolVersion = "3.1.12"
    ignoreFailures = !ABORT_ON_CHECK_FAILURE
    effort = "default"
    reportLevel = "medium"
}

tasks.withType(SpotBugsTask) {
    source = fileTree('src/main/java')
    classes = files("${project.rootDir}/app/build/intermediates/javac/debug/classes")
    excludeFilter = new File("${project.rootDir}/config/findbugs/findbugs-filter.xml")
    reports {
        xml.enabled = false
        html.enabled = true
        xml {
            destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.xml")
        }
        html {
            destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.html")
        }
    }
}

task cleanGenerated(type: Delete) {
    delete fileTree('src/main/java/nodomain/freeyourgadget/gadgetbridge/proto') {
        include '**/*.java'
    }
    delete fileTree('src/main/java/nodomain/freeyourgadget/gadgetbridge/entities') {
        include '**/*.java'
        exclude '**/Abstract*.java'
    }
}

tasks.clean.dependsOn(tasks.cleanGenerated)

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.10.0'
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option 'lite'
                    // Uncomment this to get Android Studio to recognize the generated files
                    // this makes it think that all src files are generated though...
                    //outputSubDir = '../../../../../src/main/java/'
                }
            }
        }
    }
}

<MSG> bump version, add changelog (WIP)

<DFF> @@ -25,8 +25,8 @@ android {
         targetSdkVersion 27
 
         // Note: always bump BOTH versionCode and versionName!
-        versionName "0.40.0"
-        versionCode 163
+        versionName "0.40.1"
+        versionCode 164
         vectorDrawables.useSupportLibrary = true
     }
     buildTypes {

{'commit': 'diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 36915e781..a490d1cac 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -1,5 +1,10 @@\n ### Changelog\n \n+#### Version 0.40.1 (WIP)\n+* Mi Band/Amazfit: Recogize changes when toggling alarm on device (immediately when connected, else when connecting)\n+* Mi Band/Amazfit: Fix some bugs with stuck connection when re-connecting\n+* Mi Band 4: Support higher MTU for multiple times faster firmware transfer (probably also Amazfit GTR/GTS)\n+\n #### Version 0.40.0\n * Fossil Q Hybrid: Initial support\n * Bangle.js: Initial support\ndiff --git a/app/build.gradle b/app/build.gradle\nindex 893e36c2a..67f484af5 100644\n--- a/app/build.gradle\n+++ b/app/build.gradle\n@@ -25,8 +25,8 @@ android {\n         targetSdkVersion 27\n \n         // Note: always bump BOTH versionCode and versionName!\n-        versionName "0.40.0"\n-        versionCode 163\n+        versionName "0.40.1"\n+        versionCode 164\n         vectorDrawables.useSupportLibrary = true\n     }\n     buildTypes {\n', 'commit_subject': 'bump version, add changelog (WIP)', 'repo_name': 'Freeyourgadget/Gadgetbridge', 'committer': {'name': 'Andreas Shimokawa', 'email': 'e9b758b3b65d529f90c3dff46abab5c2f330a3d3@fsfe.org', 'time_sec': '1577484840', 'tz_offset': '60', 'date': {'seconds': '1577484840'}}, 'commit_tree': '899321010488c6af5ff52a7a9309463f12dd1023', 'commit_message': 'bump version, add changelog (WIP)\n', 'language_name': 'Shell', 'license': 'agpl-3.0', 'hunks': '@@ -25,8 +25,8 @@ android {\n         targetSdkVersion 27\n \n         // Note: always bump BOTH versionCode and versionName!\n-        versionName "0.40.0"\n-        versionCode 163\n+        versionName "0.40.1"\n+        versionCode 164\n         vectorDrawables.useSupportLibrary = true\n     }\n     buildTypes {\n', 'addition_count': 2, 'deletion_count': 2, 'src_file': 'a/app/build.gradle', 'tgt_file': 'b/app/build.gradle', 'file_extension': '.gradle', 'before_file': 'import com.github.spotbugs.SpotBugsTask\n\nimport java.nio.file.Files\n\napply plugin: "com.android.application"\napply plugin: "com.github.spotbugs"\napply plugin: "pmd"\napply plugin: \'com.google.protobuf\'\n\ndef ABORT_ON_CHECK_FAILURE = false\n\ntasks.withType(Test) {\n    systemProperty "MiFirmwareDir", System.getProperty("MiFirmwareDir", null)\n    systemProperty "logback.configurationFile", System.getProperty("user.dir", null) + "/app/src/main/assets/logback.xml"\n    systemProperty "GB_LOGFILES_DIR", Files.createTempDirectory("gblog").toString()\n}\ndef getVersionCode = { ->\n    try {\n        def stdout = new ByteArrayOutputStream()\n        exec {\n            commandLine \'git\', \'rev-list\', \'HEAD\', \'--count\'\n            standardOutput = stdout\n        }\n        return Integer.valueOf(stdout.toString().trim())\n        targetSdkVersion 27\n\n        // Note: always bump BOTH versionCode and versionName!\n        versionName "0.40.0"\n        versionCode 163\n        vectorDrawables.useSupportLibrary = true\n    }\n    buildTypes {\n        exec {\n            commandLine \'git\', \'rev-parse\', \'--short\', \'HEAD\'\n            standardOutput = stdout\n        }\n        return stdout.toString().trim()\n    } catch (ignored){\n        return null\n    }\n}\n\nandroid {\n    compileOptions {\n        // for Android 5+\n        sourceCompatibility JavaVersion.VERSION_1_8\n        targetCompatibility JavaVersion.VERSION_1_8\n    }\n    compileSdkVersion 29\n    buildToolsVersion "31.0.0"\n\n    defaultConfig {\n        applicationId "nodomain.freeyourgadget.gadgetbridge"\n        minSdkVersion 21\n        targetSdkVersion 29\n\n        // Note: always bump BOTH versionCode and versionName!\n        versionName "0.71.0"\n        versionCode 216\n        vectorDrawables.useSupportLibrary = true\n        buildConfigField "String", "GIT_HASH_SHORT", "\\"${getGitHashShort()}\\""\n        buildConfigField "boolean", "INTERNET_ACCESS", "false"\n        resValue "string", "pebble_content_provider", "com.getpebble.android.provider"\n        resValue "string", "app_name", "@string/application_name_generic"\n        resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_generic"\n        resValue "string", "about_activity_title", "@string/about_activity_title_generic"\n        resValue "string", "about_description", "@string/about_description_generic"\n        resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_generic"\n    }\n    signingConfigs {\n        nightly {\n            if (System.getProperty("nightly_store_file") != null) {\n                storeFile file(System.getProperty("nightly_store_file"))\n                storePassword System.getProperty("nightly_store_password")\n                keyAlias System.getProperty("nightly_key_alias")\n                keyPassword System.getProperty("nightly_key_password")\n            }\n        }\n    }\n\n    flavorDimensions "device_type"\n    productFlavors {\n        main {\n            // Ensure that when starting from scratch, \'main\' is selected, not \'banglejs\'\n            getIsDefault().set(true)\n            // the default build product flavor\n            dimension "device_type"\n            //applicationIdSuffix ""\n            //versionNameSuffix ""\n        }\n        banglejs {\n            dimension "device_type"\n            applicationId "com.espruino.gadgetbridge"\n            applicationIdSuffix ".banglejs"\n            versionNameSuffix "-banglejs"\n            buildConfigField "boolean", "INTERNET_ACCESS", "true"\n            // Disable pebble provider to allow Bangle.js Gadgetbridge to coexist with Gadgetbridge\n            resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.bangle.provider"\n            resValue "string", "app_name", "@string/application_name_banglejs_main"\n            resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_banglejs_main"\n            resValue "string", "about_activity_title", "@string/about_activity_title_banglejs_main"\n            resValue "string", "about_description", "@string/about_description_banglejs_main"\n            resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_banglejs_main"\n            targetSdkVersion 30 // Bangle.js flavor only - We need SDK 30 for play store\n            // Note: app/src/banglejs/AndroidManifest.xml contains some extra permissions we need to make SDK 30 work\n        }\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled true\n            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"\n            resValue "string", "pebble_content_provider", "com.getpebble.android.provider"\n        }\n\n        nightly {\n            applicationIdSuffix ".nightly"\n            versionNameSuffix "-${getGitHashShort}"\n            minifyEnabled true\n            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"\n            resValue "string", "pebble_content_provider", "com.getpebble.android.provider"\n            resValue "string", "app_name", "@string/application_name_main_nightly"\n            resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_main_nightly"\n            resValue "string", "about_activity_title", "@string/about_activity_title_main_nightly"\n            resValue "string", "about_description", "@string/about_description_main_nightly"\n            resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_main_nightly"\n            \n            debuggable true\n\n            if (System.getProperty("nightly_store_file") != null) {\n                signingConfig signingConfigs.nightly\n\n                //this was conflicting with regular debug type (it should not), so it is only available for CI builds:\n                productFlavors.main.resValue "string", "pebble_content_provider", "com.getpebble.android.provider"\n                productFlavors.main.resValue "string", "app_name", "@string/application_name_main_nightly"\n                productFlavors.main.resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_main_nightly"\n                productFlavors.main.resValue "string", "about_activity_title", "@string/about_activity_title_main_nightly"\n                productFlavors.main.resValue "string", "about_description", "@string/about_description_main_nightly"\n                productFlavors.main.resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_main_nightly"\n                \n                //keep the pebble provider for people who want this. In case of need we can create Banglejs Nopebble\n                productFlavors.banglejs.resValue "string", "pebble_content_provider", "com.getpebble.android.provider"\n                productFlavors.banglejs.resValue "string", "app_name", "@string/application_name_banglejs_nightly"\n                productFlavors.banglejs.resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_banglejs_nightly"\n                productFlavors.banglejs.resValue "string", "about_activity_title", "@string/about_activity_title_banglejs_nightly"\n                productFlavors.banglejs.resValue "string", "about_description", "@string/about_description_banglejs_nightly"\n                productFlavors.banglejs.resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_banglejs_nightly"\n            } else {\n                signingConfig signingConfigs.debug\n            }\n        }\n        nopebble {\n            applicationIdSuffix ".nightly_nopebble"\n            versionNameSuffix "-${getGitHashShort}"\n            minifyEnabled true\n            if (System.getProperty("nightly_store_file") != null) {\n                signingConfig signingConfigs.nightly\n            } else {\n                signingConfig signingConfigs.debug\n            }\n            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"\n            resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.provider"\n            resValue "string", "app_name", "@string/application_name_main_nopebble"\n            resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_main_nopebble"\n            resValue "string", "about_activity_title", "@string/about_activity_title_main_nopebble"\n            resValue "string", "about_description", "@string/about_description_main_nopebble"\n            resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_main_nopebble"\n            debuggable true\n        }\n\n        applicationVariants.all { variant ->\n            variant.resValue "string", "applicationId", variant.applicationId\n\n            if (variant.buildType.name == \'nightly\' || variant.buildType.name == \'nopebble\') {\n                variant.outputs.all {\n                    setVersionCodeOverride(getVersionCode())\n                    //setVersionNameOverride(getGitHashShort())\n                    setVersionNameOverride(variant.versionName)\n                    outputFileName = "${applicationId}_${variant.versionName}.apk"\n                }\n            }\n        }\n\n    }\n\n\n    lintOptions {\n        abortOnError ABORT_ON_CHECK_FAILURE\n        lintConfig file("${project.rootDir}/config/lint/lint.xml")\n// If true, generate an HTML report (with issue explanations, sourcecode, etc)\n        htmlReport true\n// Optional path to report (default will be lint-results.html in the builddir)\n        htmlOutput file("$project.buildDir/reports/lint/lint.html")\n    }\n\n    testOptions {\n        unitTests {\n            returnDefaultValues = true\n            includeAndroidResources = true\n        }\n    }\n}\n\npmd {\n    toolVersion = "5.5.5"\n}\n\ndependencies {\n//    testImplementation "ch.qos.logback:logback-classic:1.1.3"\n//    testImplementation "ch.qos.logback:logback-core:1.1.3"\n    implementation \'com.android.support.constraint:constraint-layout:2.0.4\'\n    testImplementation "junit:junit:4.13.2"\n    testImplementation "org.mockito:mockito-core:1.10.19"\n    testImplementation "org.robolectric:robolectric:4.8.2"\n    testImplementation "org.hamcrest:hamcrest-library:1.3"\n    testImplementation "com.google.code.gson:gson:2.8.6"\n\n    implementation fileTree(dir: "libs", include: ["*.jar"])\n    implementation "androidx.appcompat:appcompat:1.3.1"\n    implementation "androidx.preference:preference:1.1.1"\n    implementation "androidx.cardview:cardview:1.0.0"\n    implementation "androidx.recyclerview:recyclerview:1.2.1"\n    implementation "androidx.legacy:legacy-support-v4:1.0.0"\n    implementation "androidx.gridlayout:gridlayout:1.0.0"\n    implementation "androidx.palette:palette:1.0.0"\n\n    implementation "com.google.android.material:material:1.4.0"\n    implementation \'com.google.android.flexbox:flexbox:3.0.0\'\n    implementation "com.google.code.gson:gson:2.8.6"\n\n    implementation "no.nordicsemi.android:dfu:1.11.1"\n    implementation("com.github.tony19:logback-android:2.0.0") {\n        exclude group: "com.google.android", module: "android"\n    }\n    implementation "org.slf4j:slf4j-api:1.7.36"\n    implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"\n    implementation "com.github.pfichtner:durationformatter:0.1.1"\n    implementation "de.cketti.library.changelog:ckchangelog:1.2.2"\n    implementation "net.e175.klaus:solarpositioning:0.0.9"\n    implementation "co.nstant.in:cbor:0.9"\n    // use pristine greendao instead of our custom version, since our custom jitpack-packaged\n    // version contains way too much and our custom patches are in the generator only.\n    implementation "org.greenrobot:greendao:2.2.1"\n    implementation "org.apache.commons:commons-lang3:3.7"\n    implementation "org.cyanogenmod:platform.sdk:6.0"\n    implementation \'com.jaredrummler:colorpicker:1.0.2\'\n//    implementation project(":DaoCore")\n    implementation \'com.github.wax911:android-emojify:0.1.7\'\n    implementation \'com.google.protobuf:protobuf-javalite:3.10.0\'\n    implementation \'com.android.volley:volley:1.2.1\'\n    implementation \'androidx.core:core-google-shortcuts:1.0.1\'\n\n    // JSR-310 timezones backport for Android, since we\'re still API 21\n    implementation \'com.jakewharton.threetenabp:threetenabp:1.4.0\'\n    testImplementation \'org.threeten:threetenbp:1.6.0\'\n\n    // Android SDK bundles org.json, but we need an actual implementation to replace the stubs in tests\n    testImplementation \'org.json:json:20180813\'\n}\n\npreBuild.dependsOn(":GBDaoGenerator:genSources")\n\ngradle.beforeProject {\n    preBuild.dependsOn(":GBDaoGenerator:genSources")\n}\n\ncheck.dependsOn "spotbugsMain", "pmd", "lint"\n\ntask pmd(type: Pmd) {\n    ruleSetFiles = files("${project.rootDir}/config/pmd/pmd-ruleset.xml")\n    ignoreFailures = !ABORT_ON_CHECK_FAILURE\n    ruleSets = [\n            "java-android",\n            "java-basic",\n            "java-braces",\n            "java-clone",\n            "java-codesize",\n            "java-controversial",\n            "java-coupling",\n            "java-design",\n            "java-empty",\n            "java-finalizers",\n            "java-imports",\n            "java-junit",\n            "java-optimizations",\n            "java-strictexception",\n            "java-strings",\n            "java-sunsecure",\n            "java-typeresolution",\n            "java-unnecessary",\n            "java-unusedcode"\n    ]\n\n    source "src"\n    include "**/*.java"\n    exclude "**/gen/**"\n\n    reports {\n        xml.enabled = false\n        html.enabled = true\n        xml {\n            destination file("$project.buildDir/reports/pmd/pmd.xml")\n        }\n        html {\n            destination file("$project.buildDir/reports/pmd/pmd.html")\n        }\n    }\n}\n\n// this is just for spotbugs to let the plugin create the task\nsourceSets {\n    main {\n        main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite"\n    }\n}\n\nspotbugs {\n    toolVersion = "3.1.12"\n    ignoreFailures = !ABORT_ON_CHECK_FAILURE\n    effort = "default"\n    reportLevel = "medium"\n}\n\ntasks.withType(SpotBugsTask) {\n    source = fileTree(\'src/main/java\')\n    classes = files("${project.rootDir}/app/build/intermediates/javac/debug/classes")\n    excludeFilter = new File("${project.rootDir}/config/findbugs/findbugs-filter.xml")\n    reports {\n        xml.enabled = false\n        html.enabled = true\n        xml {\n            destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.xml")\n        }\n        html {\n            destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.html")\n        }\n    }\n}\n\ntask cleanGenerated(type: Delete) {\n    delete fileTree(\'src/main/java/nodomain/freeyourgadget/gadgetbridge/proto\') {\n        include \'**/*.java\'\n    }\n    delete fileTree(\'src/main/java/nodomain/freeyourgadget/gadgetbridge/entities\') {\n        include \'**/*.java\'\n        exclude \'**/Abstract*.java\'\n    }\n}\n\ntasks.clean.dependsOn(tasks.cleanGenerated)\n\nprotobuf {\n    protoc {\n        artifact = \'com.google.protobuf:protoc:3.10.0\'\n    }\n    generateProtoTasks {\n        all().each { task ->\n            task.builtins {\n                java {\n                    option \'lite\'\n                    // Uncomment this to get Android Studio to recognize the generated files\n                    // this makes it think that all src files are generated though...\n                    //outputSubDir = \'../../../../../src/main/java/\'\n                }\n            }\n        }\n    }\n}\n', 'message': 'bump version, add changelog (WIP)\n', 'author_name': 'Andreas Shimokawa', 'lang': 'gradle'}