apply plugin: 'com.android.application' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' apply plugin: 'jacoco' apply plugin: "com.osacky.fladle" def keystoreProperties = new Properties() try { def keystorePropertiesFile = rootProject.file("keystore.properties") keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } catch (FileNotFoundException ignored) { logger.warn("Unable to load keystore properties. Automatic signing won't be available") keystoreProperties['keyAlias'] = "" keystoreProperties['keyPassword'] = "" keystoreProperties['storeFile'] = File.createTempFile("temp", ".tmp").absolutePath keystoreProperties['storePassword'] = "" } android { configurations.all { resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1' } packagingOptions { exclude 'META-INF/LICENSE-LGPL-2.1.txt' exclude 'META-INF/LICENSE-LGPL-3.txt' exclude 'META-INF/LICENSE-W3C-TEST' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' } compileSdkVersion 33 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } defaultConfig { applicationId "com.wbrawner.simplemarkdown" minSdkVersion 23 targetSdkVersion 33 versionCode 35 versionName "0.8.13" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments clearPackageData: 'true' buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "true" } signingConfigs { playRelease { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } } buildTypes { debug { testCoverageEnabled true } release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false" } } flavorDimensions "platform" productFlavors { free { applicationIdSuffix ".free" versionNameSuffix "-free" } play { signingConfig signingConfigs.playRelease } } dexOptions { jumboMode true } testOptions { unitTests { includeAndroidResources = true } execution 'ANDROIDX_TEST_ORCHESTRATOR' } } dependencies { def navigation_version = '2.5.3' implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" implementation "androidx.navigation:navigation-ui-ktx:$navigation_version" testImplementation 'junit:junit:4.13.2' testImplementation 'org.robolectric:robolectric:4.2.1' implementation fileTree(include: ['*.jar'], dir: 'libs') def espresso_version = '3.4.0' androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version" androidTestImplementation "androidx.test.espresso:espresso-web:$espresso_version" androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version" def android_test = '1.4.0' androidTestImplementation "androidx.test:runner:$android_test" androidTestImplementation "androidx.test:rules:$android_test" androidTestUtil "androidx.test:orchestrator:1.4.1" androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' implementation 'com.wbrawner.plausible:plausible-android:0.1.0-SNAPSHOT' implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.preference:preference-ktx:1.2.0' implementation "androidx.fragment:fragment-ktx:1.5.4" implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'com.google.android.material:material:1.7.0' implementation 'androidx.legacy:legacy-support-v13:1.0.0' implementation 'com.commonsware.cwac:anddown:0.3.0' implementation 'com.jakewharton.timber:timber:5.0.1' playImplementation 'com.android.billingclient:billing:5.0.0' playImplementation 'com.google.android.play:core-ktx:1.8.1' playImplementation 'com.google.firebase:firebase-crashlytics:18.3.1' implementation "androidx.core:core-ktx:1.9.0" implementation 'androidx.browser:browser:1.4.0' def coroutines_version = "1.6.4" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" def lifecycle_version = "2.2.0" implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" kapt "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" implementation 'eu.crydee:syllable-counter:4.0.2' } android.productFlavors.each { flavor -> if (getGradle().getStartParameter().getTaskRequests().toString().toLowerCase().contains(flavor.name) && flavor.name == 'play') { apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' } } jacoco { toolVersion = '0.8.8' } tasks.withType(Test) { jacoco.includeNoLocationClasses = true jacoco.excludes = ['jdk.internal.*'] } task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { reports { xml.enabled = true html.enabled = true } def fileFilter = [ '**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*' ] def javaDebugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter) def kotlinDebugTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter) def mainSrc = "$project.projectDir/src/main/java" sourceDirectories.setFrom(files([mainSrc])) classDirectories.setFrom(files([javaDebugTree, kotlinDebugTree])) executionData.setFrom(fileTree(dir: project.buildDir, includes: [ 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' ])) } fladle { variant = 'playDebug' useOrchestrator = true environmentVariables = [ "clearPackageData": "true" ] testTimeout = "7m" devices = [ [ "model": "NexusLowRes", "version": "29" ] ] projectId = 'simplemarkdown' } task pullLogFiles(type: Exec) { commandLine 'adb', 'pull', '/storage/emulated/0/Android/data/com.wbrawner.simplemarkdown/files/logs' }