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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 28 additions & 68 deletions Library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.gradle.testing.jacoco.tasks.JacocoReport

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.android.coveralls)
alias(libs.plugins.android.junit5)
id("jacoco")
`maven-publish`
}

android {
Expand All @@ -18,7 +15,7 @@ android {
defaultConfig {
minSdk = 21
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments.put("useTestStorageService", "true")
testInstrumentationRunnerArguments["useTestStorageService"] = "true"
consumerProguardFiles("consumer-rules.pro")
}

Expand Down Expand Up @@ -56,11 +53,6 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
}

testOptions {
unitTests {
Expand All @@ -69,9 +61,33 @@ android {
}
}
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
}
publishing {
publications {
create<MavenPublication>("release") {
groupId = "com.github.LeandroLCD"
artifactId = "query"
version = project.version.toString()
}
}
}

jacoco {
toolVersion = "0.8.10"
afterEvaluate {
val releaseComponent = components.findByName("release")
if (releaseComponent != null) {
publishing {
publications {
val pub = getByName("release") as MavenPublication
pub.from(releaseComponent)
}
}
} else {
logger.warn("Android 'release' component not found; maven publication won't include component artifacts.")
}
}
tasks.withType<Test> {
useJUnitPlatform()
Expand All @@ -93,60 +109,4 @@ dependencies {
testImplementation(kotlin("test"))
}

/**
* Genera reporte JaCoCo a partir de las pruebas instrumentadas (androidTest)
*/

tasks.register<JacocoReport>("jacocoAndroidTestReport") {
dependsOn("connectedDebugAndroidTest")

group = "Reporting"
description = "Generates JaCoCo coverage report for Android Instrumented Tests."

val buildDir = layout.buildDirectory

reports {
xml.required.set(true)
html.required.set(true)
html.outputLocation.set(file("$buildDir/reports/jacoco/html"))
xml.outputLocation.set(file("$buildDir/reports/jacoco/jacocoAndroidTestReport.xml"))
}

// Directorios de código fuente
sourceDirectories.setFrom(
files(
"src/main/java",
"src/main/kotlin"
)
)

// Clases compiladas del build de debug
classDirectories.setFrom(
files(
fileTree("${buildDir.get()}/intermediates/javac/debug") {
exclude("**/R.class", "**/R\$*.class", "**/BuildConfig.*", "**/Manifest*.*")
},
fileTree("${buildDir.get()}/tmp/kotlin-classes/debug") {
exclude("**/R.class", "**/R\$*.class", "**/BuildConfig.*", "**/Manifest*.*")
}
)
)

// Archivo de ejecución JaCoCo generado por las pruebas instrumentadas
executionData.setFrom(
fileTree(buildDir) {
include("**/outputs/code_coverage/*AndroidTest/connected_coverage*.ec*")
}
)

doFirst {
executionData.setFrom(files(executionData.filter { it.exists() }))
}
}
/**
* Enlaza el reporte JaCoCo con Coveralls
*/
tasks.named("coverallsJacoco") {
dependsOn("jacocoAndroidTestReport")
}

16 changes: 10 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}

Expand Down Expand Up @@ -29,16 +30,19 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

buildFeatures {
compose = true
}
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
}

dependencies {

Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.android.coveralls) apply false
alias(libs.plugins.android.junit5) apply false
}
19 changes: 8 additions & 11 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
[versions]
agp = "8.13.2"
junitJupiterApi = "6.0.1"
junitJupiterEngine = "6.0.1"
junitJupiterParams = "6.0.1"
kotlin = "2.2.21"
agp = "9.0.1"
junitJupiterApi = "6.0.2"
junitJupiterEngine = "6.0.2"
junitJupiterParams = "6.0.2"
kotlin = "2.3.10"
coreKtx = "1.17.0"
junit = "4.13.2"
junitVersion = "1.3.0"
mannodermaus = "1.14.0.0"
mannodermaus = "2.0.1"
espressoCore = "3.7.0"
lifecycleRuntimeKtx = "2.10.0"
activityCompose = "1.12.1"
composeBom = "2025.12.00"
activityCompose = "1.12.4"
composeBom = "2026.02.00"
appcompat = "1.7.1"
dateTime = "1.3.0"
coveralls = "1.2.20"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand All @@ -40,10 +39,8 @@ dateTime = { module = "com.github.LeandroLCD:DateTime", version.ref = "dateTime"

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
android-library = { id = "com.android.library", version.ref = "agp" }
android-coveralls = { id = "com.github.nbaztec.coveralls-jacoco", version.ref = "coveralls" }
android-junit5 = { id = "de.mannodermaus.android-junit5", version.ref = "mannodermaus" }


2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Oct 04 15:26:03 CLST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists