Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ jobs:
- name: Cache Gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches/
key: cache-clean-gradle-${{ matrix.os }}-${{ matrix.jdk }}

- name: Cache Gradle Wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper/
key: cache-clean-wrapper-${{ matrix.os }}-${{ matrix.jdk }}
path: |
~/.gradle/caches
~/.gradle/wrapper
~/gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
restore-keys: |
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
${{ runner.os }}-gradle-
${{ runner.os }}-

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/testReportJob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ jobs:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
~/gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
restore-keys: |
${{ runner.os }}-gradle-.
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
${{ runner.os }}-gradle-
${{ runner.os }}-

- name: Configure Keystore
env:
Expand All @@ -56,13 +59,13 @@ jobs:

- name: Check report files
run: |
ls /build/reports/kover/html/
ls app/build/reports/kover/html

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: /build/reports/kover/html/
path: app/build/reports/kover/html

saveReport:
name: SaveReport
Expand All @@ -79,7 +82,7 @@ jobs:
mkdir docs/reports

- name: Download report
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: code-coverage-report
path: docs/reports
Expand Down
23 changes: 15 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ plugins {
}

dependencies {
implementation(project(":core:core"))
implementation(project(":core:ui"))
implementation(project(":core:database"))
implementation(project(":core:notes"))
implementation(project(":core:navigation"))
implementation(project(":feature:home"))
implementation(project(":feature:edit"))
implementation(project(":feature:edit-label"))
implementWithCover(":core:core")
implementWithCover(":core:database")
implementWithCover(":core:label")
implementWithCover(":core:navigation")
implementWithCover(":core:notes")
implementWithCover(":core:ui")
implementWithCover(":feature:edit")
implementWithCover(":feature:edit-label")
implementWithCover(":feature:home")
}

fun DependencyHandler.implementWithCover(name: String) {
val project = project(name)
implementation(project)
kover(project)
}
3 changes: 2 additions & 1 deletion build-logic/dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies {
compileOnly(libs.kotlin.serialization)
compileOnly(libs.composeCompiler.gradlePlugin)
compileOnly(libs.android.tools.common)
compileOnly(libs.kover.gradlePlugin)
}

tasks {
Expand Down Expand Up @@ -38,4 +39,4 @@ gradlePlugin {
implementationClass = "AndroidLibraryPlugin"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType

class AndroidApplicationComposePlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.android.application")
pluginManager.apply(libs.findPluginId("kotlin"))
pluginManager.apply(libs.findPluginId("composeCompiler"))
pluginManager.apply {
apply(libs.findPluginId("application"))
apply(libs.findPluginId("kotlin"))
apply(libs.findPluginId("composeCompiler"))
}
val extension = extensions.getByType<BaseAppModuleExtension>()
configureAndroidCompose(extension)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import AppExt.APP_PREFIX
import AppExt.findPluginId
import AppExt.findVersionInt
import AppExt.findVersionString
import AppExt.libs
import com.android.build.api.dsl.ApplicationExtension
import com.stslex93.notes.configureKotlinAndroid
import com.stslex93.notes.configureKover
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
Expand All @@ -13,16 +15,19 @@ import java.io.InputStreamReader
import java.util.Properties

class AndroidApplicationPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.android")
apply("com.google.devtools.ksp")
pluginManager.apply {
apply(libs.findPluginId("application"))
apply(libs.findPluginId("kotlin"))
apply(libs.findPluginId("ksp"))
apply(libs.findPluginId("kover"))
}

extensions.configure<ApplicationExtension> {
configureKotlinAndroid(this)
configureKover()

namespace = APP_PREFIX

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType

class AndroidLibraryComposePlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.android.library")
pluginManager.apply(libs.findPluginId("kotlin"))
pluginManager.apply(libs.findPluginId("composeCompiler"))
pluginManager.apply {
apply(libs.findPluginId("library"))
apply(libs.findPluginId("kotlin"))
apply(libs.findPluginId("composeCompiler"))
}
val extension = extensions.getByType<LibraryExtension>()
configureAndroidCompose(extension)
}
Expand Down
13 changes: 9 additions & 4 deletions build-logic/dependencies/src/main/kotlin/AndroidLibraryPlugin.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import AppExt.findPluginId
import AppExt.libs
import com.android.build.gradle.LibraryExtension
import com.stslex93.notes.configureKotlinAndroid
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

class AndroidLibraryPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.library")
apply("org.jetbrains.kotlin.android")
apply("com.google.devtools.ksp")
pluginManager.apply {
apply(libs.findPluginId("library"))
apply(libs.findPluginId("kotlin"))
apply(libs.findPluginId("ksp"))
apply(libs.findPluginId("kover"))
apply(libs.findPluginId("robolectric-junit5"))
}

extensions.configure<LibraryExtension> {
Expand Down
49 changes: 41 additions & 8 deletions build-logic/dependencies/src/main/kotlin/AppExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,29 @@ object AppExt {
dependencies {
alias.forEach {
add(
"debugImplementation",
"implementation",
platform(libs.findLibrary(it).get())
)
}
}
}

fun Project.testImplementationPlatform(vararg alias: String) {
dependencies {
alias.forEach {
add(
"testImplementation",
platform(libs.findLibrary(it).get())
)
}
}
}

fun Project.androidTestImplementationPlatform(vararg alias: String) {
dependencies {
alias.forEach {
add(
"androidTestImplementation",
platform(libs.findLibrary(it).get())
)
}
Expand Down Expand Up @@ -92,24 +114,35 @@ object AppExt {
}
}

fun Project.androidTestImplementationPlatform(vararg alias: String) {
/**
* Find the library by alias
*/
fun Project.testImplementationBundle(vararg alias: String) {
dependencies {
alias.forEach {
add(
"androidTestImplementation",
dependencies.platform(libs.findLibrary(it).get())
)
add("testImplementation", libs.findBundle(it).get())
}
}
}

/**
* Find the library by alias
*/
fun Project.testImplementationBundle(vararg alias: String) {
fun Project.testImplementation(vararg alias: String) {
dependencies {
alias.forEach {
add("testImplementation", libs.findBundle(it).get())
add("testImplementation", libs.findLibrary(it).get())
}
}
}

/**
* Find the library by alias
*/
fun Project.testRuntimeOnly(vararg alias: String) {
dependencies {
alias.forEach {
add("testRuntimeOnly", libs.findLibrary(it).get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
package com.stslex93.notes

import AppExt.APP_PREFIX
import AppExt.androidTestImplementationBundle
import AppExt.androidTestImplementationPlatform
import AppExt.coreLibraryDesugaring
import AppExt.findVersionInt
import AppExt.implementation
import AppExt.ksp
import AppExt.libs
import AppExt.testImplementationBundle
import AppExt.testImplementationPlatform
import AppExt.testRuntimeOnly
import com.android.build.api.dsl.CommonExtension
import com.android.build.gradle.AppExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
Expand Down Expand Up @@ -41,29 +48,31 @@ internal fun Project.configureKotlinAndroid(

configureKotlin()

val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")

dependencies {
add("coreLibraryDesugaring", libs.findLibrary("android-desugarJdkLibs").get())

val ktx = libs.findLibrary("androidx-core-ktx").get()
add("implementation", ktx)

val test = libs.findBundle("test").get()
add("testImplementation", test)

val androidTest = libs.findBundle("android-test").get()
add("androidTestImplementation", androidTest)
coreLibraryDesugaring("android-desugarJdkLibs")

testImplementationPlatform("junit-bom")
androidTestImplementationPlatform("junit-bom")
testRuntimeOnly("junit-launcher")
testImplementationBundle("test")
androidTestImplementationBundle("android-test")
implementation(
"kotlinx-collections-immutable",
"dagger-core",
"androidx-core-ktx"
)
ksp("dagger-compiler")
}

val immutableCollection = libs.findLibrary("kotlinx-collections-immutable").get()
add("implementation", immutableCollection)
tasks.withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}

val dagger = libs.findLibrary("dagger-core").get()
add("implementation", dagger)

val daggerCompiler = libs.findLibrary("dagger-compiler").get()
add("ksp", daggerCompiler)
}
testOptions { unitTests.isIncludeAndroidResources = true }
}

private fun Project.getNameSpace(
Expand Down Expand Up @@ -91,4 +100,4 @@ private fun Project.configureKotlin() {
freeCompilerArgs.addAll("-opt-in=kotlin.RequiresOptIn", "-Xcontext-parameters")
}
}
}
}
Loading