2022-03-12 16:50:37 +01:00
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektPlugin
2017-04-23 07:42:09 +02:00
import java.text.SimpleDateFormat
2017-04-20 18:23:59 +02:00
apply plugin: 'com.android.application'
2017-11-04 15:51:15 +01:00
apply plugin: 'kotlin-android'
2019-01-25 15:38:21 +01:00
apply plugin: 'kotlin-kapt'
2021-05-22 00:03:16 +02:00
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
2021-06-20 05:02:30 +02:00
apply plugin: "io.gitlab.arturbosch.detekt"
2021-11-20 01:36:43 +01:00
apply plugin: 'com.google.gms.google-services'
2017-04-20 18:23:59 +02:00
android {
2018-10-01 11:45:51 +02:00
2021-02-25 02:24:08 +01:00
compileSdkVersion compile_sdk_version
2018-09-12 07:55:15 +02:00
2019-07-31 20:30:56 +02:00
// exoPlayer 2.9.0 以降は Java 8 compiler support を要求する
2019-07-12 06:38:19 +02:00
compileOptions {
2020-09-08 22:17:32 +02:00
sourceCompatibility JavaVersion . VERSION_1_8
2019-07-12 06:38:19 +02:00
targetCompatibility JavaVersion . VERSION_1_8
}
2017-04-20 18:23:59 +02:00
defaultConfig {
2018-09-12 07:55:15 +02:00
targetSdkVersion target_sdk_version
minSdkVersion min_sdk_version
2018-01-14 22:47:42 +01:00
2022-06-25 08:33:44 +02:00
versionCode 492
versionName "4.9.2"
2018-09-12 07:55:15 +02:00
applicationId "jp.juggler.subwaytooter"
2019-02-15 02:51:22 +01:00
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2021-11-06 04:00:29 +01:00
vectorDrawables . useSupportLibrary = true
2017-04-20 18:23:59 +02:00
}
2017-04-25 16:47:27 +02:00
2021-11-06 21:36:59 +01:00
viewBinding {
enabled = true
}
2021-05-27 04:15:59 +02:00
kotlinOptions {
2021-11-06 03:11:28 +01:00
jvmTarget = jvm_target
2021-10-27 22:58:19 +02:00
useIR = true
2021-05-27 04:15:59 +02:00
freeCompilerArgs + = [
2022-05-29 15:38:21 +02:00
"-opt-in=kotlin.ExperimentalStdlibApi" ,
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi" ,
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi" ,
2022-05-29 07:00:51 +02:00
// "-Xopt-in=androidx.compose.foundation.ExperimentalFoundationApi",
// "-Xopt-in=androidx.compose.animation.ExperimentalAnimationApi",
2021-05-27 04:15:59 +02:00
]
}
2021-11-20 01:36:43 +01:00
// 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
// }
2022-05-29 07:00:51 +02:00
// composeOptions {
// kotlinCompilerExtensionVersion compose_version
// }
2021-05-22 00:03:16 +02:00
2017-04-20 18:23:59 +02:00
buildTypes {
release {
2019-02-15 04:17:31 +01:00
minifyEnabled false
2018-01-13 07:52:07 +01:00
shrinkResources false
2017-04-20 18:23:59 +02:00
proguardFiles getDefaultProguardFile ( 'proguard-android.txt' ) , 'proguard-rules.pro'
2018-08-31 15:22:51 +02:00
lintOptions {
disable 'MissingTranslation'
}
2017-04-20 18:23:59 +02:00
}
}
2017-04-25 16:47:27 +02:00
2017-11-04 15:51:15 +01:00
// Specifies comma-separated list of flavor dimensions.
flavorDimensions "rcOrDev"
2017-04-23 07:42:09 +02:00
productFlavors {
rc {
2017-11-04 15:51:15 +01:00
dimension "rcOrDev"
2017-04-23 07:42:09 +02:00
}
}
// Generate Signed APK のファイル名を変更
2017-11-04 15:51:15 +01:00
android . applicationVariants . all { variant - >
2017-04-23 07:42:09 +02:00
if ( variant . buildType . name = = "release" ) {
2017-11-04 15:51:15 +01:00
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 ( ) )
2021-10-27 22:58:19 +02:00
def branch = gitBranch ( )
outputFileName = "../../SubwayTooter-${branch}-${flavor}-${versionCode}-${versionName}-${date}.apk"
2017-04-23 07:42:09 +02:00
}
}
}
2017-11-04 15:51:15 +01:00
2019-04-13 01:12:17 +02:00
packagingOptions {
// https://github.com/Kotlin/kotlinx.coroutines/issues/1064
pickFirst ( "META-INF/atomicfu.kotlin_module" )
2021-10-27 22:58:19 +02:00
resources {
excludes + = '/META-INF/{AL2.0,LGPL2.1}'
}
2022-03-12 17:04:41 +01:00
exclude 'META-INF/DEPENDENCIES'
2019-04-13 01:12:17 +02:00
}
2019-08-30 06:02:08 +02:00
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
2022-03-14 01:16:44 +01:00
lintOptions {
warning 'DuplicatePlatformClasses'
}
2017-04-20 18:23:59 +02:00
}
2021-10-27 22:58:19 +02:00
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
}
2019-01-25 15:38:21 +01:00
kapt {
useBuildCache = true
}
2017-04-20 18:23:59 +02:00
dependencies {
2018-03-27 05:07:40 +02:00
implementation fileTree ( include: [ '*.jar' ] , dir: 'libs' )
2021-05-05 14:39:00 +02:00
implementation fileTree ( include: [ '*.aar' ] , dir: 'src/main/libs' )
2021-10-28 01:37:39 +02:00
// targetSdkVersion 31 で androidTest 時に android:exported 云々で怒られる問題の対策
// https://github.com/android/android-test/issues/1022
androidTestImplementation "androidx.test:core:1.4.0"
2019-02-15 02:51:22 +01:00
androidTestImplementation ( 'androidx.test.espresso:espresso-core:3.1.0-alpha4' , {
2017-04-20 18:23:59 +02:00
exclude group: 'com.android.support' , module: 'support-annotations'
} )
2017-12-11 22:18:17 +01:00
2021-06-20 05:02:30 +02:00
detektPlugins ( "io.gitlab.arturbosch.detekt:detekt-formatting:$detekt_version" )
detektPlugins ( "io.gitlab.arturbosch.detekt:detekt-cli:$detekt_version" )
2020-08-25 02:04:18 +02:00
// implementation project(':exif')
2018-01-28 20:03:04 +01:00
implementation project ( ':colorpicker' )
implementation project ( ':emoji' )
implementation project ( ':apng_android' )
2018-01-04 19:52:25 +01:00
2019-02-15 02:51:22 +01:00
implementation "androidx.appcompat:appcompat:$appcompat_version"
2019-09-12 17:13:00 +02:00
2022-06-04 20:43:55 +02:00
implementation "androidx.core:core-ktx:1.8.0"
2022-03-11 00:11:49 +01:00
2022-05-29 15:38:21 +02:00
def emoji2Version = "1.1.0"
implementation "androidx.emoji2:emoji2:$emoji2Version"
implementation "androidx.emoji2:emoji2-views:$emoji2Version"
implementation "androidx.emoji2:emoji2-views-helper:$emoji2Version"
implementation "androidx.emoji2:emoji2-bundled:$emoji2Version"
2021-11-08 10:29:11 +01:00
2019-09-12 17:13:00 +02:00
// DrawerLayout
2020-09-08 22:17:32 +02:00
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
2019-09-12 17:13:00 +02:00
// NavigationView
2022-06-04 20:43:55 +02:00
implementation "com.google.android.material:material:1.6.1"
2019-09-12 17:13:00 +02:00
2021-10-27 22:58:19 +02:00
implementation "androidx.exifinterface:exifinterface:1.3.3"
2020-08-25 02:04:18 +02:00
2019-09-12 17:13:00 +02:00
// CustomTabs
2021-11-06 03:25:11 +01:00
implementation "androidx.browser:browser:1.4.0"
2019-09-12 17:13:00 +02:00
2019-10-05 14:28:04 +02:00
// Recyclerview
2021-06-20 05:02:30 +02:00
implementation "androidx.recyclerview:recyclerview:1.2.1"
2019-10-05 14:28:04 +02:00
2021-11-08 10:29:11 +01:00
kapt 'androidx.annotation:annotation:1.3.0'
2017-12-11 22:18:17 +01:00
2018-06-11 02:33:01 +02:00
// https://firebase.google.com/support/release-notes/android
2022-05-29 07:00:51 +02:00
implementation "com.google.firebase:firebase-messaging:23.0.5"
2017-08-24 13:44:06 +02:00
2022-05-01 14:46:10 +02:00
implementation "org.jetbrains.kotlin:kotlin-reflect"
testImplementation "org.jetbrains.kotlin:kotlin-test"
2019-08-24 12:56:05 +02:00
2018-09-14 18:36:05 +02:00
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutines_version"
2020-12-06 19:32:21 +01:00
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_coroutines_version"
2022-03-11 00:11:49 +01:00
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
2021-11-12 19:59:08 +01:00
implementation "ru.gildor.coroutines:kotlin-coroutines-okhttp:1.0"
2018-01-12 10:01:25 +01:00
Android Studio 4.0.0, Android gradple plugin 4.0.1, Gradle 6.1.1, kotlin 1.4.0, espresso-core:3.3.0-rc03, androidx.test:runner:1.3.0-rc03, androidx.appcompat 1.2.0, androidx.core-ktx 1.3.1, androidx.drawerlayout 1.1.0, androidx.preference 1.1.1, com.google.android.material 1.2.0, firebase-messaging 20.2.4, com.google.android:flexbox 2.0.1, junit 4.13
2020-08-23 00:15:27 +02:00
testImplementation "junit:junit:$junit_version" // しばらくはkotlin-testとjunitを併用
2017-12-22 04:12:32 +01:00
2022-06-04 20:43:55 +02:00
def okhttpVersion = "4.9.3"
2021-10-27 22:58:19 +02:00
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
2021-11-06 03:11:28 +01:00
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'
}
2017-05-26 05:48:06 +02:00
2022-03-11 00:11:49 +01:00
def glideVersion = '4.13.1'
2021-06-28 16:37:51 +02:00
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "com.github.bumptech.glide:annotations:$glideVersion"
2021-10-27 22:58:19 +02:00
implementation ( "com.github.bumptech.glide:okhttp3-integration:$glideVersion" ) {
2019-08-24 12:56:05 +02:00
exclude group: 'com.squareup.okhttp3' , module: 'okhttp'
}
2021-06-28 16:37:51 +02:00
kapt "com.github.bumptech.glide:compiler:$glideVersion"
2019-08-24 12:56:05 +02:00
2020-10-24 05:14:53 +02:00
implementation "org.conscrypt:conscrypt-android:2.5.1"
2017-07-26 13:40:55 +02:00
2019-07-12 06:38:19 +02:00
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
2017-09-25 17:10:05 +02:00
2019-07-12 06:38:19 +02:00
implementation 'com.github.woxthebox:draglistview:1.6.6'
2017-12-21 12:33:35 +01:00
2018-04-05 22:47:25 +02:00
implementation 'com.github.omadahealth:swipy:1.2.3@aar'
2017-12-21 12:33:35 +01:00
2019-07-12 06:38:19 +02:00
implementation 'com.github.kenglxn.QRGen:android:2.5.0'
2018-01-14 22:47:42 +01:00
2018-04-05 22:47:25 +02:00
implementation 'org.hjson:hjson:3.0.0'
2021-08-24 00:46:09 +02:00
implementation 'com.google.android.flexbox:flexbox:3.0.0'
2018-04-05 22:47:25 +02:00
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
2018-01-17 18:39:16 +01:00
2022-03-12 16:51:26 +01:00
implementation 'com.google.android.exoplayer:exoplayer:2.17.1'
2020-10-24 05:14:53 +02:00
/ *
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も苦労してるんだなあ …
* /
2018-01-21 13:46:36 +01:00
2019-07-12 06:38:19 +02:00
implementation 'com.caverock:androidsvg-aar:1.4'
2021-10-27 22:58:19 +02:00
2022-05-29 15:38:21 +02:00
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
2021-10-27 22:58:19 +02:00
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
2022-03-11 00:11:49 +01:00
2021-10-27 22:58:19 +02:00
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-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"
2022-06-13 19:23:46 +02:00
implementation 'androidx.work:work-runtime-ktx:2.7.1'
2022-03-11 00:11:49 +01:00
def roomVersion = "2.4.2"
2021-11-20 01:36:43 +01:00
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"
2022-03-11 00:11:49 +01:00
implementation "androidx.startup:startup-runtime:1.1.1"
2021-10-27 22:58:19 +02:00
2021-11-20 01:36:43 +01:00
// 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"
2022-01-05 10:39:48 +01:00
// video transcoder https://github.com/natario1/Transcoder
implementation "com.otaliastudios:transcoder:0.10.4"
2017-04-20 18:23:59 +02:00
}
2017-05-24 11:20:56 +02:00
2017-11-04 15:51:15 +01:00
repositories {
mavenCentral ( )
}
2017-12-22 13:59:52 +01:00
2021-06-20 05:02:30 +02:00
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
2022-03-11 00:18:41 +01:00
// baseline = file("$rootDir/config/detekt/baseline.xml")
2021-06-20 05:02:30 +02:00
// point to your custom config defining rules to run, overwriting default behavior
config = files ( "$rootDir/config/detekt/config.yml" )
2022-03-12 16:50:37 +01:00
}
2021-06-20 05:02:30 +02:00
2022-03-12 16:50:37 +01:00
plugins . withType ( DetektPlugin ) {
tasks . withType ( Detekt ) {
reports {
xml . required . set ( true )
xml . outputLocation = file ( "$buildDir/reports/detekt/st-${name}.xml" )
html . required . set ( true )
html . outputLocation = file ( "$buildDir/reports/detekt/st-${name}.html" )
txt . required . set ( true )
txt . outputLocation = file ( "$buildDir/reports/detekt/st-${name}.txt" )
sarif . required . set ( true )
sarif . outputLocation = file ( "$buildDir/reports/detekt/st-${name}.sarif" )
2021-06-20 05:02:30 +02:00
}
}
}