diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 8e6d21a..463cf29 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -12,6 +12,7 @@
+
diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index 8034392..0000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,89 +0,0 @@
-plugins {
- id 'com.android.application'
- id 'org.jetbrains.kotlin.android'
-}
-
-android {
- compileSdk 33
-
- defaultConfig {
- applicationId "ru.megboyzz.dnevnik"
- minSdk 21
- targetSdk 32
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- vectorDrawables {
- useSupportLibrary true
- }
- multiDexEnabled true
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- coreLibraryDesugaringEnabled true
- }
- kotlinOptions {
- jvmTarget = '1.8'
- freeCompilerArgs = ['-Xjvm-default=compatibility']
- }
- buildFeatures {
- compose true
- }
- composeOptions {
- kotlinCompilerExtensionVersion compose_version
- }
- packagingOptions {
- resources {
- excludes += '/META-INF/{AL2.0,LGPL2.1}'
- }
- }
-}
-
-dependencies {
-
- implementation 'androidx.core:core-ktx:1.7.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.3.1'
- implementation 'androidx.activity:activity-compose:1.3.1'
- implementation 'androidx.constraintlayout:constraintlayout-compose:1.0.1'
- testImplementation 'junit:junit:4.13.2'
- 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"
- debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
-
- implementation "androidx.navigation:navigation-compose:2.5.3"
-
- implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
- implementation "androidx.compose.material:material-icons-extended:$compose_version"
- implementation "com.google.accompanist:accompanist-swiperefresh:0.23.0"
- implementation "com.google.accompanist:accompanist-navigation-animation:0.30.0"
-
- implementation 'com.squareup.retrofit2:retrofit:2.9.0'
- implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
- coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
-
- //Библиотечка для рисования круговых диаграмок
- implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
-
- //LazyHorizontalGrid
- implementation 'androidx.compose.foundation:foundation:1.4.1'
-
- // The compose calendar library
- implementation 'com.kizitonwose.calendar:compose:2.1.1'
-
- implementation "io.coil-kt:coil-compose:2.3.0"
-
-}
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 0000000..a731c03
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,68 @@
+plugins {
+ id("com.android.application")
+ kotlin("android")
+}
+
+android {
+ namespace = "ru.megboyzz.dnevnik"
+ compileSdk = AppConfig.compileSdk
+
+ defaultConfig {
+ minSdk = AppConfig.minSdk
+ targetSdk = AppConfig.targetSdk
+ version = AppConfig.versionName
+
+ vectorDrawables {
+ useSupportLibrary = true
+ }
+ multiDexEnabled = true
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = "1.8"
+ freeCompilerArgs = listOf(
+ "-Xjvm-default=compatibility"
+ )
+ }
+ buildFeatures{
+ compose = true
+ }
+
+ composeOptions{
+ kotlinCompilerExtensionVersion = Versions.compose
+ }
+
+ packagingOptions{
+ resources {
+ excludes += "/META-INF/{AL2.0,LGPL2.1}"
+ }
+ }
+
+}
+
+dependencies {
+
+ //std lib
+ implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
+ //app libs
+ implementation(AppDependencies.appLibraries)
+ //test libs
+ testImplementation(AppDependencies.testLibraries)
+ androidTestImplementation(AppDependencies.androidTestLibraries)
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 481bb43..01639a1 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -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.kts.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index cbc87c6..7cb9077 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,7 +1,6 @@
+ xmlns:tools="http://schemas.android.com/tools">
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 62e0d20..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,13 +0,0 @@
-buildscript {
- ext {
- compose_version = '1.4.1'
- }
-}
-plugins {
- id 'com.android.application' version '7.2.1' apply false
- id 'com.android.library' version '7.2.1' apply false
- id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
-}
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..8ef991d
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,4 @@
+plugins {
+ id("com.android.application") version(Versions.gradle)
+ id("org.jetbrains.kotlin.android") version(Versions.kotlin)
+}
\ No newline at end of file
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
new file mode 100644
index 0000000..8e88a95
--- /dev/null
+++ b/buildSrc/build.gradle.kts
@@ -0,0 +1,9 @@
+import org.gradle.kotlin.dsl.`kotlin-dsl`
+
+plugins {
+ `kotlin-dsl`
+}
+
+repositories {
+ mavenCentral()
+}
\ No newline at end of file
diff --git a/buildSrc/src/main/java/AppConfig.kt b/buildSrc/src/main/java/AppConfig.kt
new file mode 100644
index 0000000..4e19452
--- /dev/null
+++ b/buildSrc/src/main/java/AppConfig.kt
@@ -0,0 +1,16 @@
+
+//Константы уровня приложения
+object AppConfig {
+
+ const val compileSdk = 33
+ const val minSdk = 21
+ const val targetSdk = 32
+ const val versionCode = 1
+ const val versionName = "1.0.0"
+ const val buildToolsVersion = "29.0.3"
+
+ const val androidTestInstrumentation = "androidx.test.runner.AndroidJUnitRunner"
+ const val proguardConsumerRules = "consumer-rules.pro"
+ const val dimension = "environment"
+
+}
\ No newline at end of file
diff --git a/buildSrc/src/main/java/AppDependencies.kt b/buildSrc/src/main/java/AppDependencies.kt
new file mode 100644
index 0000000..f26ce66
--- /dev/null
+++ b/buildSrc/src/main/java/AppDependencies.kt
@@ -0,0 +1,76 @@
+import org.gradle.api.artifacts.dsl.DependencyHandler
+
+object AppDependencies {
+ //std lib
+ val kotlinStdLib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}"
+
+ //android ui
+ private val appcompat = "androidx.appcompat:appcompat:${Versions.appcompat}"
+ private val coreKtx = "androidx.core:core-ktx:${Versions.coreKtx}"
+ private val constraintLayout =
+ "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}"
+
+ private val pieChartLib = "com.github.PhilJay:MPAndroidChart:v3.1.0"
+
+ //test libs
+ private val junit = "junit:junit:${Versions.junit}"
+ private val extJUnit = "androidx.test.ext:junit:${Versions.extJunit}"
+ private val espressoCore = "androidx.test.espresso:espresso-core:${Versions.espresso}"
+
+ val appLibraries = arrayListOf().apply {
+ add(kotlinStdLib)
+ add(coreKtx)
+ add(appcompat)
+ add(constraintLayout)
+
+ add(pieChartLib)
+ }
+
+ val androidTestLibraries = arrayListOf().apply {
+ add(extJUnit)
+ add(espressoCore)
+ }
+
+ val testLibraries = arrayListOf().apply {
+ add(junit)
+ }
+}
+
+
+//util functions for adding the different type dependencies from build.gradle file
+
+fun DependencyHandler.kapt(list: List) {
+ list.forEach { dependency ->
+ add("kapt", dependency)
+ }
+}
+
+fun DependencyHandler.implementation(list: List) {
+ list.forEach { dependency ->
+ add("implementation", dependency)
+ }
+}
+
+fun DependencyHandler.testImplementation(list: List){
+ list.forEach { dependency ->
+ add("testImplementation", dependency)
+ }
+}
+
+fun DependencyHandler.androidTestImplementation(list: List){
+ list.forEach { dependency ->
+ add("androidTestImplementation", dependency)
+ }
+}
+
+fun DependencyHandler.coreLibraryDesugaring(list: List){
+ list.forEach { dependency ->
+ add("coreLibraryDesugaring", dependency)
+ }
+}
+
+fun DependencyHandler.debugImplementation(list: List){
+ list.forEach { dependency ->
+ add("debugImplementation", dependency)
+ }
+}
\ No newline at end of file
diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt
new file mode 100644
index 0000000..2202844
--- /dev/null
+++ b/buildSrc/src/main/java/Versions.kt
@@ -0,0 +1,22 @@
+
+//константы версии
+//для зависимостей Kotlin DSL
+object Versions {
+
+ //app level
+ const val gradle = "7.2.1"
+ const val kotlin = "1.8.10"
+
+ //libs
+ val coreKtx = "1.7.0"
+ val appcompat = "1.3.0-alpha01"
+ val constraintLayout = "2.0.0-beta8"
+
+ val compose = "1.4.4"
+
+ //test
+ val junit = "4.12"
+ val extJunit = "1.1.1"
+ val espresso = "3.2.0"
+
+}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index f2716fc..777e368 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Sep 26 23:09:42 MSK 2022
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/settings.gradle b/settings.gradle.kts
similarity index 84%
rename from settings.gradle
rename to settings.gradle.kts
index f4b0b19..c66f68b 100644
--- a/settings.gradle
+++ b/settings.gradle.kts
@@ -5,13 +5,15 @@ pluginManagement {
mavenCentral()
}
}
+
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
- maven { url 'https://jitpack.io' }
+ maven(url = "https://jitpack.io")
}
}
+
rootProject.name = "MyDnevnik"
-include ':app'
+include(":app")
\ No newline at end of file