From 77d6996f5dfd5f6d4e21ea062e4726b8928ad3c6 Mon Sep 17 00:00:00 2001 From: shabinder Date: Tue, 9 Feb 2021 14:35:04 +0530 Subject: [PATCH] build scripts cleaning --- android/build.gradle.kts | 23 ++++++------- build.gradle.kts | 9 ++---- buildSrc/build.gradle.kts | 20 ++---------- buildSrc/buildSrc/src/main/kotlin/Versions.kt | 9 +++--- common/compose-ui/build.gradle.kts | 10 +++--- common/data-models/build.gradle.kts | 12 ------- desktop/src/jvmMain/kotlin/main.kt | 6 +++- gradle.properties | 32 ++++++++++++++++--- 8 files changed, 57 insertions(+), 64 deletions(-) diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 295fa810..47355ca1 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -55,20 +55,17 @@ android { } } } - buildFeatures { - compose = true - } packagingOptions { exclude("META-INF/*") } - composeOptions { - kotlinCompilerVersion = Versions.kotlinVersion - //kotlinCompilerExtensionVersion = Versions.compose + /* + buildFeatures { + compose = true } kotlinOptions { jvmTarget = "1.8" useIR = true - } + }*/ } dependencies { implementation(compose.material) @@ -79,11 +76,6 @@ dependencies { implementation(project(":common:dependency-injection")) implementation(project(":common:data-models")) implementation(Androidx.appCompat) -/* - implementation(Androidx.coroutines) - implementation(Androidx.core) - implementation(Androidx.palette) -*/ //Compose-Navigation //implementation(Androidx.composeNavigation) @@ -95,6 +87,9 @@ dependencies { implementation(Decompose.decompose) implementation(Decompose.extensionsCompose) /* + implementation(Androidx.coroutines) + implementation(Androidx.core) + implementation(Androidx.palette) //Lifecycle Versions.androidLifecycle.let{ @@ -132,10 +127,12 @@ dependencies { //Desugaring coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.1") } + tasks.withType { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() - freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies","-Xallow-unstable-dependencies", + freeCompilerArgs = listOf( + "-Xallow-jvm-ir-dependencies","-Xallow-unstable-dependencies", "-Xskip-prerelease-check", "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi" ) diff --git a/build.gradle.kts b/build.gradle.kts index 0e4c41bf..1edac78d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,12 +14,7 @@ allprojects { maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev") } } -buildscript { - dependencies { - classpath(JetBrains.Kotlin.gradlePlugin) - } -} - +/* tasks.withType { kotlinOptions { freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check", @@ -27,4 +22,4 @@ tasks.withType { "-Xuse-experimental=kotlinx.coroutines.TheAnnotationYouWantToDisable" ) } -} +}*/ diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 70b1a1a2..26453ee3 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,31 +1,16 @@ plugins { `kotlin-dsl` - `kotlin-dsl-precompiled-script-plugins` + //`kotlin-dsl-precompiled-script-plugins` } group = "com.shabinder" version = "2.1" -buildscript{ - repositories { - // TODO: remove after new build is published - mavenLocal() - google() - jcenter() - maven(url = "https://jitpack.io") - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } - dependencies { - classpath("com.android.tools.build:gradle:4.0.1") - classpath(JetBrains.Compose.gradlePlugin) - classpath(JetBrains.Kotlin.gradlePlugin) - } -} repositories { - maven(url = "https://jitpack.io") jcenter() mavenLocal() google() + maven(url = "https://jitpack.io") maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } @@ -40,6 +25,7 @@ dependencies { kotlinDslPluginOptions { experimentalWarning.set(false) } + kotlin { // Add Deps to compilation, so it will become available in main project sourceSets.getByName("main").kotlin.srcDir("buildSrc/src/main/kotlin") diff --git a/buildSrc/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/buildSrc/src/main/kotlin/Versions.kt index 6dd9e6ee..e21e6698 100644 --- a/buildSrc/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/buildSrc/src/main/kotlin/Versions.kt @@ -5,10 +5,9 @@ object Versions { const val kotlinVersion = "1.4.21-2" const val coroutinesVersion = "1.4.2" - const val compose = "1.0.0-alpha11" + //const val compose = "1.0.0-alpha11" const val coilVersion = "0.4.1" //DI - const val kodein = "7.2.0" const val koin = "3.0.0-alpha-4" //Logger @@ -39,7 +38,7 @@ object Koin { } object Androidx{ const val appCompat = "androidx.appcompat:appcompat:1.2.0" - const val core = "androidx.core:core-ktx:1.5.0-beta01" + const val core = "androidx.core:core-ktx:1.3.2" const val palette = "androidx.palette:palette-ktx:1.0.0" const val composeNavigation = "androidx.navigation:navigation-compose:1.0.0-alpha06" const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutinesVersion}" @@ -47,7 +46,7 @@ object Androidx{ const val junit = "androidx.test.ext:junit:1.1.2" const val expresso = "androidx.test.espresso:espresso-core:3.3.0" - object Compose{ + /*object Compose{ const val materialIcon = "androidx.compose.material:material-icons-extended:${Versions.compose}" const val ui = "androidx.compose.ui:ui:${Versions.compose}" const val uiGraphics = "androidx.compose.ui:ui-graphics:${Versions.compose}" @@ -55,7 +54,7 @@ object Androidx{ const val foundationLayout = "androidx.compose.foundation:foundation-layout:${Versions.compose}" const val material = "androidx.compose.material:material:${Versions.compose}" const val runtimeLiveData = "androidx.compose.runtime:runtime-livedata:${Versions.compose}" - } + }*/ } object JetBrains { object Kotlin { diff --git a/common/compose-ui/build.gradle.kts b/common/compose-ui/build.gradle.kts index 93df49b3..0577471e 100644 --- a/common/compose-ui/build.gradle.kts +++ b/common/compose-ui/build.gradle.kts @@ -10,8 +10,8 @@ kotlin { sourceSets { commonMain { dependencies { - //implementation(compose.materialIconsExtended) - implementation("org.jetbrains.compose.material:material-icons-extended:0.3.0-build150") + implementation(compose.materialIconsExtended) + //implementation("org.jetbrains.compose.material:material-icons-extended:0.3.0-build150") implementation(project(":common:dependency-injection")) implementation(project(":common:data-models")) implementation(project(":common:database")) @@ -30,14 +30,14 @@ kotlin { } } } - +/* tasks.withType { kotlinOptions { - useIR = true + //useIR = true freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xallow-unstable-dependencies","-Xskip-prerelease-check", "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xuse-experimental=kotlinx.coroutines.TheAnnotationYouWantToDisable" ) } -} \ No newline at end of file +}*/ diff --git a/common/data-models/build.gradle.kts b/common/data-models/build.gradle.kts index d5620e82..b4dfa67b 100644 --- a/common/data-models/build.gradle.kts +++ b/common/data-models/build.gradle.kts @@ -12,16 +12,4 @@ kotlin { } } } -} - -tasks.withType { - kotlinOptions { - useIR = true - freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", - "-Xallow-unstable-dependencies","-Xskip-prerelease-check", - "-P", "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true", - "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", - "-Xuse-experimental=kotlinx.coroutines.TheAnnotationYouWantToDisable" - ) - } } \ No newline at end of file diff --git a/desktop/src/jvmMain/kotlin/main.kt b/desktop/src/jvmMain/kotlin/main.kt index c2187b9c..92a12cb3 100644 --- a/desktop/src/jvmMain/kotlin/main.kt +++ b/desktop/src/jvmMain/kotlin/main.kt @@ -1,8 +1,12 @@ import androidx.compose.desktop.Window +import androidx.compose.foundation.layout.Column +import androidx.compose.material.Text import com.shabinder.common.initKoin private val koin = initKoin(enableNetworkLogs = true).koin fun main() = Window { - //TODO + Column{ + Text("Hello World") + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ae8bfed2..0f171d52 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,29 @@ -kotlin.code.style=official +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true -kotlin.mpp.enableGranularSourceSetsMetadata=true -kotlin.native.enableDependencyPropagation=false -org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 \ No newline at end of file +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official +org.gradle.parallel=true +org.gradle.caching=true +kotlin.native.disableCompilerDaemon=true +#kotlin.code.style=official +#android.useAndroidX=true +#kotlin.mpp.enableGranularSourceSetsMetadata=true +#kotlin.native.enableDependencyPropagation=false +#org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 \ No newline at end of file