54: Cleanup and reformat r=msfjarvis a=msfjarvis

bors r+

Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
bors[bot] 2020-10-29 11:29:57 +00:00 committed by GitHub
commit 97dc62afe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 236 additions and 241 deletions

View file

@ -1,95 +1,95 @@
plugins { plugins {
id "kotlin-kapt" id "kotlin-kapt"
id "dagger.hilt.android.plugin" id "dagger.hilt.android.plugin"
} }
final def keystorePropertiesFile = rootProject.file("keystore.properties") final def keystorePropertiesFile = rootProject.file("keystore.properties")
android { android {
adbOptions { adbOptions {
installOptions = ["--user 0"] installOptions = ["--user 0"]
} }
defaultConfig { defaultConfig {
applicationId "dev.msfjarvis.lobsters" applicationId "dev.msfjarvis.lobsters"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
release { release {
minifyEnabled true minifyEnabled true
proguardFiles "proguard-android-optimize.txt", "proguard-rules.pro" proguardFiles "proguard-android-optimize.txt", "proguard-rules.pro"
}
} }
}
compileOptions.coreLibraryDesugaringEnabled = true compileOptions.coreLibraryDesugaringEnabled = true
buildFeatures.compose = true buildFeatures.compose = true
composeOptions { composeOptions {
kotlinCompilerVersion "${kotlin_version}" kotlinCompilerVersion "${kotlin_version}"
kotlinCompilerExtensionVersion "${compose_version}" kotlinCompilerExtensionVersion "${compose_version}"
} }
if (keystorePropertiesFile.exists()) { if (keystorePropertiesFile.exists()) {
final def keystoreProperties = new Properties() final def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
signingConfigs { signingConfigs {
release { release {
keyAlias keystoreProperties["keyAlias"] keyAlias keystoreProperties["keyAlias"]
keyPassword keystoreProperties["keyPassword"] keyPassword keystoreProperties["keyPassword"]
storeFile rootProject.file(keystoreProperties["storeFile"]) storeFile rootProject.file(keystoreProperties["storeFile"])
storePassword keystoreProperties["storePassword"] storePassword keystoreProperties["storePassword"]
} }
}
buildTypes.debug.signingConfig = signingConfigs.release
buildTypes.release.signingConfig = signingConfigs.release
} }
buildTypes.debug.signingConfig = signingConfigs.release
buildTypes.release.signingConfig = signingConfigs.release
}
} }
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions { kotlinOptions {
freeCompilerArgs += [ freeCompilerArgs += [
"-Xallow-jvm-ir-dependencies", "-Xallow-jvm-ir-dependencies",
"-Xskip-prerelease-check", "-Xskip-prerelease-check",
"-Xopt-in=kotlin.RequiresOptIn", "-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
] ]
} }
} }
dependencies { dependencies {
kapt "com.google.dagger:hilt-compiler:$hilt_dagger_version" kapt "com.google.dagger:hilt-compiler:$hilt_dagger_version"
kapt "androidx.hilt:hilt-compiler:$hilt_androidx_version" kapt "androidx.hilt:hilt-compiler:$hilt_androidx_version"
implementation(project(":data")) implementation(project(":data"))
implementation(project(":lobsters-api")) implementation(project(":lobsters-api"))
implementation(project(":model")) implementation(project(":model"))
implementation "androidx.core:core-ktx:$core_version" implementation "androidx.core:core-ktx:$core_version"
implementation "androidx.activity:activity-ktx:$activity_version" implementation "androidx.activity:activity-ktx:$activity_version"
implementation "androidx.appcompat:appcompat:$appcompat_version" implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.browser:browser:$browser_version" implementation "androidx.browser:browser:$browser_version"
implementation "androidx.compose.foundation:foundation:$compose_version" implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.compose.foundation:foundation-layout:$compose_version" implementation "androidx.compose.foundation:foundation-layout:$compose_version"
implementation "androidx.compose.foundation:foundation-text:$compose_version" implementation "androidx.compose.foundation:foundation-text:$compose_version"
implementation "androidx.compose.runtime:runtime:$compose_version" implementation "androidx.compose.runtime:runtime:$compose_version"
implementation "androidx.compose.material:material:$compose_version" implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.compiler:compiler:$compose_version" implementation "androidx.compose.compiler:compiler:$compose_version"
implementation "androidx.compose.ui:ui:$compose_version" implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-text:$compose_version" implementation "androidx.compose.ui:ui-text:$compose_version"
implementation "androidx.compose.ui:ui-text-android:$compose_version" implementation "androidx.compose.ui:ui-text-android:$compose_version"
implementation "androidx.compose.ui:ui-unit:$compose_version" implementation "androidx.compose.ui:ui-unit:$compose_version"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_androidx_version" implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_androidx_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.navigation:navigation-compose:$nav_compose_version" implementation "androidx.navigation:navigation-compose:$nav_compose_version"
implementation "androidx.ui:ui-tooling:$compose_version" implementation "androidx.ui:ui-tooling:$compose_version"
implementation "com.google.android.material:material:$material_version" implementation "com.google.android.material:material:$material_version"
implementation "com.google.dagger:hilt-android:$hilt_dagger_version" implementation "com.google.dagger:hilt-android:$hilt_dagger_version"
implementation "dev.chrisbanes.accompanist:accompanist-coil:$accompanist_version" implementation "dev.chrisbanes.accompanist:accompanist-coil:$accompanist_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "saschpe.android:customtabs:$customtabs_version" implementation "saschpe.android:customtabs:$customtabs_version"
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_dagger_version" androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_dagger_version"
testImplementation "junit:junit:$junit_version" testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.ui:ui-test:$compose_version" androidTestImplementation "androidx.ui:ui-test:$compose_version"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_version" coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_version"
} }

View file

@ -1,11 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<!-- <application>
If you don't need the activityTestRule, then you can switch to createComposeRule and add <!--
an empty activity here for the test harness to launch. Not having this activity is what If you don't need the activityTestRule, then you can switch to createComposeRule and add
broke my tests when I first started writing them with createComposeRule. Future me will thank an empty activity here for the test harness to launch. Not having this activity is what
past me for writing this note here. broke my tests when I first started writing them with createComposeRule. Future me will thank
--> past me for writing this note here.
<activity android:name="androidx.activity.ComponentActivity" /> -->
</application> <activity android:name="androidx.activity.ComponentActivity" />
</application>
</manifest> </manifest>

View file

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.msfjarvis.lobsters"> package="dev.msfjarvis.lobsters">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application <application
android:name=".Application" android:name=".Application"
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@drawable/ic_launcher_round" android:roundIcon="@drawable/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.MaterialComponents"> android:theme="@style/Theme.MaterialComponents">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/Theme.MaterialComponents.NoActionBar"> android:theme="@style/Theme.MaterialComponents.NoActionBar">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
</manifest> </manifest>

View file

@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.Providers import androidx.compose.runtime.Providers
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.platform.setContent import androidx.compose.ui.platform.setContent
import androidx.compose.ui.res.stringResource
import androidx.navigation.compose.KEY_ROUTE import androidx.navigation.compose.KEY_ROUTE
import androidx.navigation.compose.NavHost import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable import androidx.navigation.compose.composable
@ -47,9 +48,8 @@ class MainActivity : AppCompatActivity() {
@Composable @Composable
fun LobstersApp( fun LobstersApp(
viewModel: LobstersViewModel viewModel: LobstersViewModel,
) { ) {
val urlLauncher = UrlLauncherAmbient.current
val navController = rememberNavController() val navController = rememberNavController()
val destinations = arrayOf(Destination.Hottest, Destination.Saved) val destinations = arrayOf(Destination.Hottest, Destination.Saved)
@ -68,7 +68,7 @@ fun LobstersApp(
} }
) )
}, },
label = { Text(screen.label) }, label = { Text(stringResource(id = screen.labelRes)) },
selected = currentRoute == screen.route, selected = currentRoute == screen.route,
onClick = { onClick = {
// This is the equivalent to popUpTo the start destination // This is the equivalent to popUpTo the start destination

View file

@ -1,12 +1,15 @@
package dev.msfjarvis.lobsters.ui package dev.msfjarvis.lobsters.ui
import androidx.annotation.StringRes
import dev.msfjarvis.lobsters.R
/** /**
* Destinations for navigation within the app. * Destinations for navigation within the app.
*/ */
sealed class Destination( sealed class Destination(
val route: String, val route: String,
val label: String, @StringRes val labelRes: Int,
) { ) {
object Hottest : Destination("hottest", "Hottest") object Hottest : Destination("hottest", R.string.hottest_posts)
object Saved : Destination("saved", "Saved") object Saved : Destination("saved", R.string.saved_posts)
} }

View file

@ -37,5 +37,3 @@ fun SavedPosts(
} }
} }
} }

View file

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="#FF000000" android:fillColor="#FF000000"
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/> android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z" />
</vector> </vector>

View file

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="#FF000000" android:fillColor="#FF000000"
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/> android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z" />
</vector> </vector>

View file

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M17.65,6.35c-1.63,-1.63 -3.94,-2.57 -6.48,-2.31 -3.67,0.37 -6.69,3.35 -7.1,7.02C3.52,15.91 7.27,20 12,20c3.19,0 5.93,-1.87 7.21,-4.56 0.32,-0.67 -0.16,-1.44 -0.9,-1.44 -0.37,0 -0.72,0.2 -0.88,0.53 -1.13,2.43 -3.84,3.97 -6.8,3.31 -2.22,-0.49 -4.01,-2.3 -4.48,-4.52C5.31,9.44 8.26,6 12,6c1.66,0 3.14,0.69 4.22,1.78l-1.51,1.51c-0.63,0.63 -0.19,1.71 0.7,1.71H19c0.55,0 1,-0.45 1,-1V6.41c0,-0.89 -1.08,-1.34 -1.71,-0.71l-0.64,0.65z"/>
</vector>

View file

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="#FF000000" android:fillColor="#FF000000"
android:pathData="M3,12c0,2.21 0.91,4.2 2.36,5.64l-1.51,1.51c-0.31,0.31 -0.09,0.85 0.36,0.85L8.5,20c0.28,0 0.5,-0.22 0.5,-0.5v-4.29c0,-0.45 -0.54,-0.67 -0.85,-0.35l-1.39,1.39C5.68,15.15 5,13.66 5,12c0,-2.39 1.4,-4.46 3.43,-5.42 0.34,-0.16 0.57,-0.47 0.57,-0.84v-0.19c0,-0.68 -0.71,-1.11 -1.32,-0.82C4.92,5.99 3,8.77 3,12zM11,17h2v-2h-2v2zM19.79,4L15.5,4c-0.28,0 -0.5,0.22 -0.5,0.5v4.29c0,0.45 0.54,0.67 0.85,0.35l1.39,-1.39C18.32,8.85 19,10.34 19,12c0,2.39 -1.4,4.46 -3.43,5.42 -0.34,0.16 -0.57,0.47 -0.57,0.84v0.18c0,0.68 0.71,1.11 1.32,0.82C19.08,18.01 21,15.23 21,12c0,-2.21 -0.91,-4.2 -2.36,-5.64l1.51,-1.51c0.31,-0.31 0.09,-0.85 -0.36,-0.85zM12,13c0.55,0 1,-0.45 1,-1L13,8c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v4c0,0.55 0.45,1 1,1z"/> android:pathData="M3,12c0,2.21 0.91,4.2 2.36,5.64l-1.51,1.51c-0.31,0.31 -0.09,0.85 0.36,0.85L8.5,20c0.28,0 0.5,-0.22 0.5,-0.5v-4.29c0,-0.45 -0.54,-0.67 -0.85,-0.35l-1.39,1.39C5.68,15.15 5,13.66 5,12c0,-2.39 1.4,-4.46 3.43,-5.42 0.34,-0.16 0.57,-0.47 0.57,-0.84v-0.19c0,-0.68 -0.71,-1.11 -1.32,-0.82C4.92,5.99 3,8.77 3,12zM11,17h2v-2h-2v2zM19.79,4L15.5,4c-0.28,0 -0.5,0.22 -0.5,0.5v4.29c0,0.45 0.54,0.67 0.85,0.35l1.39,-1.39C18.32,8.85 19,10.34 19,12c0,2.39 -1.4,4.46 -3.43,5.42 -0.34,0.16 -0.57,0.47 -0.57,0.84v0.18c0,0.68 0.71,1.11 1.32,0.82C19.08,18.01 21,15.23 21,12c0,-2.21 -0.91,-4.2 -2.36,-5.64l1.51,-1.51c0.31,-0.31 0.09,-0.85 -0.36,-0.85zM12,13c0.55,0 1,-0.45 1,-1L13,8c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v4c0,0.55 0.45,1 1,1z" />
</vector> </vector>

View file

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="#FF000000" android:fillColor="#FF000000"
android:pathData="M13.5,0.67s0.74,2.65 0.74,4.8c0,2.06 -1.35,3.73 -3.41,3.73 -2.07,0 -3.63,-1.67 -3.63,-3.73l0.03,-0.36C5.21,7.51 4,10.62 4,14c0,4.42 3.58,8 8,8s8,-3.58 8,-8C20,8.61 17.41,3.8 13.5,0.67zM11.71,19c-1.78,0 -3.22,-1.4 -3.22,-3.14 0,-1.62 1.05,-2.76 2.81,-3.12 1.77,-0.36 3.6,-1.21 4.62,-2.58 0.39,1.29 0.59,2.65 0.59,4.04 0,2.65 -2.15,4.8 -4.8,4.8z"/> android:pathData="M13.5,0.67s0.74,2.65 0.74,4.8c0,2.06 -1.35,3.73 -3.41,3.73 -2.07,0 -3.63,-1.67 -3.63,-3.73l0.03,-0.36C5.21,7.51 4,10.62 4,14c0,4.42 3.58,8 8,8s8,-3.58 8,-8C20,8.61 17.41,3.8 13.5,0.67zM11.71,19c-1.78,0 -3.22,-1.4 -3.22,-3.14 0,-1.62 1.05,-2.76 2.81,-3.12 1.77,-0.36 3.6,-1.21 4.62,-2.58 0.39,1.29 0.59,2.65 0.59,4.04 0,2.65 -2.15,4.8 -4.8,4.8z" />
</vector> </vector>

View file

@ -1,5 +1,7 @@
<resources> <resources>
<string name="app_name">lobste.rs</string> <string name="app_name">lobste.rs</string>
<string name="loading">Loading posts…</string> <string name="loading">Loading posts…</string>
<string name="no_saved_posts">You don\'t have any saved posts</string> <string name="no_saved_posts">You don\'t have any saved posts</string>
<string name="hottest_posts">Hottest</string>
<string name="saved_posts">Saved</string>
</resources> </resources>

View file

@ -1,97 +1,97 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext { ext {
accompanist_version = "0.3.2" accompanist_version = "0.3.2"
activity_version = "1.2.0-beta01" activity_version = "1.2.0-beta01"
agp_version = "4.2.0-alpha15" agp_version = "4.2.0-alpha15"
appcompat_version = "1.3.0-alpha02" appcompat_version = "1.3.0-alpha02"
browser_version = "1.3.0-beta01" browser_version = "1.3.0-beta01"
compose_version = "1.0.0-alpha06" compose_version = "1.0.0-alpha06"
core_version = "1.5.0-alpha04" core_version = "1.5.0-alpha04"
coroutines_version = "1.4.0" coroutines_version = "1.4.0"
customtabs_version = "3.0.2" customtabs_version = "3.0.2"
dagger_version = "2.29.1" dagger_version = "2.29.1"
desugar_version = "1.0.10" desugar_version = "1.0.10"
hilt_androidx_version = "1.0.0-alpha02" hilt_androidx_version = "1.0.0-alpha02"
hilt_dagger_version = "2.29.1-alpha" hilt_dagger_version = "2.29.1-alpha"
junit_version = "4.13.1" junit_version = "4.13.1"
kotlin_version = "1.4.10" kotlin_version = "1.4.10"
lifecycle_version = "2.3.0-beta01" lifecycle_version = "2.3.0-beta01"
material_version = "1.3.0-alpha03" material_version = "1.3.0-alpha03"
moshi_version = "1.11.0" moshi_version = "1.11.0"
nav_compose_version = "1.0.0-alpha01" nav_compose_version = "1.0.0-alpha01"
okhttp_version = "4.10.0-RC1" okhttp_version = "4.10.0-RC1"
retrofit_version = "2.9.0" retrofit_version = "2.9.0"
room_version = "2.3.0-alpha03" room_version = "2.3.0-alpha03"
} }
repositories { repositories {
google() google()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath "com.android.tools.build:gradle:$agp_version" classpath "com.android.tools.build:gradle:$agp_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_dagger_version" classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_dagger_version"
} }
} }
plugins { plugins {
id("com.github.ben-manes.versions") version "0.33.0" id("com.github.ben-manes.versions") version "0.33.0"
} }
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter() jcenter()
} }
} }
subprojects { subprojects {
repositories { repositories {
google() google()
jcenter() jcenter()
} }
if (name == "app") { if (name == "app") {
apply plugin: "com.android.application" apply plugin: "com.android.application"
} else { } else {
apply plugin: "com.android.library" apply plugin: "com.android.library"
} }
apply plugin: "kotlin-android" apply plugin: "kotlin-android"
android { android {
compileSdkVersion 30 compileSdkVersion 30
defaultConfig { defaultConfig {
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 30 targetSdkVersion 30
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
configurations.all { compileOptions {
resolutionStrategy { sourceCompatibility JavaVersion.VERSION_1_8
force "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" targetCompatibility JavaVersion.VERSION_1_8
force "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
force "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
}
} }
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { }
kotlinOptions { configurations.all {
jvmTarget = JavaVersion.VERSION_1_8 resolutionStrategy {
} force "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
force "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
force "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
} }
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
} }
task clean(type: Delete) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
tasks { tasks {
wrapper { wrapper {
gradleVersion = "6.7" gradleVersion = "6.7"
distributionType = Wrapper.DistributionType.ALL distributionType = Wrapper.DistributionType.ALL
} }
} }

View file

@ -1,12 +1,12 @@
plugins { plugins {
id 'kotlin-kapt' id 'kotlin-kapt'
} }
dependencies { dependencies {
implementation project(":model") implementation project(":model")
kapt "androidx.room:room-compiler:$room_version" kapt "androidx.room:room-compiler:$room_version"
api "androidx.room:room-runtime:$room_version" api "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version" implementation "androidx.room:room-ktx:$room_version"
implementation "com.squareup.moshi:moshi:$moshi_version" implementation "com.squareup.moshi:moshi:$moshi_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
} }

View file

@ -1,14 +1,14 @@
plugins { plugins {
id 'kotlin-kapt' id 'kotlin-kapt'
} }
dependencies { dependencies {
implementation project(":model") implementation project(":model")
implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version" implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
kaptTest "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version" kaptTest "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
testImplementation "junit:junit:$junit_version" testImplementation "junit:junit:$junit_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
//noinspection GradleDependency //noinspection GradleDependency
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp_version" testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp_version"
} }

View file

@ -1,8 +1,8 @@
plugins { plugins {
id 'kotlin-kapt' id 'kotlin-kapt'
} }
dependencies { dependencies {
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version" kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
implementation "com.squareup.moshi:moshi:$moshi_version" implementation "com.squareup.moshi:moshi:$moshi_version"
} }