2021-07-29 18:09:15 +02:00
|
|
|
import com.github.spotbugs.SpotBugsTask
|
|
|
|
|
|
|
|
import java.nio.file.Files
|
|
|
|
|
2018-03-20 18:44:23 +01:00
|
|
|
apply plugin: "com.android.application"
|
2019-09-19 22:31:49 +02:00
|
|
|
apply plugin: "com.github.spotbugs"
|
2018-03-20 18:44:23 +01:00
|
|
|
apply plugin: "pmd"
|
2021-07-20 12:08:12 +02:00
|
|
|
apply plugin: 'com.google.protobuf'
|
2016-08-30 01:25:43 +02:00
|
|
|
|
2018-03-20 18:44:23 +01:00
|
|
|
def ABORT_ON_CHECK_FAILURE = false
|
2015-01-07 14:00:18 +01:00
|
|
|
|
2016-08-30 01:25:43 +02:00
|
|
|
tasks.withType(Test) {
|
2018-03-20 18:44:23 +01:00
|
|
|
systemProperty "MiFirmwareDir", System.getProperty("MiFirmwareDir", null)
|
|
|
|
systemProperty "logback.configurationFile", System.getProperty("user.dir", null) + "/app/src/main/assets/logback.xml"
|
2021-07-29 18:09:15 +02:00
|
|
|
systemProperty "GB_LOGFILES_DIR", Files.createTempDirectory("gblog").toString()
|
2016-08-30 01:25:43 +02:00
|
|
|
}
|
2022-01-27 18:00:22 +01:00
|
|
|
def getVersionCode = { ->
|
|
|
|
try {
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
|
|
|
exec {
|
|
|
|
commandLine 'git', 'rev-list', 'HEAD', '--count'
|
|
|
|
standardOutput = stdout
|
|
|
|
}
|
|
|
|
return Integer.valueOf(stdout.toString().trim())
|
|
|
|
} catch (ignored) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
2016-03-17 23:41:41 +01:00
|
|
|
|
2021-12-30 08:21:37 +01:00
|
|
|
def getGitHashShort = { ->
|
|
|
|
try {
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
|
|
|
exec {
|
|
|
|
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
|
|
|
standardOutput = stdout
|
|
|
|
}
|
|
|
|
return stdout.toString().trim()
|
|
|
|
} catch (ignored){
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-07 14:00:18 +01:00
|
|
|
android {
|
2016-08-26 23:27:53 +02:00
|
|
|
compileOptions {
|
|
|
|
// for KitKat
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_7
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_7
|
|
|
|
}
|
2020-07-19 23:58:21 +02:00
|
|
|
compileSdkVersion 29
|
2021-05-26 13:26:34 +02:00
|
|
|
buildToolsVersion '30.0.2'
|
2015-01-07 14:00:18 +01:00
|
|
|
|
|
|
|
defaultConfig {
|
2016-04-29 23:24:12 +02:00
|
|
|
applicationId "nodomain.freeyourgadget.gadgetbridge"
|
2015-11-23 22:49:11 +01:00
|
|
|
minSdkVersion 19
|
2020-07-19 23:58:21 +02:00
|
|
|
targetSdkVersion 29
|
2021-04-21 16:48:41 +02:00
|
|
|
multiDexEnabled true
|
2015-12-07 18:10:00 +01:00
|
|
|
|
2018-03-20 18:44:23 +01:00
|
|
|
// Note: always bump BOTH versionCode and versionName!
|
2022-01-22 23:39:38 +01:00
|
|
|
versionName "0.65.0"
|
|
|
|
versionCode 209
|
2016-10-21 13:01:30 +02:00
|
|
|
vectorDrawables.useSupportLibrary = true
|
2021-07-20 12:08:12 +02:00
|
|
|
multiDexEnabled true
|
2021-12-30 08:21:37 +01:00
|
|
|
buildConfigField "String", "GIT_HASH_SHORT", "\"${getGitHashShort()}\""
|
2022-02-10 16:49:28 +01:00
|
|
|
buildConfigField "boolean", "INTERNET_ACCESS", "false"
|
2022-01-27 18:00:22 +01:00
|
|
|
resValue "string", "pebble_content_provider", "com.getpebble.android.provider"
|
|
|
|
}
|
|
|
|
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")
|
|
|
|
}
|
|
|
|
}
|
2015-01-07 14:00:18 +01:00
|
|
|
}
|
|
|
|
buildTypes {
|
|
|
|
release {
|
2020-10-11 16:10:35 +02:00
|
|
|
minifyEnabled true
|
2018-03-20 18:44:23 +01:00
|
|
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
2022-01-27 18:00:22 +01:00
|
|
|
resValue "string", "pebble_content_provider", "com.getpebble.android.provider"
|
2015-01-07 14:00:18 +01:00
|
|
|
}
|
2022-01-27 18:00:22 +01:00
|
|
|
|
|
|
|
nightly {
|
|
|
|
applicationIdSuffix ".nightly"
|
|
|
|
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.provider"
|
|
|
|
debuggable true
|
|
|
|
}
|
|
|
|
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"
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-07 14:00:18 +01:00
|
|
|
}
|
2015-08-15 22:36:45 +02:00
|
|
|
|
2022-02-10 16:49:28 +01:00
|
|
|
flavorDimensions "device_type"
|
|
|
|
productFlavors {
|
|
|
|
main {
|
|
|
|
// the default build product flavor
|
|
|
|
dimension "device_type"
|
|
|
|
//applicationIdSuffix ""
|
|
|
|
//versionNameSuffix ""
|
|
|
|
}
|
|
|
|
banglejs {
|
|
|
|
dimension "device_type"
|
|
|
|
applicationIdSuffix ".banglejs"
|
|
|
|
versionNameSuffix "-banglejs"
|
|
|
|
buildConfigField "boolean", "INTERNET_ACCESS", "true"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-15 22:36:45 +02:00
|
|
|
lintOptions {
|
|
|
|
abortOnError ABORT_ON_CHECK_FAILURE
|
|
|
|
lintConfig file("${project.rootDir}/config/lint/lint.xml")
|
2018-03-20 18:44:23 +01:00
|
|
|
// If true, generate an HTML report (with issue explanations, sourcecode, etc)
|
2015-08-15 22:36:45 +02:00
|
|
|
htmlReport true
|
2018-03-20 18:44:23 +01:00
|
|
|
// Optional path to report (default will be lint-results.html in the builddir)
|
2015-08-15 22:36:45 +02:00
|
|
|
htmlOutput file("$project.buildDir/reports/lint/lint.html")
|
|
|
|
}
|
2015-08-22 01:08:46 +02:00
|
|
|
|
|
|
|
testOptions {
|
2018-03-22 21:01:59 +01:00
|
|
|
unitTests {
|
|
|
|
returnDefaultValues = true
|
|
|
|
includeAndroidResources = true
|
|
|
|
}
|
2015-08-22 01:08:46 +02:00
|
|
|
}
|
2021-08-16 12:36:14 +02:00
|
|
|
externalNativeBuild {
|
|
|
|
cmake {
|
|
|
|
path "src/main/c/CMakeLists.txt"
|
|
|
|
version "3.10.2"
|
|
|
|
}
|
|
|
|
}
|
2021-08-24 10:13:31 +02:00
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
jniLibs.srcDirs = ['libs'] // where libs is the name of the directory!
|
|
|
|
}
|
|
|
|
}
|
2015-01-07 14:00:18 +01:00
|
|
|
}
|
|
|
|
|
2016-08-26 22:27:17 +02:00
|
|
|
pmd {
|
2018-03-20 18:44:23 +01:00
|
|
|
toolVersion = "5.5.5"
|
2016-08-26 22:27:17 +02:00
|
|
|
}
|
|
|
|
|
2015-01-07 14:00:18 +01:00
|
|
|
dependencies {
|
2018-03-20 18:44:23 +01:00
|
|
|
// testImplementation "ch.qos.logback:logback-classic:1.1.3"
|
|
|
|
// testImplementation "ch.qos.logback:logback-core:1.1.3"
|
2020-11-05 12:16:34 +01:00
|
|
|
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
|
2018-03-20 18:44:23 +01:00
|
|
|
testImplementation "junit:junit:4.12"
|
|
|
|
testImplementation "org.mockito:mockito-core:1.10.19"
|
2019-05-25 00:07:21 +02:00
|
|
|
testImplementation "org.robolectric:robolectric:4.2.1"
|
2020-10-12 16:14:21 +02:00
|
|
|
testImplementation "com.google.code.gson:gson:2.8.6"
|
2018-03-20 18:44:23 +01:00
|
|
|
|
|
|
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
2021-12-11 22:11:46 +01:00
|
|
|
implementation "androidx.appcompat:appcompat:1.3.1"
|
2020-04-24 10:48:51 +02:00
|
|
|
implementation "androidx.preference:preference:1.1.1"
|
2019-01-26 15:52:40 +01:00
|
|
|
implementation "androidx.cardview:cardview:1.0.0"
|
2021-07-29 18:09:15 +02:00
|
|
|
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
2019-01-26 15:52:40 +01:00
|
|
|
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
|
|
|
implementation "androidx.gridlayout:gridlayout:1.0.0"
|
2021-04-21 16:48:41 +02:00
|
|
|
implementation "androidx.multidex:multidex:2.0.1"
|
2019-01-26 15:52:40 +01:00
|
|
|
implementation "androidx.palette:palette:1.0.0"
|
2021-04-21 16:48:41 +02:00
|
|
|
|
2021-07-29 18:09:15 +02:00
|
|
|
implementation "com.google.android.material:material:1.4.0"
|
2021-05-26 13:26:34 +02:00
|
|
|
implementation 'com.google.android.flexbox:flexbox:3.0.0'
|
2021-05-02 23:07:20 +02:00
|
|
|
implementation "com.google.code.gson:gson:2.8.6"
|
2021-04-21 16:48:41 +02:00
|
|
|
|
2021-04-30 12:21:49 +02:00
|
|
|
implementation "no.nordicsemi.android:dfu:1.11.1"
|
2018-03-20 18:44:23 +01:00
|
|
|
implementation("com.github.tony19:logback-android-classic:1.1.1-6") {
|
|
|
|
exclude group: "com.google.android", module: "android"
|
2017-11-14 11:01:29 +01:00
|
|
|
}
|
2021-02-04 20:22:38 +01:00
|
|
|
implementation "org.slf4j:slf4j-api:1.7.24"
|
2019-08-24 12:41:26 +02:00
|
|
|
implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
|
2018-03-20 18:44:23 +01:00
|
|
|
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"
|
2017-04-10 21:36:44 +02:00
|
|
|
// 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.
|
2018-03-20 18:44:23 +01:00
|
|
|
implementation "org.greenrobot:greendao:2.2.1"
|
2019-05-23 22:02:25 +02:00
|
|
|
implementation "org.apache.commons:commons-lang3:3.7"
|
2018-03-20 18:44:23 +01:00
|
|
|
implementation "org.cyanogenmod:platform.sdk:6.0"
|
2018-07-28 17:23:58 +02:00
|
|
|
implementation 'com.jaredrummler:colorpicker:1.0.2'
|
2018-03-20 18:44:23 +01:00
|
|
|
// implementation project(":DaoCore")
|
2018-11-25 23:56:52 +01:00
|
|
|
implementation 'com.github.wax911:android-emojify:0.1.7'
|
2021-07-30 16:17:42 +02:00
|
|
|
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
|
2021-07-20 12:08:12 +02:00
|
|
|
implementation "androidx.multidex:multidex:2.0.1"
|
2022-02-10 17:49:17 +01:00
|
|
|
implementation 'com.android.volley:volley:1.2.1'
|
2016-03-27 22:13:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
preBuild.dependsOn(":GBDaoGenerator:genSources")
|
2018-03-20 18:44:23 +01:00
|
|
|
|
2016-03-27 22:13:06 +02:00
|
|
|
gradle.beforeProject {
|
|
|
|
preBuild.dependsOn(":GBDaoGenerator:genSources")
|
2015-01-07 14:00:18 +01:00
|
|
|
}
|
2015-08-15 22:36:45 +02:00
|
|
|
|
2019-09-19 22:31:49 +02:00
|
|
|
check.dependsOn "spotbugsMain", "pmd", "lint"
|
2015-08-15 22:36:45 +02:00
|
|
|
|
|
|
|
task pmd(type: Pmd) {
|
|
|
|
ruleSetFiles = files("${project.rootDir}/config/pmd/pmd-ruleset.xml")
|
|
|
|
ignoreFailures = !ABORT_ON_CHECK_FAILURE
|
|
|
|
ruleSets = [
|
2018-03-20 18:44:23 +01:00
|
|
|
"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"
|
2015-08-15 22:36:45 +02:00
|
|
|
]
|
|
|
|
|
2018-03-20 18:44:23 +01:00
|
|
|
source "src"
|
|
|
|
include "**/*.java"
|
|
|
|
exclude "**/gen/**"
|
2015-08-15 22:36:45 +02:00
|
|
|
|
|
|
|
reports {
|
|
|
|
xml.enabled = false
|
|
|
|
html.enabled = true
|
|
|
|
xml {
|
2019-05-23 22:02:25 +02:00
|
|
|
destination file("$project.buildDir/reports/pmd/pmd.xml")
|
2015-08-15 22:36:45 +02:00
|
|
|
}
|
|
|
|
html {
|
2019-05-23 22:02:25 +02:00
|
|
|
destination file("$project.buildDir/reports/pmd/pmd.html")
|
2015-08-15 22:36:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-19 22:31:49 +02:00
|
|
|
// this is just for spotbugs to let the plugin create the task
|
|
|
|
sourceSets {
|
|
|
|
main {
|
2021-07-20 12:08:12 +02:00
|
|
|
main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite"
|
2019-09-19 22:31:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spotbugs {
|
|
|
|
toolVersion = "3.1.12"
|
2015-08-15 22:36:45 +02:00
|
|
|
ignoreFailures = !ABORT_ON_CHECK_FAILURE
|
|
|
|
effort = "default"
|
|
|
|
reportLevel = "medium"
|
2019-09-19 22:31:49 +02:00
|
|
|
}
|
|
|
|
|
2021-07-29 18:09:15 +02:00
|
|
|
tasks.withType(SpotBugsTask) {
|
2019-09-19 22:31:49 +02:00
|
|
|
source = fileTree('src/main/java')
|
|
|
|
classes = files("${project.rootDir}/app/build/intermediates/javac/debug/classes")
|
2015-08-15 22:36:45 +02:00
|
|
|
excludeFilter = new File("${project.rootDir}/config/findbugs/findbugs-filter.xml")
|
|
|
|
reports {
|
|
|
|
xml.enabled = false
|
|
|
|
html.enabled = true
|
|
|
|
xml {
|
2019-09-19 22:31:49 +02:00
|
|
|
destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.xml")
|
2015-08-15 22:36:45 +02:00
|
|
|
}
|
|
|
|
html {
|
2019-09-19 22:31:49 +02:00
|
|
|
destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.html")
|
2015-08-15 22:36:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-20 12:08:12 +02:00
|
|
|
|
|
|
|
protobuf {
|
|
|
|
protoc {
|
|
|
|
artifact = 'com.google.protobuf:protoc:3.0.0'
|
|
|
|
}
|
|
|
|
plugins {
|
|
|
|
javalite {
|
|
|
|
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
generateProtoTasks {
|
|
|
|
all().each { task ->
|
|
|
|
task.builtins {
|
|
|
|
remove java
|
|
|
|
}
|
|
|
|
task.plugins {
|
|
|
|
javalite { }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|