From 1f76a177fedb13b4320fef2f1848cced6ff88878 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 8 Sep 2020 06:42:47 +0530 Subject: [PATCH] build: commonize Gradle configurations Signed-off-by: Harsh Shandilya --- app/build.gradle | 14 -------------- build.gradle | 39 ++++++++++++++++++++++++++++++++++----- data/build.gradle | 13 ------------- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 15a9262c..8326dec2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,18 +1,10 @@ plugins { - id 'com.android.application' id 'kotlin-android' } android { - compileSdkVersion 30 - buildToolsVersion "30.0.2" - defaultConfig { applicationId "dev.msfjarvis.todo" - minSdkVersion 23 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -23,11 +15,6 @@ android { } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - buildFeatures { compose true } @@ -40,7 +27,6 @@ android { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions { - jvmTarget = "1.8" freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"] } } diff --git a/build.gradle b/build.gradle index 9288340e..e8fa52bc 100644 --- a/build.gradle +++ b/build.gradle @@ -2,9 +2,9 @@ buildscript { ext { compose_version = '1.0.0-alpha02' + kotlin_version = '1.4.0' room_version = '2.3.0-alpha02' } - ext.kotlin_version = "1.4.0" repositories { google() jcenter() @@ -12,9 +12,6 @@ buildscript { dependencies { classpath "com.android.tools.build:gradle:4.2.0-alpha09" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } @@ -25,6 +22,38 @@ allprojects { } } +subprojects { + repositories { + google() + jcenter() + } + if (name == 'app') { + apply plugin: 'com.android.application' + } else { + apply plugin: 'com.android.library' + } + android { + compileSdkVersion 30 + buildToolsVersion "30.0.2" + + defaultConfig { + minSdkVersion 23 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + } + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + kotlinOptions { + jvmTarget = '1.8' + } + } +} + task clean(type: Delete) { delete rootProject.buildDir -} \ No newline at end of file +} diff --git a/data/build.gradle b/data/build.gradle index 4d931b88..11bae882 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -1,29 +1,16 @@ plugins { - id 'com.android.library' id 'kotlin-android' id 'kotlin-kapt' } android { - compileSdkVersion 30 - buildToolsVersion "30.0.2" defaultConfig { - minSdkVersion 23 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' } }