Skip to content

Commit

Permalink
Merge pull request #2 from stslex/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
stslex authored Jul 23, 2023
2 parents 773fadd + 7be7e66 commit 2b9fb63
Show file tree
Hide file tree
Showing 47 changed files with 784 additions and 240 deletions.
63 changes: 3 additions & 60 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,68 +1,11 @@
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
}

android {
namespace = "com.stslex.aproselection"
compileSdk = 33

defaultConfig {
applicationId = "com.stslex.aproselection"
minSdk = 24
targetSdk = 33
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.3"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
id("aproselection.android.application")
id("aproselection.android.application.compose")
}

dependencies {
implementation(project(":core:ui"))
implementation(project(":core:network"))
implementation(project(":feature:auth"))

implementation(libs.bundles.koin)
implementation(libs.core.ktx)
implementation(libs.lifecycle.runtime.ktx)
implementation(platform(libs.compose.bom))
implementation(libs.bundles.compose)

testImplementation(libs.junit)
androidTestImplementation(libs.bundles.android.test)
androidTestImplementation(platform(libs.compose.bom))
debugImplementation(libs.ui.tooling)
debugImplementation(libs.ui.test.manifest)
}
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".SelectApplication"
android:allowBackup="true"
Expand All @@ -12,6 +14,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AProSelection"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".ui.MainActivity"
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/com/stslex/aproselection/SelectApplication.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
package com.stslex.aproselection

import android.app.Application
import com.stslex.aproselection.feature.auth.di.FeatureAuthModule.featureAuthModule
import com.stslex.aproselection.core.network.di.ModuleCoreNetwork.moduleCoreNetwork
import com.stslex.aproselection.feature.auth.di.ModuleFeatureAuth.moduleFeatureAuth
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin

class SelectApplication : Application() {

override fun onCreate() {
super.onCreate()
startKoin {
androidLogger()
androidContext(applicationContext)
modules(featureAuthModule)
modules(
moduleFeatureAuth,
moduleCoreNetwork
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import com.stslex.aproselection.core.network.AppDestination
import com.stslex.aproselection.core.network.NavigationScreen
import com.stslex.aproselection.core.ui.navigation.AppDestination
import com.stslex.aproselection.core.ui.navigation.NavigationScreen
import com.stslex.aproselection.feature.auth.ui.navigation.authRouter

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.stslex.aproselection.ui.components
package com.stslex.aproselection.ui

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
Expand All @@ -8,7 +8,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.navigation.compose.rememberNavController
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.stslex.aproselection.navigation.NavigationHost
import com.stslex.aproselection.ui.theme.AppTheme
import com.stslex.aproselection.core.ui.theme.AppTheme

@Composable
fun InitialApp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.core.view.WindowCompat
import com.stslex.aproselection.ui.components.InitialApp
import com.stslex.aproselection.ui.theme.AppTheme
import com.stslex.aproselection.core.ui.theme.AppTheme

class MainActivity : ComponentActivity() {

Expand Down
27 changes: 27 additions & 0 deletions app/src/test/java/com/stslex/aproselection/DiKoinModuleTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.stslex.aproselection

import android.content.Context
import com.stslex.aproselection.core.network.di.ModuleCoreNetwork
import com.stslex.aproselection.core.network.di.ModuleCoreNetwork.moduleCoreNetwork
import com.stslex.aproselection.feature.auth.di.ModuleFeatureAuth.moduleFeatureAuth
import org.junit.Test
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.koinApplication
import org.koin.test.KoinTest
import org.koin.test.check.checkModules
import org.mockito.Mockito

class DiKoinModuleTest : KoinTest {

@Test
fun checkKoinModules() {
koinApplication {
androidContext(Mockito.mock(Context::class.java))
modules(
moduleFeatureAuth,
moduleCoreNetwork
)
checkModules()
}
}
}
2 changes: 2 additions & 0 deletions build-logic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
/.gradle
2 changes: 2 additions & 0 deletions build-logic/dependencies/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
/.gradle
32 changes: 32 additions & 0 deletions build-logic/dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
`kotlin-dsl`
}

group = "com.stslex.aproselection.buildlogic"

dependencies {
implementation(libs.android.gradlePlugin)
implementation(libs.kotlin.gradlePlugin)
implementation(libs.kotlin.serialization)
}

gradlePlugin {
plugins {
register("androidApplicationCompose") {
id = "aproselection.android.application.compose"
implementationClass = "AndroidApplicationComposeConventionPlugin"
}
register("androidApplication") {
id = "aproselection.android.application"
implementationClass = "AndroidApplicationConventionPlugin"
}
register("androidLibraryCompose") {
id = "aproselection.android.library.compose"
implementationClass = "AndroidLibraryComposeConventionPlugin"
}
register("androidLibrary") {
id = "aproselection.android.library"
implementationClass = "AndroidLibraryConventionPlugin"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType
import com.stslex.aproselection.configureAndroidCompose

class AndroidApplicationComposeConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {

with(target) {
pluginManager.apply("com.android.application")
val extension = extensions.getByType<ApplicationExtension>()
configureAndroidCompose(extension)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import com.stslex.aproselection.configureKotlinAndroid

class AndroidApplicationConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.android")
}

extensions.configure<ApplicationExtension> {
configureKotlinAndroid(this)

namespace = "com.stslex.aproselection"

defaultConfig.apply {
applicationId = "com.stslex.aproselection"
targetSdk = 33
versionName = "1.0"
versionCode = 1
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import com.android.build.gradle.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType
import com.stslex.aproselection.configureAndroidCompose

class AndroidLibraryComposeConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.android.library")
val extension = extensions.getByType<LibraryExtension>()
configureAndroidCompose(extension)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import com.android.build.gradle.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.kotlin
import com.stslex.aproselection.configureKotlinAndroid

class AndroidLibraryConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.library")
apply("org.jetbrains.kotlin.android")
}

extensions.configure<LibraryExtension> {
configureKotlinAndroid(this)
defaultConfig.apply {
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}
}

val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
configurations.configureEach {
resolutionStrategy {
force(libs.findLibrary("junit").get())
}
}
dependencies {
add("androidTestImplementation", kotlin("test"))
add("testImplementation", kotlin("test"))
}
}
}
}
Loading

0 comments on commit 2b9fb63

Please sign in to comment.