Skip to content

Commit

Permalink
[GRADLE] Create shared gradle file for feature modules
Browse files Browse the repository at this point in the history
  • Loading branch information
peterkrauz committed Sep 28, 2020
1 parent a96c44b commit 7b8edab
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 129 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "Grimoire"
firebaseAppDistribution {
releaseNotesFile="releasenotes.txt"
releaseNotesFile = "releasenotes.txt"
}
}
beta {
Expand All @@ -48,9 +48,9 @@ android {
versionNameSuffix "-beta"
resValue "string", "app_name", "Grimoire Beta"
firebaseAppDistribution {
releaseNotesFile="releasenotes.txt"
testers=firebaseBetaTesters
groups=firebaseBetaGroups
releaseNotesFile = "releasenotes.txt"
testers = firebaseBetaTesters
groups = firebaseBetaGroups
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/java/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ object Android {
const val appCompat = "androidx.appcompat:appcompat:${Versions.appCompat}"
const val constraintLayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}"
const val lifeCycleExtensions = "androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}"
const val lifeCycleLiveData = "androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle}"
const val lifeCycleCommonJava8 = "androidx.lifecycle:lifecycle-common-java8:${Versions.lifecycle}"
}

object Jetpack {
Expand Down
17 changes: 16 additions & 1 deletion common/src/main/res/navigation/app_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,33 @@

<fragment
android:id="@+id/arcsFragment"
android:name="com.peterkrauz.grimoire.presentation.home.ArcsFragment" />
android:label="ArcsFragment"
android:name="com.peterkrauz.grimoire.presentation.home.ArcsFragment">

<action
android:id="@+id/addArc"
app:enterAnim="@android:anim/slide_out_right"
app:destination="@id/addArcFragment" />
</fragment>

<fragment
android:id="@+id/addArcFragment"
android:label="AddArcsFragment"
android:name="com.peterkrauz.grimoire.presentation.home.add.AddArcFragment" />

<fragment
android:id="@+id/charactersFragment"
android:label="CharactersFragment"
android:name="com.peterkrauz.grimoire.presentation.characters.CharactersFragment" />

<fragment
android:id="@+id/notesFragment"
android:label="NotesFragment"
android:name="com.peterkrauz.grimoire.presentation.notes.NotesFragment" />

<fragment
android:id="@+id/tagsFragment"
android:label="TagsFragment"
android:name="com.peterkrauz.grimoire.presentation.tags.TagsFragment" />

</navigation>
31 changes: 31 additions & 0 deletions feature-config.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
android {
compileSdkVersion AndroidConfig.compileSdkVersion
buildToolsVersion AndroidConfig.buildToolsVersion

defaultConfig {
minSdkVersion AndroidConfig.minSdkVersion
targetSdkVersion AndroidConfig.targetSdkVersion
versionCode AndroidConfig.versionCode
versionName AndroidConfig.versionName

testInstrumentationRunner AndroidConfig.testInstrumentationRunner
consumerProguardFiles AndroidConfig.consumerProguardFile
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
beta {
initWith debug
}
}
compileOptions {
sourceCompatibility = AndroidConfig.javaVersion
targetCompatibility = AndroidConfig.javaVersion
}
kotlinOptions {
jvmTarget = AndroidConfig.jvmTarget
}
}
33 changes: 2 additions & 31 deletions presentation/characters/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,13 @@ plugins {
id 'dagger.hilt.android.plugin'
}

android {
compileSdkVersion AndroidConfig.compileSdkVersion
buildToolsVersion AndroidConfig.buildToolsVersion

defaultConfig {
minSdkVersion AndroidConfig.minSdkVersion
targetSdkVersion AndroidConfig.targetSdkVersion
versionCode AndroidConfig.versionCode
versionName AndroidConfig.versionName

testInstrumentationRunner AndroidConfig.testInstrumentationRunner
consumerProguardFiles AndroidConfig.consumerProguardFile
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
beta {
initWith debug
}
}
compileOptions {
sourceCompatibility = AndroidConfig.javaVersion
targetCompatibility = AndroidConfig.javaVersion
}
kotlinOptions {
jvmTarget = AndroidConfig.jvmTarget
}
}
apply from: "$rootProject.projectDir/feature-config.gradle"

dependencies {
implementation Kotlin.standardLibrary
implementation Android.coreKtx
implementation Android.constraintLayout
implementation Navigation.navigationFragment
implementation Hilt.android
implementation Hilt.viewModel
kapt Hilt.compiler
Expand Down
33 changes: 2 additions & 31 deletions presentation/home/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,13 @@ plugins {
id 'dagger.hilt.android.plugin'
}

android {
compileSdkVersion AndroidConfig.compileSdkVersion
buildToolsVersion AndroidConfig.buildToolsVersion

defaultConfig {
minSdkVersion AndroidConfig.minSdkVersion
targetSdkVersion AndroidConfig.targetSdkVersion
versionCode AndroidConfig.versionCode
versionName AndroidConfig.versionName

testInstrumentationRunner AndroidConfig.testInstrumentationRunner
consumerProguardFiles AndroidConfig.consumerProguardFile
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
beta {
initWith debug
}
}
compileOptions {
sourceCompatibility = AndroidConfig.javaVersion
targetCompatibility = AndroidConfig.javaVersion
}
kotlinOptions {
jvmTarget = AndroidConfig.jvmTarget
}
}
apply from: "$rootProject.projectDir/feature-config.gradle"

dependencies {
implementation Kotlin.standardLibrary
implementation Android.coreKtx
implementation Android.constraintLayout
implementation Navigation.navigationFragment
implementation Hilt.android
implementation Hilt.viewModel
kapt Hilt.compiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ package com.peterkrauz.grimoire.presentation.home

import android.media.MediaPlayer
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class ArcsFragment : Fragment(R.layout.fragment_arcs) {

private val viewModel: ArcsViewModel by viewModels()

private var mediaPlayer: MediaPlayer? = null

override fun onResume() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.peterkrauz.grimoire.presentation.home

import androidx.hilt.Assisted
import androidx.hilt.lifecycle.ViewModelInject
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel

class ArcsViewModel @ViewModelInject constructor(
@Assisted private val savedStateHandle: SavedStateHandle
) : ViewModel() {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.peterkrauz.grimoire.presentation.home.add

class AddArcFragment
33 changes: 2 additions & 31 deletions presentation/notes/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,13 @@ plugins {
id 'dagger.hilt.android.plugin'
}

android {
compileSdkVersion AndroidConfig.compileSdkVersion
buildToolsVersion AndroidConfig.buildToolsVersion

defaultConfig {
minSdkVersion AndroidConfig.minSdkVersion
targetSdkVersion AndroidConfig.targetSdkVersion
versionCode AndroidConfig.versionCode
versionName AndroidConfig.versionName

testInstrumentationRunner AndroidConfig.testInstrumentationRunner
consumerProguardFiles AndroidConfig.consumerProguardFile
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
beta {
initWith debug
}
}
compileOptions {
sourceCompatibility = AndroidConfig.javaVersion
targetCompatibility = AndroidConfig.javaVersion
}
kotlinOptions {
jvmTarget = AndroidConfig.jvmTarget
}
}
apply from: "$rootProject.projectDir/feature-config.gradle"

dependencies {
implementation Kotlin.standardLibrary
implementation Android.coreKtx
implementation Android.constraintLayout
implementation Navigation.navigationFragment
implementation Hilt.android
implementation Hilt.viewModel
kapt Hilt.compiler
Expand Down
33 changes: 2 additions & 31 deletions presentation/tags/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,13 @@ plugins {
id 'dagger.hilt.android.plugin'
}

android {
compileSdkVersion AndroidConfig.compileSdkVersion
buildToolsVersion AndroidConfig.buildToolsVersion

defaultConfig {
minSdkVersion AndroidConfig.minSdkVersion
targetSdkVersion AndroidConfig.targetSdkVersion
versionCode AndroidConfig.versionCode
versionName AndroidConfig.versionName

testInstrumentationRunner AndroidConfig.testInstrumentationRunner
consumerProguardFiles AndroidConfig.consumerProguardFile
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
beta {
initWith debug
}
}
compileOptions {
sourceCompatibility = AndroidConfig.javaVersion
targetCompatibility = AndroidConfig.javaVersion
}
kotlinOptions {
jvmTarget = AndroidConfig.jvmTarget
}
}
apply from: "$rootProject.projectDir/feature-config.gradle"

dependencies {
implementation Kotlin.standardLibrary
implementation Android.coreKtx
implementation Android.constraintLayout
implementation Navigation.navigationFragment
implementation Hilt.android
implementation Hilt.viewModel
kapt Hilt.compiler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.peterkrauz.grimoire.presentation.tags

import androidx.fragment.app.Fragment
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class TagsFragment : Fragment(R.layout.fragment_tags)

0 comments on commit 7b8edab

Please sign in to comment.