Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
Organized gradle files and dependencies
Browse files Browse the repository at this point in the history
Getting ready for modularization
  • Loading branch information
AnkitSuda committed Nov 14, 2021
1 parent b6edc55 commit d475ee4
Show file tree
Hide file tree
Showing 9 changed files with 268 additions and 84 deletions.
153 changes: 91 additions & 62 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.ankitsuda.rebound.buildSrc.App
import com.ankitsuda.rebound.buildSrc.Deps

plugins {
id 'com.android.application'
id 'kotlin-android'
Expand All @@ -6,21 +9,19 @@ plugins {
}

android {
compileSdk 31
compileSdk App.compileSdkVersion

defaultConfig {
applicationId "com.ankitsuda.rebound"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0.0"
applicationId App.id
targetSdkVersion App.targetSdkVersion
minSdkVersion App.minSdkVersion
versionCode App.versionCode
versionName "${App.versionName}"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}

buildTypes {
release {
// Using debug signing configs as of now
Expand All @@ -43,67 +44,95 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.5.31'
kotlinCompilerExtensionVersion Deps.Android.Compose.version
// kotlinCompilerVersion '1.5.31'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}

repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
// implementation 'androidx.appcompat:appcompat:1.3.1'
// implementation 'com.google.android.material:material:1.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.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.activity:activity-compose:1.4.0'
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"

implementation 'com.jakewharton.timber:timber:5.0.1'

//Hilt
implementation "com.google.dagger:hilt-android:2.40"
kapt "com.google.dagger:hilt-compiler:2.40"
// Navigation Compose Hilt Integration : Navigation Compose Hilt Integration
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'

//navigation
// implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
// implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
implementation "androidx.navigation:navigation-compose:2.4.0-beta02"

implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"

def accompanistVersion = "0.21.2-beta"
implementation "com.google.accompanist:accompanist-pager:$accompanistVersion"
implementation "com.google.accompanist:accompanist-pager-indicators:$accompanistVersion"
implementation "com.google.accompanist:accompanist-insets:$accompanistVersion"
implementation "com.google.accompanist:accompanist-flowlayout:$accompanistVersion"
implementation "com.google.accompanist:accompanist-placeholder-material:$accompanistVersion"
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion"
implementation "com.google.accompanist:accompanist-navigation-material:$accompanistVersion"

def room_version = "2.3.0"
// implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"

implementation "org.threeten:threetenbp:1.5.1"

implementation "androidx.datastore:datastore-preferences:1.0.0"

testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
// implementation Deps.Kotlin.coroutinesAndroid

// utils
// implementation Deps.Utils.proguardSnippets

kapt Deps.Android.Lifecycle.compiler

// dagger-2
implementation Deps.Dagger.hilt
// kapt Deps.Dagger.compiler
kapt Deps.Dagger.hiltCompiler

// leak canary
//debugImplementation Deps.LeakCanary.leakCanary


// OTHER
// api Deps.Kotlin.stdlib

api Deps.Utils.coil

api Deps.Dagger.hilt

// android
api Deps.Android.activityCompose

// api Deps.Android.navigationUi
api Deps.Android.navigationCompose
api Deps.Android.navigationHiltCompose
api Deps.Android.dataStore

api Deps.Android.Compose.ui
api Deps.Android.Compose.uiUtil
api Deps.Android.Compose.uiTooling
api Deps.Android.Compose.foundation
api Deps.Android.Compose.materialDesign
api Deps.Android.Compose.materialDesignIcons
api Deps.Android.Compose.materialDesignIconsExtended
api Deps.Android.Compose.constraintLayout
api Deps.Android.Compose.liveData
api Deps.Android.Compose.activity
api Deps.Android.Compose.viewModels
api Deps.Android.Compose.paging
api Deps.Android.Compose.coil

api Deps.Android.Accompanist.insets
api Deps.Android.Accompanist.insetsUi
api Deps.Android.Accompanist.pager
api Deps.Android.Accompanist.pagerIndicators
api Deps.Android.Accompanist.placeholder
api Deps.Android.Accompanist.systemUiController
api Deps.Android.Accompanist.navigationMaterial
api Deps.Android.Accompanist.navigationFlowlayout

api Deps.Android.Lifecycle.runtime
api Deps.Android.Lifecycle.runtimeKtx
kapt Deps.Android.Lifecycle.compiler
api Deps.Android.Lifecycle.extensions
api Deps.Android.Lifecycle.vmKotlin
api Deps.Android.Lifecycle.vmSavedState

kapt Deps.Android.Room.compiler
api Deps.Android.Room.runtime
api Deps.Android.Room.ktx
api Deps.Android.Room.paging

api Deps.Android.Paging.common
api Deps.Android.Paging.runtime

api Deps.Utils.timber
api Deps.Utils.threeTen

api Deps.Dagger.hilt
kapt Deps.Dagger.hiltCompiler
// api Deps.Dagger.hiltGradle

}
41 changes: 31 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

import com.ankitsuda.rebound.buildSrc.Deps

buildscript {
ext {
compose_version = '1.1.0-beta02'
repositories {
google()
mavenCentral()
}

dependencies {
classpath Deps.Android.gradle
classpath Deps.Kotlin.gradle
// classpath Deps.Android.navigationSafeArgs
classpath Deps.Dagger.hiltGradle
}
}


allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40'
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.FlowPreview"
freeCompilerArgs += "-Xopt-in=kotlin.Experimental"
freeCompilerArgs += "-Xopt-in=coil.annotation.ExperimentalCoilApi"
freeCompilerArgs += "-Xopt-in=com.google.accompanist.pager.ExperimentalPagerApi"
}
}
}

subprojects {
configurations.configureEach {
exclude group: 'androidx.appcompat'
exclude group: 'com.google.android.material', module: 'material'
}
}

task clean(type: Delete) {
delete rootProject.buildDir
Expand Down
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
jcenter()
}
Empty file added buildSrc/settings.gradle
Empty file.
11 changes: 11 additions & 0 deletions buildSrc/src/main/java/com/ankitsuda/rebound/buildSrc/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.ankitsuda.rebound.buildSrc

object App {
const val id = "com.ankitsuda.rebound"

const val compileSdkVersion = 31
const val targetSdkVersion = 31
const val minSdkVersion = 21
const val versionCode = 1
const val versionName = "1.0.0"
}
123 changes: 123 additions & 0 deletions buildSrc/src/main/java/com/ankitsuda/rebound/buildSrc/Deps.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package com.ankitsuda.rebound.buildSrc

object Deps {
object Gradle {
}

object Kotlin {
const val version = "1.5.31"

const val gradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
}

object Android {
private const val gradleVersion = "7.0.3"

const val gradle = "com.android.tools.build:gradle:$gradleVersion"

const val activityVersion = "1.4.0"
const val activityCompose = "androidx.activity:activity-compose:$activityVersion"

private const val navigationVersion = "2.4.0-beta02"
// const val navigationSafeArgs = "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0-beta01"
const val navigationCompose = "androidx.navigation:navigation-compose:$navigationVersion"
const val navigationHiltCompose = "androidx.hilt:hilt-navigation-compose:1.0.0-alpha03"

const val dataStore = "androidx.datastore:datastore-preferences:1.0.0"

object Compose {
const val version = "1.1.0-beta02"

const val ui = "androidx.compose.ui:ui:$version"
const val uiUtil = "androidx.compose.ui:ui-util:$version"
const val uiTooling = "androidx.compose.ui:ui-tooling:$version"
const val foundation = "androidx.compose.foundation:foundation:$version"
const val materialDesign = "androidx.compose.material:material:$version"
const val materialDesignIcons = "androidx.compose.material:material-icons-core:$version"
const val materialDesignIconsExtended = "androidx.compose.material:material-icons-extended:$version"
const val constraintLayout = "androidx.constraintlayout:constraintlayout-compose:1.0.0-rc01"
const val liveData = "androidx.compose.runtime:runtime-livedata:$version"
const val activity = "androidx.activity:activity-compose:$activityVersion"
const val viewModels = "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0"
const val paging = "androidx.paging:paging-compose:1.0.0-alpha14"

// private const val lottieVersion = "4.2.0"
// const val lottie = "com.airbnb.android:lottie-compose:$lottieVersion"

const val coil = "io.coil-kt:coil-compose:${Utils.coilVersion}"
// const val reorderable = "org.burnoutcrew.composereorderable:reorderable:0.7.0"
}

object Accompanist {
private const val version = "0.21.2-beta"

const val insets = "com.google.accompanist:accompanist-insets:$version"
const val insetsUi = "com.google.accompanist:accompanist-insets-ui:$version"
const val pager = "com.google.accompanist:accompanist-pager:$version"
const val pagerIndicators = "com.google.accompanist:accompanist-pager-indicators:$version"

// const val permissions = "com.google.accompanist:accompanist-permissions:$version"
const val placeholder = "com.google.accompanist:accompanist-placeholder-material:$version"
// const val swiperefresh = "com.google.accompanist:accompanist-swiperefresh:$version"
const val systemUiController = "com.google.accompanist:accompanist-systemuicontroller:$version"
const val navigationMaterial = "com.google.accompanist:accompanist-navigation-material:$version"
const val navigationFlowlayout = "com.google.accompanist:accompanist-flowlayout:$version"
}

object Lifecycle {
private const val version = "2.4.0"
private const val vmSavedStateVersion = "2.4.0"

const val runtime = "androidx.lifecycle:lifecycle-runtime:$version"
const val runtimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:$version"
const val compiler = "androidx.lifecycle:lifecycle-compiler:$version"
const val vmKotlin = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
const val vmSavedState = "androidx.lifecycle:lifecycle-viewmodel-savedstate:$vmSavedStateVersion"
const val extensions = "androidx.lifecycle:lifecycle-extensions:2.2.0"
}

object Room {
private const val roomVersion = "2.4.0-beta01"

const val compiler = "androidx.room:room-compiler:$roomVersion"
const val runtime = "androidx.room:room-runtime:$roomVersion"
const val ktx = "androidx.room:room-ktx:$roomVersion"
const val paging = "androidx.room:room-paging:$roomVersion"
}

object Paging {
private const val version = "3.1.0-beta01"

const val common = "androidx.paging:paging-common-ktx:$version"
const val runtime = "androidx.paging:paging-runtime-ktx:$version"
}
}

object Utils {
const val timber = "com.jakewharton.timber:timber:5.0.1"
// const val threeTenAbp = "com.jakewharton.threetenabp:threetenabp:1.3.1"

const val junit = "junit:junit:4.13.2"
const val threeTen = "org.threeten:threetenbp:1.5.1"

const val coilVersion = "2.0.0-alpha02"
const val coil = "io.coil-kt:coil:$coilVersion"
}


object Dagger {
private const val version = "2.40"

const val hiltVersion = "2.40"
const val hilt = "com.google.dagger:hilt-android:$hiltVersion"
const val hiltCompiler = "com.google.dagger:hilt-compiler:$hiltVersion"
const val hiltGradle = "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion"
}

object LeakCanary {
private const val version = "2.7"

const val leakCanary = "com.squareup.leakcanary:leakcanary-android:$version"
}

}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.code.style=official
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.caching=true
Loading

0 comments on commit d475ee4

Please sign in to comment.