diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100755 index 26a63d71..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,147 +0,0 @@ -import com.android.tools.profgen.ArtProfileKt -import com.android.tools.profgen.ArtProfileSerializer -import com.android.tools.profgen.DexFile - -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'kotlin-kapt' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.app' - defaultConfig { - applicationId "com.shifthackz.aisdv1.app" - versionName "0.6.4" - versionCode 184 - - buildConfigField "String", "IMAGE_CDN_URL", "\"https://random.imagecdn.app/\"" - buildConfigField "String", "HUGGING_FACE_URL", "\"https://huggingface.co/\"" - buildConfigField "String", "HUGGING_FACE_INFERENCE_URL", "\"https://api-inference.huggingface.co/\"" - buildConfigField "String", "HORDE_AI_URL", "\"https://stablehorde.net/\"" - buildConfigField "String", "OPEN_AI_URL", "\"https://api.openai.com/\"" - buildConfigField "String", "STABILITY_AI_URL", "\"https://api.stability.ai/\"" - - buildConfigField "String", "HORDE_AI_SIGN_UP_URL", "\"https://stablehorde.net/register\"" - buildConfigField "String", "HUGGING_FACE_INFO_URL", "\"https://huggingface.co/docs/api-inference/index\"" - buildConfigField "String", "OPEN_AI_INFO_URL", "\"https://platform.openai.com/api-keys\"" - buildConfigField "String", "STABILITY_AI_INFO_URL", "\"https://platform.stability.ai/\"" - buildConfigField "String", "UPDATE_API_URL", "\"https://sdai.moroz.cc\"" - buildConfigField "String", "DEMO_MODE_API_URL", "\"https://sdai.moroz.cc\"" - buildConfigField "String", "POLICY_URL", "\"https://sdai.moroz.cc/policy.html\"" - buildConfigField "String", "DONATE_URL", "\"https://www.buymeacoffee.com/shifthackz\"" - buildConfigField "String", "GITHUB_SOURCE_URL", "\"https://github.com/ShiftHackZ/Stable-Diffusion-Android\"" - buildConfigField "String", "SETUP_INSTRUCTIONS_URL", "\"https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki\"" - buildConfigField "String", "SWARM_UI_INFO_URL", "\"https://github.com/mcmonkeyprojects/SwarmUI/tree/master/docs\"" - - resourceConfigurations = ["en", "ru", "uk", "tr", "zh"] - } - - def hasPropertiesFile = new File("app/keystore/signing.properties").exists() - if (hasPropertiesFile) { - Properties props = new Properties() - props.load(new FileInputStream(file("keystore/signing.properties"))) - - signingConfigs { - release { - storeFile file(props['keystore']) - storePassword props['keystore.password'] - keyAlias props['keystore.alias'] - keyPassword props['keystore.password'] - } - } - buildTypes.release.signingConfig = signingConfigs.release - } - - flavorDimensions = ["type"] - productFlavors { - dev { - dimension "type" - applicationIdSuffix = ".dev" - resValue "string", "app_name", "SDAI Dev" - buildConfigField "String", "BUILD_FLAVOR_TYPE", "\"FOSS\"" - } - foss { - dimension "type" - applicationIdSuffix = ".foss" - resValue "string", "app_name", "SDAI FOSS" - buildConfigField "String", "BUILD_FLAVOR_TYPE", "\"FOSS\"" - } - playstore { - dimension "type" - resValue "string", "app_name", "SDAI" - buildConfigField "String", "BUILD_FLAVOR_TYPE", "\"GOOGLE_PLAY\"" - } - } - - buildFeatures { - buildConfig true - } - - bundle { - language { - enableSplit = false - } - } -} - -dependencies { - implementation project(":core:common") - implementation project(":core:imageprocessing") - implementation project(":core:notification") - implementation project(":core:validation") - implementation project(":presentation") - implementation project(":network") - implementation project(":storage") - implementation project(":domain") - implementation project(":feature:auth") - implementation project(":feature:diffusion") - implementation project(":feature:work") - implementation project(":data") - implementation project(":demo") - implementation di.koinCore - implementation di.koinAndroid - implementation di.koinCompose - implementation reactive.rxkotlin - implementation reactive.rxandroid - implementation log.timber - implementation ui.catppuccinSplashscreen - implementation ui.catppuccinLegacy - implementation androidx.workManager -} - -kapt { - correctErrorTypes true -} - -// Workaround for "Bug: baseline.profm not deterministic" -// -// Reference : https://f-droid.org/docs/Reproducible_Builds/#bug-baselineprofm-not-deterministic -// Fix snippet : https://gist.github.com/obfusk/61046e09cee352ae6dd109911534b12e -// Issue tracker : https://issuetracker.google.com/issues/231837768 -project.afterEvaluate { - tasks.each { task -> - if (task.name.startsWith("compile") && task.name.endsWith("ReleaseArtProfile")) { - task.doLast { - outputs.files.each { file -> - if (file.name.endsWith(".profm")) { - println("Sorting ${file} ...") - def version = ArtProfileSerializer.valueOf("METADATA_0_0_2") - def profile = ArtProfileKt.ArtProfile(file) - def keys = new ArrayList(profile.profileData.keySet()) - def sortedData = new LinkedHashMap() - Collections.sort keys, new DexFile.Companion() - keys.each { key -> sortedData[key] = profile.profileData[key] } - new FileOutputStream(file).with { - write(version.magicBytes$profgen) - write(version.versionBytes$profgen) - version.write$profgen(it, sortedData, "") - } - } - } - } - } - } -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100755 index 00000000..5aeb348d --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,104 @@ +import java.io.FileInputStream +import java.util.Properties + +plugins { + alias(libs.plugins.generic.application) + alias(libs.plugins.generic.baseline.profm) +} + +android { + namespace = "com.shifthackz.aisdv1.app" + defaultConfig { + applicationId = "com.shifthackz.aisdv1.app" + versionName = libs.versions.versionName.get() + versionCode = libs.versions.versionCode.get().toInt() + + buildConfigField("String", "IMAGE_CDN_URL", "\"https://random.imagecdn.app/\"") + buildConfigField("String", "HUGGING_FACE_URL", "\"https://huggingface.co/\"") + buildConfigField("String", "HUGGING_FACE_INFERENCE_URL", "\"https://api-inference.huggingface.co/\"") + buildConfigField("String", "HORDE_AI_URL", "\"https://stablehorde.net/\"") + buildConfigField("String", "OPEN_AI_URL", "\"https://api.openai.com/\"") + buildConfigField("String", "STABILITY_AI_URL", "\"https://api.stability.ai/\"") + + buildConfigField("String", "HORDE_AI_SIGN_UP_URL", "\"https://stablehorde.net/register\"") + buildConfigField("String", "HUGGING_FACE_INFO_URL", "\"https://huggingface.co/docs/api-inference/index\"") + buildConfigField("String", "OPEN_AI_INFO_URL", "\"https://platform.openai.com/api-keys\"") + buildConfigField("String", "STABILITY_AI_INFO_URL", "\"https://platform.stability.ai/\"") + buildConfigField("String", "UPDATE_API_URL", "\"https://sdai.moroz.cc\"") + buildConfigField("String", "DEMO_MODE_API_URL", "\"https://sdai.moroz.cc\"") + buildConfigField("String", "POLICY_URL", "\"https://sdai.moroz.cc/policy.html\"") + buildConfigField("String", "DONATE_URL", "\"https://www.buymeacoffee.com/shifthackz\"") + buildConfigField("String", "GITHUB_SOURCE_URL", "\"https://github.com/ShiftHackZ/Stable-Diffusion-Android\"") + buildConfigField("String", "SETUP_INSTRUCTIONS_URL", "\"https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki\"") + buildConfigField("String", "SWARM_UI_INFO_URL", "\"https://github.com/mcmonkeyprojects/SwarmUI/tree/master/docs\"") + + resourceConfigurations += listOf("en", "ru", "uk", "tr", "zh") + } + + val hasPropertiesFile = File("app/keystore/signing.properties").exists() + if (hasPropertiesFile) { + val props = Properties() + props.load(FileInputStream(file("keystore/signing.properties"))) + val alias = props["keystore.alias"] as String + signingConfigs { + create("release") { + storeFile = file(props["keystore"] as String) + storePassword = props["keystore.password"] as String + keyAlias = alias + keyPassword = props["keystore.password"] as String + } + } + println("[Signature] -> Build will be signed with signature: $alias") + buildTypes.getByName("release").signingConfig = signingConfigs.getByName("release") + } + + flavorDimensions += "type" + productFlavors { + create("dev") { + dimension = "type" + applicationIdSuffix = ".dev" + resValue("string", "app_name", "SDAI Dev") + buildConfigField("String", "BUILD_FLAVOR_TYPE", "\"FOSS\"") + } + create("foss") { + dimension = "type" + applicationIdSuffix = ".foss" + resValue("string", "app_name", "SDAI FOSS") + buildConfigField("String", "BUILD_FLAVOR_TYPE", "\"FOSS\"") + } + create("playstore") { + dimension = "type" + resValue("string", "app_name", "SDAI") + buildConfigField("String", "BUILD_FLAVOR_TYPE", "\"GOOGLE_PLAY\"") + } + } +} + +dependencies { + implementation(project(":core:common")) + implementation(project(":core:imageprocessing")) + implementation(project(":core:notification")) + implementation(project(":core:validation")) + implementation(project(":presentation")) + implementation(project(":network")) + implementation(project(":storage")) + implementation(project(":domain")) + implementation(project(":feature:auth")) + implementation(project(":feature:diffusion")) + implementation(project(":feature:work")) + implementation(project(":data")) + implementation(project(":demo")) + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.koin.compose) + implementation(libs.rx.kotlin) + implementation(libs.rx.android) + implementation(libs.timber) + implementation(libs.shifthackz.catppuccin.splash) + implementation(libs.shifthackz.catppuccin.legacy) + implementation(libs.androidx.work.runtime) +} + +kapt { + correctErrorTypes = true +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb434..ff59496d 100755 --- 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-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts new file mode 100644 index 00000000..75b16dee --- /dev/null +++ b/build-logic/convention/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + `kotlin-dsl` +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +tasks.withType().configureEach { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } +} + +dependencies { + compileOnly(libs.android.tools.build.gradle) + compileOnly(libs.kotlin.gradle.plugin) +} + +gradlePlugin { + plugins { + register("Library") { + id = "generic.library" + implementationClass = "LibraryConventionPlugin" + } + register("Jacoco") { + id = "generic.jacoco" + implementationClass = "JacocoConventionPlugin" + } + register("Compose") { + id = "generic.compose" + implementationClass = "ComposeConventionPlugin" + } + register("Application") { + id = "generic.application" + implementationClass = "ApplicationConventionPlugin" + } + register("BaselineProFm") { + id = "generic.baseline.profm" + implementationClass = "BaselineProFmConventionPlugin" + } + } +} diff --git a/build-logic/convention/src/main/kotlin/ApplicationConventionPlugin.kt b/build-logic/convention/src/main/kotlin/ApplicationConventionPlugin.kt new file mode 100644 index 00000000..2b126264 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/ApplicationConventionPlugin.kt @@ -0,0 +1,27 @@ +import com.android.build.api.dsl.ApplicationExtension +import com.shifthackz.aisdv1.buildlogic.configureApplication +import com.shifthackz.aisdv1.buildlogic.configureCompose +import com.shifthackz.aisdv1.buildlogic.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +class ApplicationConventionPlugin : Plugin { + + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.application") + apply("org.jetbrains.kotlin.android") + apply("org.jetbrains.kotlin.kapt") + apply("generic.jacoco") + } + + extensions.configure { + configureApplication(this) + configureCompose(this) + defaultConfig.targetSdk = libs.findVersion("targetSdk").get().toString().toInt() + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/BaselineProFmConventionPlugin.kt b/build-logic/convention/src/main/kotlin/BaselineProFmConventionPlugin.kt new file mode 100644 index 00000000..b3cbdc60 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/BaselineProFmConventionPlugin.kt @@ -0,0 +1,60 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + +import org.gradle.api.Plugin +import org.gradle.api.Project +import com.android.tools.profgen.ArtProfile +import com.android.tools.profgen.ArtProfileSerializer +import com.android.tools.profgen.DexFile +import com.android.tools.profgen.DexFileData +import java.io.FileOutputStream +import java.util.Collections + +/** + * Workaround for "Bug: baseline.profm not deterministic" + * + * Reference : https://f-droid.org/docs/Reproducible_Builds/#bug-baselineprofm-not-deterministic + * Fix snippet : https://gist.github.com/obfusk/61046e09cee352ae6dd109911534b12e + * Issue tracker : https://issuetracker.google.com/issues/231837768 + */ +class BaselineProFmConventionPlugin : Plugin { + + override fun apply(target: Project) { + target.afterEvaluate { + tasks.forEach { task -> + if (task.name.startsWith("compile") && task.name.endsWith("ReleaseArtProfile")) { + task.doLast { + outputs.files.forEach { file -> + if (file.name.endsWith(".profm")) { + println("[Baseline ProFm] -> Trying to sort: $file") + val version = ArtProfileSerializer.valueOf("METADATA_0_0_2") + val profile = ArtProfile(file) + val keys = ArrayList(profile?.profileData?.keys ?: setOf()) + val sortedData = LinkedHashMap() + println("[Baseline ProFm] -> Keys: $keys") + Collections.sort(keys, DexFile.Companion) + println("[Baseline ProFm] -> Keys (sorted): $keys") + + keys.forEach { key -> + profile?.profileData?.get(key)?.let { value -> + sortedData[key] = value + } + } + println("[Baseline ProFm] -> Sorted data: $sortedData") + + FileOutputStream(file).use { stream -> + println("[Baseline ProFm] -> Writing magic bytes...") + stream.write(version.magicBytes) + println("[Baseline ProFm] -> Writing version bytes...") + stream.write(version.versionBytes) + println("[Baseline ProFm] -> Writing sorted data...") + version.write(stream, sortedData, "") + } + println("[Baseline ProFm] -> Done!") + } + } + } + } + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/ComposeConventionPlugin.kt b/build-logic/convention/src/main/kotlin/ComposeConventionPlugin.kt new file mode 100644 index 00000000..4cecbba9 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/ComposeConventionPlugin.kt @@ -0,0 +1,29 @@ +import com.android.build.api.dsl.LibraryExtension +import com.shifthackz.aisdv1.buildlogic.configureCompose +import com.shifthackz.aisdv1.buildlogic.configureKotlinAndroid +import com.shifthackz.aisdv1.buildlogic.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.getByType + +class ComposeConventionPlugin : Plugin { + + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.library") + apply("org.jetbrains.kotlin.android") + apply("generic.jacoco") + } + + val extension = extensions.getByType() + configureCompose(extension) + + extensions.configure { + configureKotlinAndroid(this) + defaultConfig.targetSdk = libs.findVersion("targetSdk").get().toString().toInt() + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/JacocoConventionPlugin.kt b/build-logic/convention/src/main/kotlin/JacocoConventionPlugin.kt new file mode 100644 index 00000000..5bc8f1b3 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/JacocoConventionPlugin.kt @@ -0,0 +1,32 @@ +import com.android.build.gradle.BaseExtension +import com.shifthackz.aisdv1.buildlogic.jacocoCodeCoverageReporting +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.tasks.testing.Test +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.withType +import org.gradle.testing.jacoco.plugins.JacocoTaskExtension + +class JacocoConventionPlugin : Plugin { + + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("jacoco") + } + + tasks.withType { + configure { + isIncludeNoLocationClasses = true + excludes = listOf("jdk.internal.*") + } + } + + extensions.configure { + target.afterEvaluate { + jacocoCodeCoverageReporting(this@configure) + } + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/LibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/LibraryConventionPlugin.kt new file mode 100644 index 00000000..60616a5e --- /dev/null +++ b/build-logic/convention/src/main/kotlin/LibraryConventionPlugin.kt @@ -0,0 +1,24 @@ +import com.android.build.gradle.LibraryExtension +import com.shifthackz.aisdv1.buildlogic.configureKotlinAndroid +import com.shifthackz.aisdv1.buildlogic.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +class LibraryConventionPlugin : Plugin { + + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.library") + apply("org.jetbrains.kotlin.android") + apply("generic.jacoco") + } + + extensions.configure { + configureKotlinAndroid(this) + defaultConfig.targetSdk = libs.findVersion("targetSdk").get().toString().toInt() + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Android.kt b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Android.kt new file mode 100644 index 00000000..292af894 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Android.kt @@ -0,0 +1,50 @@ +package com.shifthackz.aisdv1.buildlogic + +import com.android.build.api.dsl.CommonExtension +import org.gradle.api.JavaVersion +import org.gradle.api.Project +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +internal fun Project.configureKotlinAndroid( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + commonExtension.apply { + compileSdk = libs.findVersion("compileSdk").get().toString().toInt() + + defaultConfig { + minSdk = libs.findVersion("minSdk").get().toString().toInt() + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + getByName("debug") { + enableUnitTestCoverage = true + enableAndroidTestCoverage = false + } + getByName("release") { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + configureKotlin() + } +} + +private fun Project.configureKotlin() { + tasks.withType().configureEach { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + } +} diff --git a/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Application.kt b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Application.kt new file mode 100644 index 00000000..6e1cae21 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Application.kt @@ -0,0 +1,13 @@ +package com.shifthackz.aisdv1.buildlogic + +import com.android.build.api.dsl.ApplicationExtension +import org.gradle.api.Project + +internal fun Project.configureApplication( + commonExtension: ApplicationExtension, +) { + commonExtension.apply { + configureKotlinAndroid(this) + bundle.language.enableSplit = false + } +} diff --git a/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Compose.kt b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Compose.kt new file mode 100644 index 00000000..86b52d10 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Compose.kt @@ -0,0 +1,45 @@ +package com.shifthackz.aisdv1.buildlogic + +import com.android.build.api.dsl.CommonExtension +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +internal fun Project.configureCompose( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + commonExtension.apply { + buildFeatures { + compose = true + buildConfig = true + } + + composeOptions { + kotlinCompilerExtensionVersion = libs.findVersion("composeCompiler").get().toString() + } + + dependencies { + add("implementation", project(":core:common")) + + val bom = libs.findLibrary("androidx.compose.bom").get() + add("implementation", platform(bom)) + + + add("implementation", libs.findLibrary("androidx.compose.runtime").get()) + add("implementation", libs.findLibrary("androidx.compose.material3").get()) + add("implementation", libs.findLibrary("androidx.compose.material.icons").get()) + add("implementation", libs.findLibrary("androidx.compose.ui.graphics").get()) + add("debugImplementation", libs.findLibrary("androidx.compose.ui.tooling").get()) + add("implementation", libs.findLibrary("androidx.compose.ui.tooling.preview").get()) + add("implementation", libs.findLibrary("androidx.compose.activity").get()) + add("implementation", libs.findLibrary("androidx.compose.viewmodel").get()) + add("implementation", libs.findLibrary("androidx.compose.navigation").get()) + add("implementation", libs.findLibrary("androidx.paging.runtime").get()) + add("implementation", libs.findLibrary("androidx.paging.compose").get()) + add("implementation", libs.findLibrary("androidx.lifecycle.viewmodel").get()) + add("implementation", libs.findLibrary("androidx.lifecycle.compose").get()) + add("implementation", libs.findLibrary("google.accompanist.systemuicontroller").get()) + add("implementation", libs.findLibrary("rx.java").get()) + add("implementation", libs.findLibrary("shifthackz.mvi").get()) + } + } +} diff --git a/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Jacoco.kt b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Jacoco.kt new file mode 100644 index 00000000..a62184c9 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Jacoco.kt @@ -0,0 +1,102 @@ +@file:Suppress("UNUSED_VARIABLE") + +package com.shifthackz.aisdv1.buildlogic + +import com.android.build.gradle.BaseExtension +import org.gradle.api.Project +import org.gradle.testing.jacoco.tasks.JacocoReport + +private val jacocoExclusions = listOf( + "**/R.class", + "**/R\$*.class", + "**/BuildConfig.*", + "**/Manifest*.*", + "**/*Test*.*", +) + +internal fun Project.jacocoCodeCoverageReporting( + commonExtension: BaseExtension, +) { + val buildTypes = commonExtension.buildTypes.map { it.name } + val productFlavors = commonExtension + .productFlavors + .map { it.name } + .takeIf(List::isNotEmpty) ?: listOf("") + + productFlavors.forEach { productFlavorName -> + buildTypes.forEach { buildTypeName -> + val (sourceName, sourcePath) = if (productFlavorName.isEmpty()) { + buildTypeName to buildTypeName + } else { + val type = buildTypeName.replaceFirstChar { + if (it.isLowerCase()) it.titlecase() else "$it" + } + Pair( + "${productFlavorName}${type}", + "${productFlavorName}/${buildTypeName}" + ) + } + + val testTaskName = buildString { + append("test") + append( + sourceName.replaceFirstChar { + if (it.isLowerCase()) it.titlecase() else "$it" + } + ) + append("UnitTest") + } + val jacocoTaskName = buildString { + append("jacoco") + append( + testTaskName.replaceFirstChar { + if (it.isLowerCase()) it.titlecase() else "$it" + } + ) + append("Coverage") + } + println("[Jacoco] Task -> ${project.displayName.replace("\'", "")}:${jacocoTaskName}") + + tasks.register(jacocoTaskName, JacocoReport::class.java) { + dependsOn(testTaskName) + group = "Reporting" + description = buildString { + append("Generate Jacoco coverage reports on the ") + append( + sourceName.replaceFirstChar { + if (it.isLowerCase()) it.titlecase() else "$it" + } + ) + append(" build") + } + + reports { + xml.required.set(false) + csv.required.set(false) + html.required.set(true) + } + + sourceDirectories.setFrom(layout.projectDirectory.dir("src/main")) + + classDirectories.setFrom( + files( + fileTree(layout.buildDirectory.dir("intermediates/javac/")) { + exclude(jacocoExclusions) + }, + fileTree(layout.buildDirectory.dir("tmp/kotlin-classes/")) { + exclude(jacocoExclusions) + }, + ) + ) + + executionData.setFrom( + files( + fileTree(layout.buildDirectory) { + include("**/*.exec", "**/*.ec") + } + ) + ) + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Project.kt b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Project.kt new file mode 100644 index 00000000..e95faef6 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/shifthackz/aisdv1/buildlogic/Project.kt @@ -0,0 +1,9 @@ +package com.shifthackz.aisdv1.buildlogic + +import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.kotlin.dsl.getByType + +val Project.libs: VersionCatalog + get() = extensions.getByType().named("libs") diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 00000000..aea6bd3b --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,29 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + maven { + url = uri("https://jitpack.io") + } + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { + url = uri("https://jitpack.io") + } + } + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} + +rootProject.name = "build-logic" + +include(":convention") diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 2377108e..00000000 --- a/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -buildscript { - ext { - minSdk = 24 - targetSdk = 34 - } -} - -plugins { - id 'com.android.application' version '8.3.1' apply false - id 'com.android.library' version '8.3.1' apply false - id 'org.jetbrains.kotlin.android' version '1.9.21' apply false -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..71a2e7db --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,5 @@ +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.jetbrains.kotlin.android) apply false +} diff --git a/core/common/build.gradle b/core/common/build.gradle deleted file mode 100755 index 28185f1a..00000000 --- a/core/common/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.core.common' -} - -dependencies { - implementation androidx.core - implementation di.koinCore - implementation reactive.rxjava - implementation log.timber - testImplementation test.junit -} diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts new file mode 100755 index 00000000..cce5a887 --- /dev/null +++ b/core/common/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.core.common" +} + +dependencies { + implementation(libs.androidx.core) + implementation(libs.koin.core) + implementation(libs.rx.java) + implementation(libs.timber) + testImplementation(libs.test.junit) +} diff --git a/core/common/proguard-rules.pro b/core/common/proguard-rules.pro index 481bb434..ff59496d 100755 --- a/core/common/proguard-rules.pro +++ b/core/common/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/core/imageprocessing/build.gradle b/core/imageprocessing/build.gradle deleted file mode 100644 index 9f8bd8bd..00000000 --- a/core/imageprocessing/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.core.imageprocessing' -} - -dependencies { - implementation project(":core:common") - implementation di.koinCore - implementation di.koinAndroid - implementation reactive.rxkotlin -} diff --git a/core/imageprocessing/build.gradle.kts b/core/imageprocessing/build.gradle.kts new file mode 100644 index 00000000..5a2f23bc --- /dev/null +++ b/core/imageprocessing/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.core.imageprocessing" +} + +dependencies { + implementation(project(":core:common")) + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.rx.kotlin) +} diff --git a/core/imageprocessing/proguard-rules.pro b/core/imageprocessing/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/core/imageprocessing/proguard-rules.pro +++ b/core/imageprocessing/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/core/localization/build.gradle b/core/localization/build.gradle deleted file mode 100644 index b92e9b6e..00000000 --- a/core/localization/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.core.localization' -} diff --git a/core/localization/build.gradle.kts b/core/localization/build.gradle.kts new file mode 100644 index 00000000..bc03000a --- /dev/null +++ b/core/localization/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.core.localization" +} diff --git a/core/localization/proguard-rules.pro b/core/localization/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/core/localization/proguard-rules.pro +++ b/core/localization/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/core/notification/build.gradle b/core/notification/build.gradle deleted file mode 100644 index 24b6f260..00000000 --- a/core/notification/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.core.notification' -} - -dependencies { - implementation project(":core:common") - implementation project(":core:ui") - implementation di.koinCore - implementation di.koinAndroid - implementation androidx.core -} diff --git a/core/notification/build.gradle.kts b/core/notification/build.gradle.kts new file mode 100644 index 00000000..ab2254e7 --- /dev/null +++ b/core/notification/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.core.notification" +} + +dependencies { + implementation(project(":core:common")) + implementation(project(":core:ui")) + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.androidx.core) +} diff --git a/core/notification/proguard-rules.pro b/core/notification/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/core/notification/proguard-rules.pro +++ b/core/notification/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/core/ui/build.gradle b/core/ui/build.gradle deleted file mode 100755 index cea77889..00000000 --- a/core/ui/build.gradle +++ /dev/null @@ -1,40 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.core.ui' - buildFeatures { - compose true - buildConfig true - } - composeOptions { - kotlinCompilerExtensionVersion = "1.5.7" - } -} - -dependencies { - api project(":core:common") - api platform(androidx.composeBom) - api androidx.composeRuntime - api androidx.composeMaterial3 - api androidx.composeMaterialIconsExtended - debugApi androidx.composeUiTooling - api androidx.composeUiToolingPreview - api androidx.composeActivity - api androidx.composeViewModel - api androidx.composeNavigation - api androidx.pagingRuntime - api androidx.pagingCompose - - api androidx.composeUiGraphics - api androidx.lifecycleViewModel - api androidx.lifecycleCompose - api google.accompanistSystemUiController - api ui.mvi - - implementation reactive.rxjava -} diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts new file mode 100755 index 00000000..a9cb8e04 --- /dev/null +++ b/core/ui/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + alias(libs.plugins.generic.compose) +} + +android { + namespace = "com.shifthackz.aisdv1.core.ui" +} diff --git a/core/validation/build.gradle b/core/validation/build.gradle deleted file mode 100644 index eb43efd2..00000000 --- a/core/validation/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.core.validation' -} - -dependencies { - implementation di.koinCore - implementation reactive.rxkotlin - testImplementation test.junit - testImplementation test.mockk -} diff --git a/core/validation/build.gradle.kts b/core/validation/build.gradle.kts new file mode 100644 index 00000000..8afadbb0 --- /dev/null +++ b/core/validation/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.core.validation" +} + +dependencies { + implementation(libs.koin.core) + implementation(libs.rx.kotlin) + testImplementation(libs.test.junit) + testImplementation(libs.test.mockk) +} diff --git a/core/validation/proguard-rules.pro b/core/validation/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/core/validation/proguard-rules.pro +++ b/core/validation/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/data/build.gradle b/data/build.gradle deleted file mode 100755 index 8c09db1e..00000000 --- a/data/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' - id 'kotlin-kapt' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.data' - testOptions { - unitTests.all { - jvmArgs( - "--add-opens", "java.base/java.lang=ALL-UNNAMED", - "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED" - ) - } - } -} - -dependencies { - implementation project(":core:common") - implementation project(":core:imageprocessing") - implementation project(":domain") - implementation project(":network") - implementation project(":storage") - implementation di.koinCore - implementation di.koinAndroid - implementation reactive.rxkotlin - implementation google.gson - testImplementation test.junit - testImplementation test.mockito - testImplementation test.mockk -} diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100755 index 00000000..c2ced2b7 --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,28 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.data" + testOptions.unitTests.all { test -> + test.jvmArgs( + "--add-opens", "java.base/java.lang=ALL-UNNAMED", + "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED" + ) + } +} + +dependencies { + implementation(project(":core:common")) + implementation(project(":core:imageprocessing")) + implementation(project(":domain")) + implementation(project(":network")) + implementation(project(":storage")) + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.rx.kotlin) + implementation(libs.google.gson) + testImplementation(libs.test.junit) + testImplementation(libs.test.mockito) + testImplementation(libs.test.mockk) +} diff --git a/data/proguard-rules.pro b/data/proguard-rules.pro index 481bb434..ff59496d 100755 --- a/data/proguard-rules.pro +++ b/data/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/demo/build.gradle b/demo/build.gradle deleted file mode 100644 index 97eb5ef0..00000000 --- a/demo/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' - id 'kotlin-kapt' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.demo' -} - -dependencies { - implementation project(":core:common") - implementation project(":domain") - implementation di.koinCore - implementation reactive.rxkotlin - testImplementation test.junit - testImplementation test.mockk -} diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts new file mode 100644 index 00000000..5f4b0b29 --- /dev/null +++ b/demo/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.demo" +} + +dependencies { + implementation(project(":core:common")) + implementation(project(":domain")) + implementation(libs.koin.core) + implementation(libs.rx.kotlin) + testImplementation(libs.test.junit) + testImplementation(libs.test.mockk) +} diff --git a/demo/proguard-rules.pro b/demo/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/demo/proguard-rules.pro +++ b/demo/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/dependencies.gradle b/dependencies.gradle deleted file mode 100755 index c574755f..00000000 --- a/dependencies.gradle +++ /dev/null @@ -1,129 +0,0 @@ -ext { - composeBomVersion = '2024.02.01' - composeNavVersion = '2.7.6' - lifecycleViewModelVersion = '2.6.2' - lifecycleComposeVersion = '2.6.2' - coreKtxVersion = '1.12.0' - appCompatVersion = '1.6.1' - activityVersion = '1.8.2' - koinVersion = '3.4.3' - koinComposeVersion = '3.4.6' - retrofitVersion = '2.9.0' - okHttpVersion = '5.0.0-alpha.11' - roomVersion = '2.5.2' - rxJavaVersion = '3.1.6' - rxKotlinVersion = '3.0.1' - rxAndroidVersion = '3.0.2' - rxNetworkVersion = '4.0.0' - pagingVersion = '3.1.1' - pagingComposeVersion = '1.0.0-alpha18' - imagePickerVersion = 'v2.0.3' - mviVersion = '1.0.1' - dayNightSwitchVersion = '1.0.0' - timberVersion = '5.0.1' - apacheLangVersion = '3.14.0' - gsonVersion = '2.10.1' - googleMaterialVersion = '1.9.0' - accompanistSystemUiControllerVersion = '0.30.1' - cryptoVersion = '1.0.0' - exifinterfaceVersion = '1.3.6' - onnxruntimeVersion = '1.18.0' - catppuccinVersion = '0.1.1' - composeGesturesVersion = '3.1' - composeEasyCropVersion = '0.1.1' - workManagerVersion = '2.9.0' - - testJunitVersion = '4.13.2' - testMockitoVersion = '2.2.0' - testMockkVersion = '1.13.11' - testCoroutinesVersion = '1.8.1' - testTurbibeVersion = '1.1.0' - testRobolectricVersion = '4.13' - testCopmoseUiVersion = '1.6.8' - - androidx = [ - core : "androidx.core:core-ktx:$coreKtxVersion", - appcompat : "androidx.appcompat:appcompat:$appCompatVersion", - activity : "androidx.activity:activity-ktx:$activityVersion", - composeBom : "androidx.compose:compose-bom:$composeBomVersion", - composeRuntime : "androidx.compose.runtime:runtime", - composeMaterial3 : "androidx.compose.material3:material3", - composeMaterialIconsExtended: "androidx.compose.material:material-icons-extended", - composeUiGraphics : "androidx.compose.ui:ui-graphics", - composeUiTooling : "androidx.compose.ui:ui-tooling", - composeUiToolingPreview : "androidx.compose.ui:ui-tooling-preview", - composeActivity : "androidx.activity:activity-compose:$activityVersion", - composeViewModel : "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleViewModelVersion", - composeNavigation : "androidx.navigation:navigation-compose:$composeNavVersion", - lifecycleViewModel : "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleViewModelVersion", - lifecycleCompose : "androidx.lifecycle:lifecycle-runtime-compose:$lifecycleComposeVersion", - pagingRuntime : "androidx.paging:paging-runtime:$pagingVersion", - pagingRx3 : "androidx.paging:paging-rxjava3:$pagingVersion", - pagingCompose : "androidx.paging:paging-compose:$pagingComposeVersion", - crypto : "androidx.security:security-crypto:$cryptoVersion", - exifinterface : "androidx.exifinterface:exifinterface:$exifinterfaceVersion", - workManager : "androidx.work:work-runtime-ktx:$workManagerVersion", - workManagerRx : "androidx.work:work-rxjava2:$workManagerVersion", - ] - google = [ - gson : "com.google.code.gson:gson:$gsonVersion", - material : "com.google.android.material:material:$googleMaterialVersion", - accompanistSystemUiController: "com.google.accompanist:accompanist-systemuicontroller:$accompanistSystemUiControllerVersion", - ] - microsoft = [ - onnxruntime: "com.microsoft.onnxruntime:onnxruntime-android:$onnxruntimeVersion" - ] - di = [ - koinCore : "io.insert-koin:koin-core:$koinVersion", - koinAndroid: "io.insert-koin:koin-android:$koinVersion", - koinCompose: "io.insert-koin:koin-androidx-compose:$koinComposeVersion", - ] - retrofit = [ - core : "com.squareup.retrofit2:retrofit:$retrofitVersion", - converterGson: "com.squareup.retrofit2:converter-gson:$retrofitVersion", - adapterRx : "com.squareup.retrofit2:adapter-rxjava3:$retrofitVersion", - ] - okhttp = [ - core : "com.squareup.okhttp3:okhttp:$okHttpVersion", - logging: "com.squareup.okhttp3:logging-interceptor:$okHttpVersion", - ] - database = [ - roomRuntime : "androidx.room:room-runtime:$roomVersion", - roomCompiler: "androidx.room:room-compiler:$roomVersion", - roomRx3 : "androidx.room:room-rxjava3:$roomVersion", - ] - reactive = [ - rxjava : "io.reactivex.rxjava3:rxjava:$rxJavaVersion", - rxkotlin : "io.reactivex.rxjava3:rxkotlin:$rxKotlinVersion", - rxandroid: "io.reactivex.rxjava3:rxandroid:$rxAndroidVersion", - rxnetwork: "io.github.softartdev:reactivenetwork-rx3:$rxNetworkVersion", - ] - ui = [ - imagePicker : "com.github.ShiftHackZ:ImagePicker:$imagePickerVersion", - mvi : "com.github.ShiftHackZ:AndroidCoreMVI:$mviVersion", - dayNightSwitch : "com.github.ShiftHackZ:DayNightSwitch:$dayNightSwitchVersion", - catppuccinLegacy : "com.github.ShiftHackZ.Catppuccin-Android-Library:palette-legacy:$catppuccinVersion", - catppuccinCompose : "com.github.ShiftHackZ.Catppuccin-Android-Library:compose:$catppuccinVersion", - catppuccinSplashscreen: "com.github.ShiftHackZ.Catppuccin-Android-Library:splashscreen:$catppuccinVersion", - composeGestures : "com.github.SmartToolFactory:Compose-Extended-Gestures:$composeGesturesVersion", - composeEasyCrop : "io.github.mr0xf00:easycrop:$composeEasyCropVersion", - ] - log = [ - timber: "com.jakewharton.timber:timber:$timberVersion", - ] - apache = [ - stringutils: "org.apache.commons:commons-lang3:$apacheLangVersion", - ] - test = [ - junit : "junit:junit:$testJunitVersion", - mockito : "com.nhaarman.mockitokotlin2:mockito-kotlin:$testMockitoVersion", - mockk : "io.mockk:mockk:$testMockkVersion", - coroutines : "org.jetbrains.kotlinx:kotlinx-coroutines-test:$testCoroutinesVersion", - turbine : "app.cash.turbine:turbine:$testTurbibeVersion", - robolectric : "org.robolectric:robolectric:$testRobolectricVersion", - composeUiJunit : "androidx.compose.ui:ui-test-junit4:$testCopmoseUiVersion", - composeUiManifest: "androidx.compose.ui:ui-test-manifest:$testCopmoseUiVersion", - koin : "io.insert-koin:koin-test:$koinVersion", - koinJunit : "io.insert-koin:koin-test-junit4:$koinVersion", - ] -} diff --git a/domain/build.gradle b/domain/build.gradle deleted file mode 100755 index b196bb2c..00000000 --- a/domain/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' - id 'kotlin-kapt' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.domain' -} - -dependencies { - implementation project(":core:common") - implementation di.koinCore - implementation reactive.rxkotlin - testImplementation test.junit - testImplementation test.mockito - testImplementation test.mockk -} diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts new file mode 100755 index 00000000..bf96cdcd --- /dev/null +++ b/domain/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.domain" +} + +dependencies { + implementation(project(":core:common")) + implementation(libs.koin.core) + implementation(libs.rx.kotlin) + testImplementation(libs.test.junit) + testImplementation(libs.test.mockito) + testImplementation(libs.test.mockk) +} diff --git a/domain/proguard-rules.pro b/domain/proguard-rules.pro index 481bb434..ff59496d 100755 --- a/domain/proguard-rules.pro +++ b/domain/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/feature/auth/build.gradle b/feature/auth/build.gradle deleted file mode 100644 index 91cc96ce..00000000 --- a/feature/auth/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.feature.auth' -} - -dependencies { - implementation project(":core:common") - implementation project(":domain") - implementation di.koinCore - implementation di.koinAndroid - implementation androidx.crypto - implementation google.gson -} diff --git a/feature/auth/build.gradle.kts b/feature/auth/build.gradle.kts new file mode 100644 index 00000000..17cfb2b9 --- /dev/null +++ b/feature/auth/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.feature.auth" +} + +dependencies { + implementation(project(":core:common")) + implementation(project(":domain")) + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.androidx.security.crypto) + implementation(libs.google.gson) +} diff --git a/feature/auth/proguard-rules.pro b/feature/auth/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/feature/auth/proguard-rules.pro +++ b/feature/auth/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/feature/diffusion/build.gradle b/feature/diffusion/build.gradle deleted file mode 100644 index 0a7ce930..00000000 --- a/feature/diffusion/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.feature.diffusion' -} - -dependencies { - implementation project(":core:common") - implementation project(":domain") - implementation di.koinCore - implementation reactive.rxkotlin - implementation microsoft.onnxruntime -} diff --git a/feature/diffusion/build.gradle.kts b/feature/diffusion/build.gradle.kts new file mode 100644 index 00000000..03c679e4 --- /dev/null +++ b/feature/diffusion/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.feature.diffusion" +} + +dependencies { + implementation(project(":core:common")) + implementation(project(":domain")) + implementation(libs.koin.core) + implementation(libs.rx.kotlin) + implementation(libs.microsoft.onnx.runtime.android) +} diff --git a/feature/diffusion/proguard-rules.pro b/feature/diffusion/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/feature/diffusion/proguard-rules.pro +++ b/feature/diffusion/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/feature/work/build.gradle b/feature/work/build.gradle deleted file mode 100644 index 50ed1e09..00000000 --- a/feature/work/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.feature.work' -} - -dependencies { - implementation project(":core:common") - implementation project(":core:localization") - implementation project(":core:notification") - implementation project(":domain") - implementation di.koinCore - implementation di.koinAndroid - implementation reactive.rxkotlin - implementation androidx.workManager -} diff --git a/feature/work/build.gradle.kts b/feature/work/build.gradle.kts new file mode 100644 index 00000000..d7e63721 --- /dev/null +++ b/feature/work/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.feature.work" +} + +dependencies { + implementation(project(":core:common")) + implementation(project(":core:localization")) + implementation(project(":core:notification")) + implementation(project(":domain")) + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.rx.kotlin) + implementation(libs.androidx.work.runtime) +} diff --git a/feature/work/proguard-rules.pro b/feature/work/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/feature/work/proguard-rules.pro +++ b/feature/work/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/gradle/ci.gradle b/gradle/ci.gradle deleted file mode 100644 index b6e24542..00000000 --- a/gradle/ci.gradle +++ /dev/null @@ -1,23 +0,0 @@ -import org.apache.tools.ant.taskdefs.condition.Os - -buildscript { - ext { - getApplicationVersionCode = { -> - try { - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - def code = new ByteArrayOutputStream() - exec { - commandLine 'cmd', '/c', 'git', 'rev-list', '--count', 'HEAD' - standardOutput = code - } - return code.toString().replace('\n', '').toString().toInteger() - } else { - return "git rev-list --count HEAD".execute().text.toInteger() - } - } catch (Exception e) { - println(e) - return 1 - } - } - } -} diff --git a/gradle/common.gradle b/gradle/common.gradle deleted file mode 100755 index c9718672..00000000 --- a/gradle/common.gradle +++ /dev/null @@ -1,114 +0,0 @@ -apply plugin: 'jacoco' - -apply from: "$project.rootDir/gradle/ci.gradle" -apply from: "$project.rootDir/dependencies.gradle" - -tasks.withType(Test).configureEach { - jacoco { - includeNoLocationClasses = true - excludes = ['jdk.internal.*'] - } -} - -afterEvaluate { - jacocoCodeCoverageReporting() -} - -android { - compileSdk rootProject.ext.targetSdk - - defaultConfig { - minSdk rootProject.ext.minSdk - targetSdk rootProject.ext.targetSdk - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - debug { - enableUnitTestCoverage = true - enableAndroidTestCoverage = false - } - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = '17' - } -} - -def jacocoCodeCoverageReporting() { - def exclusions = [ - '**/R.class', - '**/R\$*.class', - '**/BuildConfig.*', - '**/Manifest*.*', - '**/*Test*.*' - ] - - def buildTypes = android.buildTypes.collect { type -> - type.name - } - def productFlavors = android.productFlavors.collect { flavor -> - flavor.name - } - - if (!productFlavors) productFlavors.add('') - - productFlavors.each { productFlavorName -> - buildTypes.each { buildTypeName -> - def sourceName, sourcePath - if (!productFlavorName) { - sourceName = sourcePath = "${buildTypeName}" - } else { - sourceName = "${productFlavorName}${buildTypeName.capitalize()}" - sourcePath = "${productFlavorName}/${buildTypeName}" - } - - def testTaskName = "test${sourceName.capitalize()}UnitTest" - def jacocoTaskName = "jacoco${testTaskName.capitalize()}Coverage" - - System.out.println("[Jacoco] Task -> ${project.displayName.replace('\'', '')}:${jacocoTaskName}") - - tasks.register(jacocoTaskName, JacocoReport) { - dependsOn([testTaskName]) - - group = "Reporting" - description = "Generate Jacoco coverage reports on the ${sourceName.capitalize()} build." - - reports { - xml.required = false - csv.required = false - html.required = true - } - - sourceDirectories.setFrom(layout.projectDirectory.dir("src/main")) - - classDirectories.setFrom( - files( - fileTree(layout.buildDirectory.dir("intermediates/javac/")) { - exclude(exclusions) - }, - fileTree(layout.buildDirectory.dir("tmp/kotlin-classes/")) { - exclude(exclusions) - } - ) - ) - - executionData.setFrom( - files( - fileTree(layout.buildDirectory) { include("**/*.exec", "**/*.ec") } - ) - ) - } - } - } -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..39ebfcaa --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,121 @@ +[versions] +versionName = "0.6.4" +versionCode = "184" +targetSdk = "34" +compileSdk = "34" +minSdk = "24" +agp = "8.3.2" +kotlin = "1.9.21" +appcompat = "1.7.0" +composeCompiler = "1.5.7" +composeBom = "2024.08.00" +composeActivity = "1.9.1" +composeJunit = "1.6.8" +lifecycleViewModel = "2.8.4" +navigation = "2.7.7" +paging = "3.1.1" +pagingCompose = "1.0.0-alpha18" +gson = "2.10.1" +accompanistSystemUi = "0.30.1" +retrofit = "2.9.0" +okhttp = "5.0.0-alpha.11" +koin = "3.4.3" +koinCompose = "3.4.6" +rxAndroidVersion = "3.0.2" +rxJavaVersion = "3.1.6" +rxKotlinVersion = "3.0.1" +rxNetworkVersion = "4.0.0" +material = "1.12.0" +junit = "4.13.2" +mockk = "1.13.11" +mockito = "2.2.0" +coreKtx = "1.13.1" +crypto = "1.0.0" +onnx = "1.18.0" +workManager = "2.9.1" +room = "2.6.1" +timber = "5.0.1" +exif = "1.3.7" +apacheStringUtils = "3.14.0" +composeGestures = "3.1" +crop = "0.1.1" +mvi = "1.0.1" +dayNightSwitch = "1.0.0" +imagepicker = "v2.0.3" +catppuccin = "0.1.1" +turbine = "1.1.0" +roboelectric = "4.13" +testCoroutines = "1.8.1" + +[libraries] +android-tools-build-gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "agp"} +kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +apache-stringutils = { group = "org.apache.commons", name = "commons-lang3", version.ref = "apacheStringUtils" } +androidx-core = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat"} +androidx-compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "composeActivity" } +androidx-compose-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycleViewModel" } +androidx-lifecycle-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycleViewModel" } +androidx-lifecycle-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycleViewModel" } +androidx-compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigation" } +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } +androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" } +androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } +androidx-compose-material-icons = { group = "androidx.compose.material", name = "material-icons-extended" } +androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +androidx-exif = { group = "androidx.exifinterface", name = "exifinterface", version.ref = "exif" } +androidx-paging-runtime = { group = "androidx.paging", name = "paging-runtime", version.ref = "paging" } +androidx-paging-rx = { group = "androidx.paging", name = "paging-rxjava3", version.ref = "paging" } +androidx-paging-compose = { group = "androidx.paging", name = "paging-compose", version.ref = "pagingCompose" } +androidx-security-crypto = { group = "androidx.security", name = "security-crypto", version.ref = "crypto" } +androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" } +androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" } +androidx-room-rx = { group = "androidx.room", name = "room-rxjava3", version.ref = "room" } +androidx-work-runtime = { group = "androidx.work", name = "work-runtime", version.ref = "workManager" } +google-gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } +google-material = { group = "com.google.android.material", name = "material", version.ref = "material" } +google-accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanistSystemUi" } +retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" } +retrofit-converter-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" } +retrofit-adapter-rxjava3 = { group = "com.squareup.retrofit2", name = "adapter-rxjava3", version.ref = "retrofit" } +okhttp-core = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp"} +okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp"} +koin-core = { group = "io.insert-koin", name = "koin-core", version.ref = "koin" } +koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin" } +koin-compose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koinCompose" } +microsoft-onnx-runtime-android = { group = "com.microsoft.onnxruntime", name = "onnxruntime-android", version.ref = "onnx" } +rx-android = { group = "io.reactivex.rxjava3", name = "rxandroid", version.ref = "rxAndroidVersion" } +rx-java = { group = "io.reactivex.rxjava3", name = "rxjava", version.ref = "rxJavaVersion" } +rx-kotlin = { group = "io.reactivex.rxjava3", name = "rxkotlin", version.ref = "rxKotlinVersion" } +rx-network = { group = "io.github.softartdev", name = "reactivenetwork-rx3", version.ref = "rxNetworkVersion" } +timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "timber" } +test-junit = { group = "junit", name = "junit", version.ref = "junit"} +test-mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk"} +test-mockito = { group = "com.nhaarman.mockitokotlin2", name = "mockito-kotlin", version.ref = "mockito"} +test-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "testCoroutines" } +test-koin = { group = "io.insert-koin", name = "koin-test", version.ref = "koin" } +test-koin-junit = { group = "io.insert-koin", name = "koin-test-junit4", version.ref = "koin" } +test-turbine = { group = "app.cash.turbine", name = "turbine", version.ref = "turbine" } +test-roboelectric = { group = "org.robolectric", name = "robolectric", version.ref = "roboelectric"} +test-compose-junit = { group = "androidx.compose.ui", name = "ui-test-junit4", version.ref = "composeJunit"} +test-compose-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest", version.ref = "composeJunit"} +compose-gestures = { group = "com.github.SmartToolFactory", name = "Compose-Extended-Gestures", version.ref = "composeGestures" } +compose-crop = { group = "io.github.mr0xf00", name = "easycrop", version.ref = "crop" } +shifthackz-mvi = { group = "com.github.ShiftHackZ", name = "AndroidCoreMVI", version.ref = "mvi" } +shifthackz-imagepicker = { group = "com.github.ShiftHackZ", name = "ImagePicker", version.ref = "imagepicker" } +shifthackz-daynightswitch = { group = "com.github.ShiftHackZ", name = "DayNightSwitch", version.ref = "dayNightSwitch" } +shifthackz-catppuccin-legacy = { group = "com.github.ShiftHackZ.Catppuccin-Android-Library", name = "palette-legacy", version.ref = "catppuccin" } +shifthackz-catppuccin-compose = { group = "com.github.ShiftHackZ.Catppuccin-Android-Library", name = "compose", version.ref = "catppuccin" } +shifthackz-catppuccin-splash = { group = "com.github.ShiftHackZ.Catppuccin-Android-Library", name = "splashscreen", version.ref = "catppuccin" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +jetbrains-kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version="unspecified" } +generic-library = { id = "generic.library", version = "unspecified" } +generic-baseline-profm = { id = "generic.baseline.profm", version = "unspecified" } +generic-compose = { id = "generic.compose", version = "unspecified" } +generic-application = { id = "generic.application", version = "unspecified" } diff --git a/gradle/plugins.gradle b/gradle/plugins.gradle deleted file mode 100644 index dfd2a477..00000000 --- a/gradle/plugins.gradle +++ /dev/null @@ -1,2 +0,0 @@ -apply plugin: 'com.google.gms.google-services' -apply plugin: 'com.google.firebase.crashlytics' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f239e6bc..24f1e3bd 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Feb 08 12:27:05 EET 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/network/build.gradle b/network/build.gradle deleted file mode 100755 index 1c273e78..00000000 --- a/network/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' - id 'kotlin-kapt' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.network' -} - -dependencies { - implementation project(":core:common") - implementation project(":feature:auth") - implementation google.gson - implementation retrofit.core - implementation retrofit.converterGson - implementation retrofit.adapterRx - api okhttp.core - implementation okhttp.logging - implementation di.koinCore - implementation reactive.rxkotlin - implementation reactive.rxnetwork - testImplementation test.junit - testImplementation test.mockk -} diff --git a/network/build.gradle.kts b/network/build.gradle.kts new file mode 100755 index 00000000..989be25c --- /dev/null +++ b/network/build.gradle.kts @@ -0,0 +1,23 @@ +plugins { + alias(libs.plugins.generic.library) +} + +android { + namespace = "com.shifthackz.aisdv1.network" +} + +dependencies { + implementation(project(":core:common")) + implementation(project(":feature:auth")) + implementation(libs.google.gson) + implementation(libs.retrofit.core) + implementation(libs.retrofit.converter.gson) + implementation(libs.retrofit.adapter.rxjava3) + api(libs.okhttp.core) + implementation(libs.okhttp.logging) + implementation(libs.koin.core) + implementation(libs.rx.kotlin) + implementation(libs.rx.network) + testImplementation(libs.test.junit) + testImplementation(libs.test.mockk) +} diff --git a/network/proguard-rules.pro b/network/proguard-rules.pro index 481bb434..ff59496d 100755 --- a/network/proguard-rules.pro +++ b/network/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/presentation/build.gradle b/presentation/build.gradle deleted file mode 100755 index 1594085c..00000000 --- a/presentation/build.gradle +++ /dev/null @@ -1,73 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' - id 'kotlin-kapt' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.presentation' - buildFeatures { - compose true - } - composeOptions { - kotlinCompilerExtensionVersion = "1.5.7" - } - testOptions { - unitTests { - all { - jvmArgs( - "--add-opens", "java.base/java.lang=ALL-UNNAMED", - "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED" - ) - } - returnDefaultValues = true - includeAndroidResources = true - } - } -} - -dependencies { - api project(":core:ui") - implementation project(":core:common") - implementation project(":core:imageprocessing") - implementation project(":core:localization") - implementation project(":core:notification") - implementation project(":core:validation") - implementation project(":domain") - - implementation di.koinCore - implementation di.koinAndroid - implementation di.koinCompose - - implementation androidx.core - implementation androidx.appcompat - implementation androidx.activity - implementation androidx.pagingRx3 - implementation androidx.exifinterface - - implementation google.material - implementation apache.stringutils - - implementation reactive.rxjava - implementation reactive.rxkotlin - implementation reactive.rxandroid - - implementation ui.imagePicker - implementation ui.catppuccinCompose - implementation ui.dayNightSwitch - implementation ui.catppuccinSplashscreen - implementation ui.composeGestures - implementation ui.composeEasyCrop - - testImplementation test.junit - testImplementation test.koin - testImplementation test.koinJunit - testImplementation test.mockk - testImplementation test.coroutines - testImplementation test.turbine - testImplementation test.robolectric - testImplementation test.composeUiJunit - debugImplementation test.composeUiManifest -} diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts new file mode 100755 index 00000000..f0cfc386 --- /dev/null +++ b/presentation/build.gradle.kts @@ -0,0 +1,59 @@ +plugins { + alias(libs.plugins.generic.compose) +} + +android { + namespace = "com.shifthackz.aisdv1.presentation" + testOptions.unitTests{ + all { test -> + test.jvmArgs( + "--add-opens", "java.base/java.lang=ALL-UNNAMED", + "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED" + ) + } + isReturnDefaultValues = true + isIncludeAndroidResources = true + } +} + +dependencies { + api(project(":core:ui")) + implementation(project(":core:common")) + implementation(project(":core:imageprocessing")) + implementation(project(":core:localization")) + implementation(project(":core:notification")) + implementation(project(":core:validation")) + implementation(project(":domain")) + + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.koin.compose) + + implementation(libs.androidx.appcompat) + implementation(libs.androidx.paging.rx) + implementation(libs.androidx.exif) + + implementation(libs.google.material) + implementation(libs.apache.stringutils) + + implementation(libs.rx.java) + implementation(libs.rx.kotlin) + implementation(libs.rx.android) + + implementation(libs.shifthackz.imagepicker) + implementation(libs.shifthackz.daynightswitch) + implementation(libs.shifthackz.catppuccin.compose) + implementation(libs.shifthackz.catppuccin.splash) + implementation(libs.compose.gestures) + implementation(libs.compose.crop) + + testImplementation(libs.test.junit) + testImplementation(libs.test.koin) + testImplementation(libs.test.koin.junit) + testImplementation(libs.test.mockk) + testImplementation(libs.test.coroutines) + testImplementation(libs.test.turbine) + testImplementation(libs.test.roboelectric) + testImplementation(libs.test.compose.junit) + debugImplementation(libs.test.compose.manifest) +} diff --git a/presentation/proguard-rules.pro b/presentation/proguard-rules.pro index 481bb434..ff59496d 100755 --- a/presentation/proguard-rules.pro +++ b/presentation/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/settings.gradle b/settings.gradle deleted file mode 100755 index d78d583a..00000000 --- a/settings.gradle +++ /dev/null @@ -1,38 +0,0 @@ -pluginManagement { - repositories { - google() - mavenCentral() - gradlePluginPortal() - maven { url 'https://jitpack.io' } - } -} -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - maven { url 'https://jitpack.io' } - } -} -rootProject.name = "AI Stable Diffusion Client v1" - -def libraries = [ - ':app', - ':core:common', - ':core:imageprocessing', - ':core:localization', - ':core:notification', - ':core:ui', - ':core:validation', - ':data', - ':demo', - ':domain', - ':feature:auth', - ':feature:diffusion', - ':feature:work', - ':network', - ':presentation', - ':storage', -] as String[] - -include libraries diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100755 index 00000000..6ee0480b --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,44 @@ +pluginManagement { + includeBuild("build-logic") + repositories { + google() + mavenCentral() + gradlePluginPortal() + maven { + url = uri("https://jitpack.io") + } + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { + url = uri("https://jitpack.io") + } + } +} + +rootProject.name = "AI Stable Diffusion Client v1" + +val modules = listOf( + ":app", + ":core:common", + ":core:imageprocessing", + ":core:localization", + ":core:notification", + ":core:ui", + ":core:validation", + ":data", + ":demo", + ":domain", + ":feature:auth", + ":feature:diffusion", + ":feature:work", + ":network", + ":presentation", + ":storage", +) + +include(modules) diff --git a/storage/build.gradle b/storage/build.gradle deleted file mode 100755 index 405508b2..00000000 --- a/storage/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' - id 'kotlin-kapt' -} - -apply from: "$project.rootDir/gradle/common.gradle" - -android { - namespace 'com.shifthackz.aisdv1.storage' - defaultConfig { - javaCompileOptions { - annotationProcessorOptions { - arguments += [ - "room.schemaLocation":"$projectDir/schemas".toString(), - "room.incremental":"true", - "room.expandProjection":"true" - ] - } - } - } -} - -dependencies { - implementation di.koinCore - implementation di.koinAndroid - implementation google.gson - implementation database.roomRuntime - implementation database.roomRx3 - kapt database.roomCompiler -} diff --git a/storage/build.gradle.kts b/storage/build.gradle.kts new file mode 100755 index 00000000..94d2bfb3 --- /dev/null +++ b/storage/build.gradle.kts @@ -0,0 +1,27 @@ +plugins { + alias(libs.plugins.generic.library) + kotlin("kapt") +} + +android { + namespace = "com.shifthackz.aisdv1.storage" + defaultConfig { + kapt { + arguments { + arg("room.schemaLocation", "$projectDir/schemas") + arg("room.incremental", "true") + arg("room.expandProjection", "true") + } + } + } +} + +dependencies { + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.google.gson) + implementation(libs.androidx.room.runtime) + implementation(libs.androidx.room.rx) + //ToDo migrate to KSP + kapt(libs.androidx.room.compiler) +} diff --git a/storage/proguard-rules.pro b/storage/proguard-rules.pro index 481bb434..ff59496d 100755 --- a/storage/proguard-rules.pro +++ b/storage/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