plugins { id "com.diffplug.spotless" version "5.12.5" } apply from: '../dependencies.gradle' apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'jacoco' repositories { google() maven { url "https://jitpack.io" } } spotless { kotlin { target '**/*.kt' ktlint()userData(['max_line_length': '100']) } } android { compileSdkVersion COMPILE_SDK_VERSION buildToolsVersion BUILD_TOOLS_VERSION defaultConfig { applicationId "com.farmerbb.taskbar" minSdkVersion MIN_SDK_VERSION targetSdkVersion TARGET_SDK_VERSION versionCode VERSION_CODE versionName VERSION_NAME resConfigs "en", "es", "ja", "ru", "de", "zh-rCN", "tr", "nl", "pl" vectorDrawables.generatedDensities = [] buildConfigField "String", "BASE_APPLICATION_ID", "\"com.farmerbb.taskbar\"" buildConfigField "String", "PAID_APPLICATION_ID", "\"com.farmerbb.taskbar.paid\"" buildConfigField "String", "SUPPORT_APPLICATION_ID", "\"com.farmerbb.taskbar.support\"" buildConfigField "String", "ANDROIDX86_APPLICATION_ID", "\"com.farmerbb.taskbar.androidx86\"" buildConfigField "long", "TIMESTAMP", "${System.currentTimeMillis()}L" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } signingConfigs { release { if(System.getenv("KSTOREFILE") != null) storeFile file(System.getenv("KSTOREFILE")) storePassword System.getenv("KSTOREPWD") keyAlias System.getenv("KEYALIAS") keyPassword System.getenv("KEYPWD") } } buildTypes { debug { applicationIdSuffix ".debug" manifestPlaceholders = [appName: "@string/tb_app_name_debug"] } release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release manifestPlaceholders = [appName: "@string/tb_app_name"] applicationVariants.all { variant -> variant.outputs.all { outputFileName = "${project.parent.name}-${defaultConfig.versionName}.apk" } } } jacoco { initWith buildTypes.debug testCoverageEnabled true } } flavorDimensions "default" productFlavors { paid { applicationId "com.farmerbb.taskbar.paid" } free { applicationId "com.farmerbb.taskbar" } } sourceSets { main { java { srcDirs('src/main/java', 'src/playstore/java', 'src/nonlib/java', "src/compat-$COMPILE_SDK_VERSION/java") } res { srcDirs('src/main/res', 'src/playstore/res', 'src/nonlib/res') } manifest.srcFile 'src/playstore/AndroidManifest.xml' } } lintOptions { abortOnError false } testOptions { unitTests { all { testLogging { events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' outputs.upToDateWhen { false } showStandardStreams = false exceptionFormat = 'full' } //noinspection GrDeprecatedAPIUsage jacoco { includeNoLocationClasses = true excludes = ['jdk.internal.*'] } } includeAndroidResources = true } } } dependencies { implementation "androidx.legacy:legacy-support-v4:$SUPPORT_V4_VERSION" implementation "androidx.appcompat:appcompat:$APPCOMPAT_VERSION" //noinspection GradleDependency implementation "androidx.browser:browser:$BROWSER_VERSION" implementation "com.google.android.material:material:$MATERIAL_VERSION" //noinspection GradleDependency implementation 'com.mikepenz:iconics-core:3.2.5' implementation 'com.mikepenz:foundation-icons-typeface:3.0.0.5' implementation 'moe.banana:toast-compat:1.0.5' implementation group:'com.twofortyfouram', name:'android-plugin-api-for-locale', version:'[1.0.2,2.0[' testImplementation "com.google.truth:truth:1.1.3" testImplementation 'junit:junit:4.13.2' testImplementation 'androidx.test:core:1.3.0' testImplementation "org.robolectric:robolectric:4.5.1" testImplementation "org.powermock:powermock-module-junit4:$POWERMOCK_VERSION" testImplementation "org.powermock:powermock-module-junit4-rule:$POWERMOCK_VERSION" testImplementation "org.powermock:powermock-api-mockito2:$POWERMOCK_VERSION" testImplementation "org.powermock:powermock-classloading-xstream:$POWERMOCK_VERSION" testImplementation 'org.apache.commons:commons-lang3:3.12.0' } task jacocoTestReport(type: JacocoReport, dependsOn: ['testFreeJacocoUnitTest']) { reports { xml.enabled = true html.enabled = true csv.enabled = true } def fileFilter = [ '**/R.class', '**/R$*.class', '**/BuildConfig.class' ] def jacocoTree = fileTree(dir: "$buildDir/intermediates/javac/freeJacoco/classes", excludes: fileFilter) def mainSrc = "${project.projectDir}/src/main/java" sourceDirectories.from = [mainSrc] classDirectories.from = [jacocoTree] executionData.from = "$buildDir/jacoco/testFreeJacocoUnitTest.exec" doLast { println "Test report link: file://$buildDir/reports/jacoco/jacocoTestReport/html/index.html" } }