plugins {
	id 'com.android.application'
	id 'kotlin-android'
	id 'kotlin-kapt'
	id 'kotlin-parcelize'
	id 'dagger.hilt.android.plugin'
}

android {
	compileSdk = 33
	buildToolsVersion = '33.0.1'
	namespace = 'org.koitharu.kotatsu'

	defaultConfig {
		applicationId 'org.koitharu.kotatsu'
		minSdkVersion 21
		targetSdkVersion 33
		versionCode 515
		versionName '4.4-beta1'
		generatedDensities = []
		testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

		kapt {
			arguments {
				arg 'room.schemaLocation', "$projectDir/schemas".toString()
			}
		}

		// define this values in your local.properties file
		buildConfigField 'String', 'SHIKIMORI_CLIENT_ID', "\"${localProperty('shikimori.clientId')}\""
		buildConfigField 'String', 'SHIKIMORI_CLIENT_SECRET', "\"${localProperty('shikimori.clientSecret')}\""
		buildConfigField 'String', 'ANILIST_CLIENT_ID', "\"${localProperty('anilist.clientId')}\""
		buildConfigField 'String', 'ANILIST_CLIENT_SECRET', "\"${localProperty('anilist.clientSecret')}\""
		buildConfigField 'String', 'MAL_CLIENT_ID', "\"${localProperty('mal.clientId')}\""
		resValue "string", "acra_login", "${localProperty('acra.login')}"
		resValue "string", "acra_password", "${localProperty('acra.password')}"
	}
	buildTypes {
		debug {
			applicationIdSuffix = '.debug'
		}
		release {
			multiDexEnabled false
			minifyEnabled true
			shrinkResources true
			proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
		}
	}
	buildFeatures {
		viewBinding true
	}
	sourceSets {
		androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
	}
	compileOptions {
		sourceCompatibility JavaVersion.VERSION_1_8
		targetCompatibility JavaVersion.VERSION_1_8
	}
	kotlinOptions {
		jvmTarget = JavaVersion.VERSION_1_8.toString()
		freeCompilerArgs += [
			'-opt-in=kotlin.ExperimentalStdlibApi',
			'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
			'-opt-in=kotlinx.coroutines.FlowPreview',
			'-opt-in=kotlin.contracts.ExperimentalContracts',
			'-opt-in=coil.annotation.ExperimentalCoilApi',
			'-opt-in=com.google.android.material.badge.ExperimentalBadgeUtils',
		]
	}
	lint {
		abortOnError false
		disable 'MissingTranslation', 'PrivateResource', 'NotifyDataSetChanged'
	}
	testOptions {
		unitTests.includeAndroidResources true
		unitTests.returnDefaultValues false
		kotlinOptions {
			freeCompilerArgs += ['-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi']
		}
	}
}
afterEvaluate {
	compileDebugKotlin {
		kotlinOptions {
			freeCompilerArgs += ['-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi']
		}
	}
}
dependencies {
	implementation('com.github.KotatsuApp:kotatsu-parsers:05d705ac03') {
		exclude group: 'org.json', module: 'json'
	}

	implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.8.10'
	implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'

	implementation 'androidx.appcompat:appcompat:1.6.1'
	implementation 'androidx.core:core-ktx:1.9.0'
	implementation 'androidx.activity:activity-ktx:1.6.1'
	implementation 'androidx.fragment:fragment-ktx:1.5.5'
	implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
	implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
	implementation 'androidx.lifecycle:lifecycle-service:2.5.1'
	implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
	implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
	implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
	implementation 'androidx.recyclerview:recyclerview:1.2.1'
	implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
	implementation 'androidx.preference:preference-ktx:1.2.0'
	implementation 'androidx.work:work-runtime-ktx:2.8.0'
	implementation 'androidx.biometric:biometric-ktx:1.2.0-alpha05'
	implementation 'com.google.android.material:material:1.8.0'
	//noinspection LifecycleAnnotationProcessorWithJava8
	kapt 'androidx.lifecycle:lifecycle-compiler:2.5.1'

	implementation 'androidx.room:room-runtime:2.5.0'
	implementation 'androidx.room:room-ktx:2.5.0'
	kapt 'androidx.room:room-compiler:2.5.0'

	implementation 'com.squareup.okhttp3:okhttp:4.10.0'
	implementation 'com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.3'
	implementation 'com.squareup.okio:okio:3.3.0'

	implementation 'com.hannesdorfmann:adapterdelegates4-kotlin-dsl:4.3.2'
	implementation 'com.hannesdorfmann:adapterdelegates4-kotlin-dsl-viewbinding:4.3.2'

	implementation 'com.google.dagger:hilt-android:2.44.2'
	kapt 'com.google.dagger:hilt-compiler:2.44.2'
	implementation 'androidx.hilt:hilt-work:1.0.0'
	kapt 'androidx.hilt:hilt-compiler:1.0.0'

	implementation 'io.coil-kt:coil-base:2.2.2'
	implementation 'io.coil-kt:coil-svg:2.2.2'
	implementation 'com.github.KotatsuApp:subsampling-scale-image-view:1b19231b2f'
	implementation 'com.github.solkin:disk-lru-cache:1.4'
	implementation 'io.noties.markwon:core:4.6.2'

	implementation 'ch.acra:acra-http:5.9.7'
	implementation 'ch.acra:acra-dialog:5.9.7'

	debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'

	testImplementation 'junit:junit:4.13.2'
	testImplementation 'org.json:json:20220924'
	testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'

	androidTestImplementation 'androidx.test:runner:1.5.2'
	androidTestImplementation 'androidx.test:rules:1.5.0'
	androidTestImplementation 'androidx.test:core-ktx:1.5.0'
	androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.5'

	androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'

	androidTestImplementation 'androidx.room:room-testing:2.5.0'
	androidTestImplementation 'com.squareup.moshi:moshi-kotlin:1.14.0'

	androidTestImplementation 'com.google.dagger:hilt-android-testing:2.44.2'
	kaptAndroidTest 'com.google.dagger:hilt-android-compiler:2.44.2'
}
