Skip to content

Commit

Permalink
Merge pull request #31 from yuriisurzhykov/18-create-all-required-mod…
Browse files Browse the repository at this point in the history
…ules-for-the-application

18 create all required modules for the application
  • Loading branch information
yuriisurzhykov authored May 23, 2024
2 parents 9d99e28 + 2151cc5 commit 96dd7da
Show file tree
Hide file tree
Showing 48 changed files with 905 additions and 98 deletions.
283 changes: 201 additions & 82 deletions README.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ plugins {

android {
namespace = "com.github.yuriisurzhykov.purs"
compileSdk = 34
compileSdk = ProjectProperties.compileSdkVersion

defaultConfig {
applicationId = "com.github.yuriisurzhykov.purs"
minSdk = 24
targetSdk = 34
minSdk = ProjectProperties.minSdkVersion
targetSdk = ProjectProperties.targetSdkVersion
versionCode = 1
versionName = "1.0"

Expand Down Expand Up @@ -48,17 +48,17 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_19
targetCompatibility = JavaVersion.VERSION_19
sourceCompatibility = ProjectProperties.javaSourceCompatibility
targetCompatibility = ProjectProperties.javaTargetCompatibility
}
kotlinOptions {
jvmTarget = "19"
jvmTarget = ProjectProperties.kotlinJvmTarget
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.14"
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.kotlin.compiler.ext.get()
}
packaging {
resources {
Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.android.library) apply false
}
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/ProjectProperties.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import org.gradle.api.JavaVersion

object ProjectProperties {

val javaSourceCompatibility = JavaVersion.VERSION_19
val javaTargetCompatibility = JavaVersion.VERSION_19

const val kotlinJvmTarget = "19"
const val minSdkVersion = 24
const val targetSdkVersion = 34
const val compileSdkVersion = 34
}
17 changes: 17 additions & 0 deletions buildSrc/src/main/kotlin/RoomSchemaArgProvider.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.process.CommandLineArgumentProvider
import java.io.File

class RoomSchemaArgProvider(
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
val schemaDir: File
) : CommandLineArgumentProvider {

override fun asArguments(): Iterable<String> {
if (!schemaDir.exists()) schemaDir.mkdirs()
return listOf("room.schemaLocation=${schemaDir.path}")
}
}
1 change: 1 addition & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
9 changes: 9 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
id("java-library")
alias(libs.plugins.jetbrains.kotlin.jvm)
}

java {
sourceCompatibility = JavaVersion.VERSION_19
targetCompatibility = JavaVersion.VERSION_19
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.github.yuriisurzhykov.purs.core

class Core {
}
1 change: 1 addition & 0 deletions data/cache/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
47 changes: 47 additions & 0 deletions data/cache/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.ksp)
}

ksp {
arg(RoomSchemaArgProvider(File(projectDir, "room-schemas")))
}

android {
namespace = "com.github.yuriisurzhykov.purs.data.cache"
compileSdk = ProjectProperties.compileSdkVersion

defaultConfig {
minSdk = ProjectProperties.minSdkVersion

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = ProjectProperties.javaSourceCompatibility
targetCompatibility = ProjectProperties.javaTargetCompatibility
}
kotlinOptions {
jvmTarget = ProjectProperties.kotlinJvmTarget
}
}

dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.androidx.room.ktx)
implementation(libs.androidx.room.runtime)
implementation(libs.javax.inject)

ksp(libs.androidx.room.compiler)
}
Empty file added data/cache/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions data/cache/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.github.yuriisurzhykov.purs.data.cache

class Cache {
}
1 change: 1 addition & 0 deletions data/cloud/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
41 changes: 41 additions & 0 deletions data/cloud/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
plugins {
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.android.library)
}

android {
namespace = "com.github.yuriisurzhykov.purs.data.cloud"
compileSdk = ProjectProperties.compileSdkVersion

defaultConfig {
minSdk = ProjectProperties.minSdkVersion

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = ProjectProperties.javaSourceCompatibility
targetCompatibility = ProjectProperties.javaTargetCompatibility
}
kotlinOptions {
jvmTarget = ProjectProperties.kotlinJvmTarget
}
}

dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.json)
implementation(libs.retrofit)
implementation(libs.retrofit.converter.kotlinx.serialization)
implementation(libs.javax.inject)
}
Empty file added data/cloud/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions data/cloud/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.github.yuriisurzhykov.purs.data.cloud

class Cloud {
}
1 change: 1 addition & 0 deletions data/repository/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions data/repository/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.jetbrains.kotlin.android)
}

android {
namespace = "com.github.yuriisurzhykov.purs.data.repository"
compileSdk = 34

defaultConfig {
minSdk = 24

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

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"
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
Empty file.
21 changes: 21 additions & 0 deletions data/repository/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.yuriisurzhykov.purs.data.repository

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.github.yuriisurzhykov.purs.data.repository.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions data/repository/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.github.yuriisurzhykov.purs.data.repository

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
1 change: 1 addition & 0 deletions domain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading

0 comments on commit 96dd7da

Please sign in to comment.