344 lines
13 KiB
Groovy
344 lines
13 KiB
Groovy
import java.text.SimpleDateFormat
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: 'kotlin-kapt'
|
|
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
|
|
apply plugin: "io.gitlab.arturbosch.detekt"
|
|
apply plugin: 'com.google.gms.google-services'
|
|
|
|
android {
|
|
|
|
compileSdkVersion compile_sdk_version
|
|
|
|
// exoPlayer 2.9.0 以降は Java 8 compiler support を要求する
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
defaultConfig {
|
|
targetSdkVersion target_sdk_version
|
|
minSdkVersion min_sdk_version
|
|
|
|
versionCode 475
|
|
versionName "4.7.5"
|
|
applicationId "jp.juggler.subwaytooter"
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
vectorDrawables.useSupportLibrary = true
|
|
}
|
|
|
|
viewBinding {
|
|
enabled = true
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = jvm_target
|
|
useIR = true
|
|
freeCompilerArgs += [
|
|
"-Xopt-in=kotlin.ExperimentalStdlibApi",
|
|
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
|
"-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
|
"-Xopt-in=androidx.compose.foundation.ExperimentalFoundationApi",
|
|
"-Xopt-in=androidx.compose.animation.ExperimentalAnimationApi",
|
|
]
|
|
}
|
|
|
|
// kotlin 1.6.0にすると This version (1.0.5) of the Compose Compiler requires Kotlin version 1.5.31 but you appear to be using Kotlin version 1.6.0 which is not known to be compatible. と怒られる
|
|
// buildFeatures {
|
|
// compose true
|
|
// }
|
|
|
|
composeOptions {
|
|
kotlinCompilerExtensionVersion compose_version
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
shrinkResources false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
lintOptions {
|
|
disable 'MissingTranslation'
|
|
}
|
|
}
|
|
}
|
|
|
|
// Specifies comma-separated list of flavor dimensions.
|
|
flavorDimensions "rcOrDev"
|
|
|
|
productFlavors {
|
|
rc {
|
|
dimension "rcOrDev"
|
|
}
|
|
}
|
|
|
|
// Generate Signed APK のファイル名を変更
|
|
android.applicationVariants.all { variant ->
|
|
if (variant.buildType.name == "release") {
|
|
variant.outputs.all {
|
|
// Rename APK
|
|
def versionCode = defaultConfig.versionCode
|
|
def versionName = defaultConfig.versionName
|
|
def flavor = variant.flavorName
|
|
def date = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date())
|
|
def branch = gitBranch()
|
|
outputFileName = "../../SubwayTooter-${branch}-${flavor}-${versionCode}-${versionName}-${date}.apk"
|
|
}
|
|
}
|
|
}
|
|
|
|
packagingOptions {
|
|
// https://github.com/Kotlin/kotlinx.coroutines/issues/1064
|
|
pickFirst("META-INF/atomicfu.kotlin_module")
|
|
resources {
|
|
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
|
}
|
|
}
|
|
|
|
useLibrary 'android.test.base'
|
|
useLibrary 'android.test.mock'
|
|
}
|
|
|
|
static def gitBranch() {
|
|
def branch = "(no branch)"
|
|
def proc = "git status".execute()
|
|
proc.in.eachLine { line ->
|
|
def matcher = line =~ /\AOn branch (\S+)/
|
|
if (matcher) branch = matcher.group(1)
|
|
}
|
|
proc.err.eachLine { line -> println line }
|
|
proc.waitFor()
|
|
branch
|
|
}
|
|
|
|
kapt {
|
|
useBuildCache = true
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
implementation fileTree(include: ['*.aar'], dir: 'src/main/libs')
|
|
|
|
// targetSdkVersion 31 で androidTest 時に android:exported 云々で怒られる問題の対策
|
|
// https://github.com/android/android-test/issues/1022
|
|
androidTestImplementation "androidx.test:core:1.4.0"
|
|
|
|
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
})
|
|
|
|
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detekt_version")
|
|
detektPlugins("io.gitlab.arturbosch.detekt:detekt-cli:$detekt_version")
|
|
|
|
// implementation project(':exif')
|
|
implementation project(':colorpicker')
|
|
implementation project(':emoji')
|
|
implementation project(':apng_android')
|
|
|
|
implementation "androidx.appcompat:appcompat:$appcompat_version"
|
|
|
|
def emojiVersion = "1.0.0"
|
|
implementation "androidx.emoji2:emoji2:$emojiVersion"
|
|
implementation "androidx.emoji2:emoji2-bundled:$emojiVersion"
|
|
|
|
// DrawerLayout
|
|
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
|
|
|
|
// NavigationView
|
|
implementation "com.google.android.material:material:1.4.0"
|
|
|
|
// PreferenceManager
|
|
implementation "androidx.preference:preference-ktx:1.1.1"
|
|
|
|
implementation "androidx.exifinterface:exifinterface:1.3.3"
|
|
|
|
// CustomTabs
|
|
implementation "androidx.browser:browser:1.4.0"
|
|
|
|
// Recyclerview
|
|
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
|
|
|
kapt 'androidx.annotation:annotation:1.3.0'
|
|
|
|
// https://firebase.google.com/support/release-notes/android
|
|
implementation "com.google.firebase:firebase-messaging:23.0.0"
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
|
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutines_version"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_coroutines_version"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
|
|
implementation "ru.gildor.coroutines:kotlin-coroutines-okhttp:1.0"
|
|
|
|
// Anko Layouts
|
|
// sdk15, sdk19, sdk21, sdk23 are also available
|
|
// implementation "org.jetbrains.anko:anko-sdk25:$anko_version"
|
|
// implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
|
|
|
|
// Coroutine listeners for Anko Layouts
|
|
//implementation "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
|
|
//implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
|
|
|
|
testImplementation "junit:junit:$junit_version" // しばらくはkotlin-testとjunitを併用
|
|
|
|
def okhttpVersion = "4.9.2"
|
|
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
|
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
|
|
|
|
testImplementation("com.squareup.okhttp3:mockwebserver:$okhttpVersion") {
|
|
exclude group: 'com.squareup.okio', module: 'okio'
|
|
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
|
|
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
|
|
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
|
|
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
|
|
}
|
|
|
|
androidTestImplementation("com.squareup.okhttp3:mockwebserver:$okhttpVersion") {
|
|
exclude group: 'com.squareup.okio', module: 'okio'
|
|
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
|
|
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
|
|
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
|
|
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
|
|
}
|
|
|
|
def glideVersion = '4.12.0'
|
|
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
|
implementation "com.github.bumptech.glide:annotations:$glideVersion"
|
|
implementation("com.github.bumptech.glide:okhttp3-integration:$glideVersion") {
|
|
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
|
|
}
|
|
kapt "com.github.bumptech.glide:compiler:$glideVersion"
|
|
|
|
implementation "org.conscrypt:conscrypt-android:2.5.1"
|
|
|
|
implementation 'io.github.inflationx:calligraphy3:3.1.1'
|
|
implementation 'io.github.inflationx:viewpump:2.0.3'
|
|
|
|
implementation 'com.github.woxthebox:draglistview:1.6.6'
|
|
|
|
implementation 'com.github.omadahealth:swipy:1.2.3@aar'
|
|
|
|
implementation 'com.github.kenglxn.QRGen:android:2.5.0'
|
|
|
|
implementation 'commons-io:commons-io:2.6'
|
|
|
|
implementation 'org.hjson:hjson:3.0.0'
|
|
|
|
implementation 'com.google.android.flexbox:flexbox:3.0.0'
|
|
|
|
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
|
|
|
|
implementation 'com.google.android.exoplayer:exoplayer:2.16.0'
|
|
/*
|
|
WARNING: [Processor] Library '…\exoplayer-ui-2.12.0.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
|
|
Example of androidX reference: 'androidx/core/app/NotificationCompat$Builder'
|
|
Example of support library reference: 'android/support/v4/media/session/MediaSessionCompat$Token'
|
|
…expPlayerも苦労してるんだなあ…
|
|
*/
|
|
|
|
implementation 'com.caverock:androidsvg-aar:1.4'
|
|
|
|
// ViewModel
|
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
|
// LiveData
|
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
|
|
// Lifecycles only (without ViewModel or LiveData)
|
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
|
|
|
|
// Saved state module for ViewModel
|
|
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
|
|
|
|
// if using Java8, use the following instead of lifecycle-compiler
|
|
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
|
|
|
|
// optional - helpers for implementing LifecycleOwner in a Service
|
|
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
|
|
|
|
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
|
|
implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
|
|
|
|
// optional - ReactiveStreams support for LiveData
|
|
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
|
|
|
|
// optional - Test helpers for LiveData
|
|
testImplementation "androidx.arch.core:core-testing:$arch_version"
|
|
|
|
|
|
def roomVersion = "2.3.0"
|
|
implementation "androidx.room:room-runtime:$roomVersion"
|
|
implementation "androidx.room:room-ktx:$roomVersion"
|
|
kapt "androidx.room:room-compiler:$roomVersion"
|
|
|
|
def workVersion = "2.7.1"
|
|
implementation "androidx.work:work-runtime:$workVersion"
|
|
implementation "androidx.work:work-runtime-ktx:$workVersion"
|
|
|
|
implementation "androidx.startup:startup-runtime:1.1.0"
|
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
|
|
|
|
// implementation "androidx.compose.ui:ui:$compose_version"
|
|
// implementation "androidx.compose.material:material:$compose_version"
|
|
// implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
|
|
// implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
|
|
// implementation "androidx.compose.material:material-icons-extended:$compose_version"
|
|
// androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
|
// debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
|
|
|
// implementation "androidx.activity:activity-compose:1.4.0"
|
|
// implementation "com.google.accompanist:accompanist-flowlayout:0.20.0"
|
|
|
|
// Koin main features for Android
|
|
implementation "io.insert-koin:koin-android:$koin_version"
|
|
implementation "io.insert-koin:koin-android-compat:$koin_version"
|
|
implementation "io.insert-koin:koin-androidx-workmanager:$koin_version"
|
|
// implementation "io.insert-koin:koin-androidx-navigation:$koin_version"
|
|
// implementation "io.insert-koin:koin-androidx-compose:$koin_version"
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
detekt {
|
|
// relative path from module path.
|
|
basePath = projectDir
|
|
|
|
// preconfigure defaults
|
|
buildUponDefaultConfig = true
|
|
|
|
// activate all available (even unstable) rules.
|
|
allRules = false
|
|
|
|
// a way of suppressing issues before introducing detekt
|
|
baseline = file("$rootDir/config/detekt/baseline.xml")
|
|
|
|
// point to your custom config defining rules to run, overwriting default behavior
|
|
config = files("$rootDir/config/detekt/config.yml")
|
|
|
|
reports {
|
|
// checkstyle like format mainly for integrations like Jenkins
|
|
xml {
|
|
enabled = true
|
|
destination = file("detektReport/${name}.xml")
|
|
}
|
|
// observe findings in your browser with structure and code snippets
|
|
html {
|
|
enabled = true
|
|
destination = file("detektReport/${name}.html")
|
|
}
|
|
// similar to the console output, contains issue signature to manually edit baseline files
|
|
txt {
|
|
enabled = true
|
|
destination = file("detektReport/${name}.txt")
|
|
}
|
|
// standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with Github Code Scanning
|
|
sarif {
|
|
enabled = true
|
|
destination = file("detektReport/${name}.sarif")
|
|
}
|
|
}
|
|
}
|