2022-03-12 16:50:37 +01:00
import io.gitlab.arturbosch.detekt.Detekt
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-11-20 01:36:43 +01:00
apply plugin: 'com.google.gms.google-services'
2023-01-14 11:19:01 +01:00
apply plugin: "io.gitlab.arturbosch.detekt"
2017-04-20 18:23:59 +02:00
android {
2021-02-25 02:24:08 +01:00
compileSdkVersion compile_sdk_version
2022-08-12 04:51:05 +02:00
buildToolsVersion build_tools_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
2022-11-07 03:45:17 +01:00
coreLibraryDesugaringEnabled true
2019-07-12 06:38:19 +02:00
}
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
2023-01-26 16:55:00 +01:00
versionCode 511
versionName "5.511"
2018-09-12 07:55:15 +02:00
applicationId "jp.juggler.subwaytooter"
2021-11-06 04:00:29 +01:00
vectorDrawables . useSupportLibrary = true
2023-01-17 13:42:47 +01:00
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
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-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 {
2021-10-27 22:58:19 +02:00
resources {
2023-01-26 16:54:04 +01:00
excludes + = [ '/META-INF/{AL2.0,LGPL2.1}' , 'META-INF/DEPENDENCIES' ]
// https://github.com/Kotlin/kotlinx.coroutines/issues/1064
pickFirsts + = [ 'META-INF/atomicfu.kotlin_module' ]
2021-10-27 22:58:19 +02:00
}
2019-04-13 01:12:17 +02:00
}
2019-08-30 06:02:08 +02:00
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
2023-01-26 16:54:04 +01:00
lint {
2022-03-14 01:16:44 +01:00
warning 'DuplicatePlatformClasses'
}
2023-01-26 16:54:04 +01:00
namespace 'jp.juggler.subwaytooter'
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 {
2022-11-07 03:45:17 +01:00
// desugar_jdk_libs 2.0.0 は AGP 7.4.0-alpha10 以降を要求する
//noinspection GradleDependency
2023-01-13 13:22:25 +01:00
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_lib_bersion"
2022-11-07 03:45:17 +01:00
2023-01-14 12:20:24 +01:00
implementation ( project ( ":base" ) )
2018-01-28 20:03:04 +01:00
implementation project ( ':colorpicker' )
implementation project ( ':emoji' )
implementation project ( ':apng_android' )
2023-01-14 12:20:24 +01:00
implementation fileTree ( include: [ '*.aar' ] , dir: 'src/main/libs' )
2018-01-04 19:52:25 +01:00
2023-01-14 12:20:24 +01:00
// App1 とサーバ情報カラムで使う
api "org.conscrypt:conscrypt-android:2.5.2"
2022-06-13 19:23:46 +02:00
2023-01-14 12:20:24 +01:00
kapt "androidx.annotation:annotation:1.5.0"
2021-11-20 01:36:43 +01:00
kapt "androidx.room:room-compiler:$roomVersion"
2023-01-14 12:20:24 +01:00
kapt "com.github.bumptech.glide:compiler:$glideVersion"
2023-01-14 11:19:01 +01:00
detektPlugins ( "io.gitlab.arturbosch.detekt:detekt-formatting:$detekt_version" )
2023-01-15 08:51:13 +01:00
testImplementation ( project ( ":base" ) )
androidTestImplementation ( project ( ":base" ) )
androidTestApi "androidx.test.espresso:espresso-core:3.5.1"
androidTestApi "androidx.test.ext:junit-ktx:1.1.5"
androidTestApi "androidx.test.ext:junit:1.1.5"
androidTestApi "androidx.test.ext:truth:1.5.0"
androidTestApi "androidx.test:core-ktx:1.5.0"
androidTestApi "androidx.test:core:$androidx_test_version"
androidTestApi "androidx.test:runner:1.5.2"
androidTestApi "org.jetbrains.kotlin:kotlin-test"
androidTestApi "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinx_coroutines_version"
2023-01-17 13:42:47 +01:00
testApi "androidx.arch.core:core-testing:$arch_version"
testApi "junit:junit:$junit_version"
testApi "org.jetbrains.kotlin:kotlin-test"
testApi "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinx_coroutines_version"
2023-01-15 08:51:13 +01:00
// To use android test orchestrator
androidTestUtil "androidx.test:orchestrator:1.4.2"
testApi ( "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"
}
androidTestApi ( "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-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
2023-01-14 11:19:01 +01:00
tasks . register ( "detektAll" , Detekt ) {
description = "Custom DETEKT build for all modules"
2021-06-20 05:02:30 +02:00
// 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
2023-01-14 11:19:01 +01:00
parallel = true
ignoreFailures = false
autoCorrect = false
2021-06-20 05:02:30 +02:00
2023-01-14 11:19:01 +01:00
// preconfigure defaults
buildUponDefaultConfig = true
2023-01-15 08:51:13 +01:00
def configFile = files ( "$rootDir/config/detekt/config.yml" )
2023-01-14 11:19:01 +01:00
config . setFrom ( configFile )
2023-01-15 08:51:13 +01:00
def baselineFile = file ( "$rootDir/config/detekt/baseline.xml" )
2023-01-14 11:19:01 +01:00
if ( baselineFile . isFile ( ) ) {
baseline . set ( baselineFile )
}
2023-01-15 08:51:13 +01:00
source = files (
"$rootDir/apng/src" ,
"$rootDir/apng_android/src" ,
"$rootDir/app/src" ,
"$rootDir/base/src" ,
"$rootDir/colorpicker/src" ,
"$rootDir/emoji/src" ,
"$rootDir/icon_material_symbols/src" ,
"$rootDir/sample_apng/src" ,
)
// def kotlinFiles = "**/*.kt"
// include(kotlinFiles)
def resourceFiles = "**/resources/**"
def buildFiles = "**/build/**"
2023-01-14 11:19:01 +01:00
exclude ( resourceFiles , buildFiles )
reports {
html . enabled = true
xml . enabled = false
txt . enabled = false
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
}
}