From 26a87eaefc0b86f527e1e78a2facda0ad53c4187 Mon Sep 17 00:00:00 2001 From: "Md. Zahidul Islam" Date: Fri, 25 Nov 2022 16:26:32 +0600 Subject: [PATCH] update to Kotlin DSL --- .circleci/config.yml | 2 +- .github/workflows/gradle-publish.yml | 2 +- .idea/kotlinScripting.xml | 13 ++++++ app/build.gradle | 53 ----------------------- app/build.gradle.kts | 60 ++++++++++++++++++++++++++ app/proguard-rules.pro | 2 +- build.gradle | 10 ----- build.gradle.kts | 10 +++++ settings.gradle => settings.gradle.kts | 6 +-- 9 files changed, 89 insertions(+), 69 deletions(-) create mode 100644 .idea/kotlinScripting.xml delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts rename settings.gradle => settings.gradle.kts (75%) diff --git a/.circleci/config.yml b/.circleci/config.yml index cd57407..4d6db91 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,7 @@ jobs: - save_cache: paths: - ~/.gradle - key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} + key: jars-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }} # Generate apk - run: ./gradlew assembleRelease diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index 42eae27..e20e89d 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -35,7 +35,7 @@ jobs: arguments: build # The USERNAME and TOKEN need to correspond to the credentials environment variables used in - # the publishing section of your build.gradle + # the publishing section of your build.gradle.kts - name: Publish to GitHub Packages uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 with: diff --git a/.idea/kotlinScripting.xml b/.idea/kotlinScripting.xml new file mode 100644 index 0000000..287aded --- /dev/null +++ b/.idea/kotlinScripting.xml @@ -0,0 +1,13 @@ + + + + + 2147483647 + true + + + 2147483647 + true + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 7f51159..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,53 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' -} - -android { - compileSdk 33 - - defaultConfig { - applicationId "dev.jahidhasanco.bmicalculator" - minSdk 21 - targetSdk 33 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled 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' - } - - buildFeatures{ - dataBinding = true - } -} - -dependencies { - - implementation 'androidx.core:core-ktx:1.9.0' - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'com.google.android.material:material:1.7.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.4' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0' - - implementation 'com.github.adityagohad:HorizontalPicker:1.0.1' - implementation 'com.github.psuzn:WheelView:1.0.0' - implementation 'com.github.CNCoderX:WheelView:1.2.6' - implementation 'com.github.mhdmoh:swipe-button:1.0.3' - -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..364bb7b --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,60 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") +} + +android { + compileSdk = 33 + + defaultConfig { + applicationId = "dev.jahidhasanco.bmicalculator" + minSdk = 21 + targetSdk = 33 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + getByName("release") { + isMinifyEnabled = true + isShrinkResources = true + isDebuggable = false + + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" + ) + } + } + buildTypes.all { isCrunchPngs = false } + + compileOptions { + sourceCompatibility(JavaVersion.VERSION_1_8) + targetCompatibility(JavaVersion.VERSION_1_8) + } + kotlinOptions { + jvmTarget = "1.8" + } + + buildFeatures { + dataBinding = true + } +} + +dependencies { + + implementation("androidx.core:core-ktx:1.9.0") + implementation("androidx.appcompat:appcompat:1.5.1") + implementation("com.google.android.material:material:1.7.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.4") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0") + + implementation("com.github.adityagohad:HorizontalPicker:1.0.1") + implementation("com.github.psuzn:WheelView:1.0.0") + implementation("com.github.CNCoderX:WheelView:1.2.6") + implementation("com.github.mhdmoh:swipe-button:1.0.3") + +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..ff59496 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. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 08ccc6d..0000000 --- a/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id 'com.android.application' version '7.3.1' apply false - id 'com.android.library' version '7.3.1' apply false - id 'org.jetbrains.kotlin.android' version '1.7.20' 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..85de69b --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,10 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id("com.android.application") version "7.3.1" apply false + id("com.android.library") version "7.3.1" apply false + id("org.jetbrains.kotlin.android") version "1.7.20" apply false +} + +tasks.register("clean",Delete::class){ + delete(rootProject.buildDir) +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle.kts similarity index 75% rename from settings.gradle rename to settings.gradle.kts index 5b96931..a9fd1f4 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -3,7 +3,7 @@ pluginManagement { gradlePluginPortal() google() mavenCentral() - maven { url "https://jitpack.io" } + maven("https://jitpack.io") } } dependencyResolutionManagement { @@ -11,8 +11,8 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - maven { url "https://jitpack.io" } + maven("https://jitpack.io") } } rootProject.name = "BMI Calculator" -include ':app' +include (":app")