Skip to content

Commit

Permalink
migrate to kotlin dsl & add buildSrc for management gradle
Browse files Browse the repository at this point in the history
dapoi committed Oct 18, 2023
1 parent 77c448a commit 8ed329f
Showing 17 changed files with 284 additions and 212 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/kotlinScripting.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 0 additions & 65 deletions app/build.gradle

This file was deleted.

76 changes: 76 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import com.dapascript.buildsrc.Libs

plugins {
id("com.android.application")
id("com.google.devtools.ksp")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.kapt")
id("dagger.hilt.android.plugin")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
}

android {
namespace = "com.prodev.muslimq"
compileSdk = 34

signingConfigs {
create("release") {
storeFile = file("D:\\Projek\\Key\\muslimkey.jks")
storePassword = "Lutpi220201"
keyAlias = "muslimq"
keyPassword = "Lutpi220201"
}
}

defaultConfig {
applicationId = Libs.appId
minSdk = Libs.minSdk
targetSdk = Libs.targetSdk
versionCode = Libs.versionCode
versionName = Libs.versionName

testInstrumentationRunner = Libs.testInstrumentationRunner
vectorDrawables.useSupportLibrary = true
signingConfig = signingConfigs.getByName("release")
}

android {
ndkVersion = "21.4.7075529"
}

buildTypes {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
getByName("debug") {
applicationIdSuffix = ".debug"
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}

buildFeatures {
viewBinding = true
}
}

dependencies {
// Apply shared dependencies
Libs.applySharedDeps(dependencies)

// Core
implementation(project(":core"))
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.MuslimQ"
android:usesCleartextTraffic="true"
tools:targetApi="31">
tools:targetApi="34">

<activity
android:name="com.prodev.muslimq.presentation.MainActivity"
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.apachat.primecalendar.core.hijri.HijriCalendar
import com.aminography.primecalendar.hijri.HijriCalendar
import com.google.android.gms.common.api.ResolvableApiException
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationCallback
@@ -407,9 +407,9 @@ class ShalatFragment : BaseFragment<FragmentShalatBinding>(FragmentShalatBinding
val date = simpleDateFormat.format(Date())
tvGregorianDate.text = date

val hijriCalendar = HijriCalendar()
val hijriCalendar = HijriCalendar(locale = indonesia)
val hijriDate =
"${hijriCalendar.dayOfMonth} ${hijriCalendar.monthName} ${hijriCalendar.year}H"
"${hijriCalendar.dayOfMonth} ${hijriCalendar.monthName} ${hijriCalendar.year} H"
tvIslamicDate.text = hijriDate
}
}
19 changes: 0 additions & 19 deletions build.gradle

This file was deleted.

18 changes: 18 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// change to kts
buildscript {
dependencies {
classpath("com.android.tools.build:gradle:8.1.0")
classpath("com.google.gms:google-services:4.3.15")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.8")
}
}

plugins {
id("com.android.application") version "8.1.0" apply false
id("com.android.library") version "8.1.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.20" apply false
id("com.google.dagger.hilt.android") version "2.44" apply false
id("com.google.devtools.ksp") version "1.8.21-1.0.11" apply false
id("org.jetbrains.kotlin.jvm") version "1.8.21" apply false
}
1 change: 1 addition & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
`kotlin-dsl`
}

repositories {
google()
mavenCentral()
gradlePluginPortal()
}
77 changes: 77 additions & 0 deletions buildSrc/src/main/java/com/dapascript/buildsrc/Libs.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.dapascript.buildsrc

import org.gradle.api.artifacts.dsl.DependencyHandler

object Libs {

const val appId = "com.prodev.muslimq"
const val minSdk = 24
const val targetSdk = 34
const val versionCode = 20231018
const val versionName = "2.7.1"
const val testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

private fun DependencyHandler.implementation(dependency: Any) {
add("implementation", dependency)
}

private fun DependencyHandler.kapt(dependency: Any) {
add("kapt", dependency)
}

private fun DependencyHandler.debugImplementation(dependency: Any) {
add("debugImplementation", dependency)
}

private fun DependencyHandler.releaseImplementation(dependency: Any) {
add("releaseImplementation", dependency)
}

fun applySharedDeps(dependencyHandler: DependencyHandler) {
dependencyHandler.apply {
// Main
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.datastore:datastore-preferences:1.0.0")

// Testing
implementation("junit:junit:4.13.2")
implementation("androidx.test.ext:junit:1.1.5")
implementation("androidx.test.espresso:espresso-core:3.5.1")

// Appearance
implementation("com.github.bumptech.glide:glide:4.14.2")
implementation("com.airbnb.android:lottie:5.2.0")
implementation("com.facebook.shimmer:shimmer:0.5.0")
implementation("com.github.SimformSolutionsPvtLtd:SSPullToRefresh:1.3")
implementation("com.tbuonomo:dotsindicator:4.2")
implementation("com.aminography:primecalendar:1.7.0")

// Navigation
val navigationVersion = "2.5.3"
implementation("androidx.navigation:navigation-fragment-ktx:$navigationVersion")
implementation("androidx.navigation:navigation-ui-ktx:$navigationVersion")

// Dagger hilt
val daggerHiltVersion = "2.44"
implementation("com.google.dagger:hilt-android:$daggerHiltVersion")
kapt("com.google.dagger:hilt-android-compiler:$daggerHiltVersion")

// Chuck library
val chuckVersion = "3.5.2"
debugImplementation("com.github.chuckerteam.chucker:library:$chuckVersion")
releaseImplementation("com.github.chuckerteam.chucker:library-no-op:$chuckVersion")

// Firebase
implementation("com.google.firebase:firebase-crashlytics-ktx:18.4.3")

// API Splash Screen
implementation("androidx.core:core-splashscreen:1.0.1")

// ShowCaseView
implementation("uk.co.samuelwall:material-tap-target-prompt:3.3.2")
}
}
}
Loading
Oops, something went wrong.

0 comments on commit 8ed329f

Please sign in to comment.