diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 5f50b95..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,118 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -repositories { - mavenCentral() - maven { url 'https://jitpack.io' } -} - -android { - compileSdkVersion AndroidConfig.compileSdk - - def currentVersion = Versioning.getVersion() - - defaultConfig { - applicationId AndroidConfig.applicationId - minSdkVersion AndroidConfig.minSdk - targetSdkVersion AndroidConfig.targetSdk - versionCode currentVersion.code - versionName currentVersion.name - testInstrumentationRunner AndroidConfig.instrumentationTestRunner - - archivesBaseName = "app-${currentVersion.name}" - - vectorDrawables.useSupportLibrary = true - vectorDrawables.generatedDensities = [] - - resConfigs "pt-rBR" - - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - buildTypes { - - debug { - ext.alwaysUpdateBuildId = false - ext.enableCrashlytics = false - crunchPngs false - minifyEnabled false - - applicationIdSuffix ".dev" - lintOptions { tasks.lint.enabled = false } - - defaultConfig { resConfigs "xxxhdpi" } - } - - release { - minifyEnabled true - shrinkResources true - crunchPngs true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - packagingOptions { - exclude 'LICENSE.txt' - exclude 'META-INF/DEPENDENCIES' - exclude 'META-INF/ASL2.0' - exclude 'META-INF/NOTICE' - exclude 'META-INF/LICENSE' - exclude 'META-INF/main.kotlin_module' - exclude '**/*.properties' - } - - lintOptions { - quiet true - abortOnError false - ignoreWarnings true - disable 'InvalidPackage' - disable 'OldTargetApi' - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } -} - -androidExtensions { - experimental = true -} - - -dependencies { - - implementation project(':domain') - implementation project(':presentation') - implementation project(':data') - - implementation Dependencies.okhttp - implementation Dependencies.okhttpInterceptor - - AndroidModule.main.forEach { implementation it } - AndroidModule.unitTesting.forEach { testImplementation it } - AndroidModule.androidTesting.forEach { androidTestImplementation it } -} - -configurations.all { - resolutionStrategy { - forcedModules = AndroidModule.main.toArray() - } -} - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"] - } -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..1ce5ca0 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,111 @@ +import org.jetbrains.kotlin.gradle.internal.AndroidExtensionsExtension +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + id("com.android.application") + kotlin("android") + id("kotlin-android-extensions") +} + +android { + compileSdkVersion(AndroidConfig.compileSdk) + + val currentVersion = Versioning.getVersion() + + defaultConfig { + applicationId = AndroidConfig.applicationId + minSdkVersion(AndroidConfig.minSdk) + targetSdkVersion(AndroidConfig.targetSdk) + versionCode = currentVersion.code + versionName = currentVersion.name + testInstrumentationRunner = AndroidConfig.instrumentationTestRunner + + // archivesBaseName = "app-${currentVersion.name}" + + resConfigs("pt-rBR") + + vectorDrawables.apply { + useSupportLibrary = true + setGeneratedDensities(emptyList()) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + buildTypes { + getByName("debug") { + isCrunchPngs = false + isMinifyEnabled = false + + applicationIdSuffix = ".dev" + // lintOptions { tasks.lint.enabled = false } + + defaultConfig { + resConfigs("xxxhdpi") + } + + // https://stackoverflow.com/a/55745719 + (this@getByName as ExtensionAware).apply { + extra["alwaysUpdateBuildId"] = false + extra["enableCrashlytics"] = false + } + } + + getByName("release") { + isMinifyEnabled = true + isShrinkResources = true + isCrunchPngs = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + packagingOptions { + exclude("LICENSE.txt") + exclude("META-INF/DEPENDENCIES") + exclude("META-INF/ASL2.0") + exclude("META-INF/NOTICE") + exclude("META-INF/LICENSE") + exclude("META-INF/main.kotlin_module") + exclude("**/*.properties") + } + + lintOptions { + isAbortOnError = false + isIgnoreWarnings = true + isQuiet = true + disable("InvalidPackage", "OldTargetApi") + } + + testOptions { + unitTests.apply { + isIncludeAndroidResources = true + } + } +} + +dependencies { + implementation(project(":domain")) + implementation(project(":presentation")) + implementation(project(":data")) + + implementation(Dependencies.okhttp) + implementation(Dependencies.okhttpInterceptor) + + AndroidModule.main.forEach(::implementation) + AndroidModule.unitTesting.forEach(::testImplementation) + AndroidModule.androidTesting.forEach(::androidTestImplementation) +} + +extensions.getByType().apply { + isExperimental = true +} + +tasks.withType { + kotlinOptions { + jvmTarget = "${JavaVersion.VERSION_1_8}" + freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check") + } +} diff --git a/build.gradle b/build.gradle deleted file mode 100644 index a534497..0000000 --- a/build.gradle +++ /dev/null @@ -1,45 +0,0 @@ -buildscript { - - repositories { - google() - jcenter() - mavenLocal() - maven { url 'https://kotlin.bintray.com/kotlinx' } - maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" } - maven { url 'https://jitpack.io' } - maven { url 'https://maven.fabric.io/public' } - maven { url 'https://dl.bintray.com/android/android-tools' } - maven { url 'https://plugins.gradle.org/m2/' } - } - - dependencies { - classpath BuildPlugins.androidGradlePlugin - classpath BuildPlugins.kotlinGradlePlugin - classpath BuildPlugins.kotlinxSerializiationPlugin - classpath BuildPlugins.ktlint - classpath BuildPlugins.detekt - } - -} - -allprojects { - apply plugin: 'org.jlleitschuh.gradle.ktlint' - apply plugin: 'io.gitlab.arturbosch.detekt' - - repositories { - google() - jcenter() - mavenLocal() - maven { url "https://kotlin.bintray.com/kotlinx" } - maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" } - maven { url 'https://jitpack.io' } - } - - detekt { - config = files("${rootDir}/detekt.yml") - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..9f9c7b0 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,50 @@ +import io.gitlab.arturbosch.detekt.extensions.DetektExtension + +buildscript { + + repositories { + google() + jcenter() + mavenLocal() + maven(url = "https://kotlin.bintray.com/kotlinx") + maven(url = "https://jitpack.io") + maven(url = "https://maven.fabric.io/public") + maven(url = "https://dl.bintray.com/android/android-tools") + maven(url = "https://plugins.gradle.org/m2/") + } + + dependencies { + classpath(BuildPlugins.androidGradlePlugin) + classpath(BuildPlugins.kotlinGradlePlugin) + classpath(BuildPlugins.kotlinxSerializiationPlugin) + classpath(BuildPlugins.ktlint) + classpath(BuildPlugins.detekt) + } +} + +allprojects { + apply(plugin = "org.jlleitschuh.gradle.ktlint") + apply(plugin = "io.gitlab.arturbosch.detekt") + + repositories { + google() + jcenter() + mavenLocal() + maven(url = "https://kotlin.bintray.com/kotlinx") + maven(url = "https://jitpack.io") + } + + configure { + config = files("$rootDir/detekt.yml") + } + + configurations.all { + resolutionStrategy { + force("androidx.constraintlayout:constraintlayout:1.1.3") + } + } +} + +tasks.register("clean") { + delete(rootProject.buildDir) +} diff --git a/data/build.gradle b/data/build.gradle deleted file mode 100644 index 94b7330..0000000 --- a/data/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -apply from: "../kotlin-module.gradle" -apply plugin: 'kotlinx-serialization' - -dependencies { - - implementation project (":domain") - implementation Dependencies.coroutines - implementation Dependencies.kotlinxSerialization - - StandaloneModule.main.forEach { implementation it } - StandaloneModule.unitTesting.forEach { testImplementation it } - - NetworkingDependencies.main.forEach { implementation it } - NetworkingDependencies.testing.forEach { testImplementation it } -} diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100644 index 0000000..9fa99e3 --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,18 @@ +apply(from = "../kotlin-module.gradle") + +plugins { + kotlin("jvm") + kotlin("plugin.serialization") +} + +dependencies { + implementation(project(":domain")) + implementation(Dependencies.coroutines) + implementation(Dependencies.kotlinxSerialization) + + StandaloneModule.main.forEach(::implementation) + StandaloneModule.unitTesting.forEach(::testImplementation) + + NetworkingDependencies.main.forEach(::implementation) + NetworkingDependencies.testing.forEach(::testImplementation) +} diff --git a/domain/build.gradle b/domain/build.gradle deleted file mode 100644 index f08b22b..0000000 --- a/domain/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -apply from: "../kotlin-module.gradle" - -dependencies { - implementation Dependencies.coroutines - StandaloneModule.main.forEach { implementation it } - StandaloneModule.unitTesting.forEach { testImplementation it } -} diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts new file mode 100644 index 0000000..e46c478 --- /dev/null +++ b/domain/build.gradle.kts @@ -0,0 +1,11 @@ +apply(from = "../kotlin-module.gradle") + +plugins { + kotlin("jvm") +} + +dependencies { + implementation(Dependencies.coroutines) + StandaloneModule.main.forEach(::implementation) + StandaloneModule.unitTesting.forEach(::testImplementation) +} diff --git a/kotlin-module.gradle b/kotlin-module.gradle index cbc5cca..0086eb9 100644 --- a/kotlin-module.gradle +++ b/kotlin-module.gradle @@ -1,5 +1,3 @@ -apply plugin: 'kotlin' - repositories { mavenCentral() maven { url 'https://jitpack.io' } diff --git a/presentation/build.gradle b/presentation/build.gradle deleted file mode 100644 index f2edfaf..0000000 --- a/presentation/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -apply plugin: 'com.android.library' -apply from: "../android-module.gradle" - -dependencies { - - implementation project(':domain') - implementation project(':data') - implementation project(':utils') - - implementation Dependencies.coroutines - implementation Dependencies.coroutinesAndroid - implementation Dependencies.dalek - - AndroidModule.main.forEach { implementation it } - AndroidModule.unitTesting.forEach { testImplementation it } - AndroidModule.androidTesting.forEach { androidTestImplementation it } -} diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts new file mode 100644 index 0000000..9087031 --- /dev/null +++ b/presentation/build.gradle.kts @@ -0,0 +1,19 @@ +apply(from = "../android-module.gradle") + +plugins { + id("com.android.library") +} + +dependencies { + + implementation(project(":domain")) + implementation(project(":data")) + implementation(project(":utils")) + + implementation(Dependencies.coroutines) + implementation(Dependencies.coroutinesAndroid) + + AndroidModule.main.forEach(::implementation) + AndroidModule.unitTesting.forEach(::testImplementation) + AndroidModule.androidTesting.forEach(::androidTestImplementation) +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 7a6ac01..0000000 --- a/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -include ':app', ':data', ':presentation', ':domain', ':utils' -rootProject.name='Dialetus' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..de24d68 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,8 @@ +rootProject.name = "Dialetus" +include( + ":app", + ":data", + ":presentation", + ":domain", + ":utils" +) diff --git a/utils/build.gradle b/utils/build.gradle deleted file mode 100644 index a2fc543..0000000 --- a/utils/build.gradle +++ /dev/null @@ -1,8 +0,0 @@ -apply plugin: 'com.android.library' -apply from: "../android-module.gradle" - -dependencies { - AndroidModule.main.forEach { implementation it } - AndroidModule.unitTesting.forEach { testImplementation it } - AndroidModule.androidTesting.forEach { androidTestImplementation it } -} diff --git a/utils/build.gradle.kts b/utils/build.gradle.kts new file mode 100644 index 0000000..bbf1307 --- /dev/null +++ b/utils/build.gradle.kts @@ -0,0 +1,13 @@ +apply(from = "../android-module.gradle") + +plugins { + id("com.android.library") + kotlin("android") + id("kotlin-android-extensions") +} + +dependencies { + AndroidModule.main.forEach(::implementation) + AndroidModule.unitTesting.forEach(::testImplementation) + AndroidModule.androidTesting.forEach(::androidTestImplementation) +}