diff --git a/build.gradle.kts b/build.gradle.kts index 9605f38..85523e9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile group = "com.github.nbaztec" -version = "1.0.4" +version = "1.0.5" tasks.withType { kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString() @@ -57,7 +57,7 @@ plugins { `maven-publish` id("org.jetbrains.kotlin.jvm") version "1.3.72" id("com.gradle.plugin-publish") version "0.12.0" - id("com.github.nbaztec.coveralls-jacoco-kotlin") version "1.0.3" + id("com.github.nbaztec.coveralls-jacoco") version "1.0.4" } coverallsJacoco { diff --git a/src/test/kotlin/CoverallsJacocoPluginTest.kt b/src/test/kotlin/CoverallsJacocoPluginTest.kt index 5fa3a78..27381eb 100644 --- a/src/test/kotlin/CoverallsJacocoPluginTest.kt +++ b/src/test/kotlin/CoverallsJacocoPluginTest.kt @@ -1,13 +1,18 @@ package org.gradle.plugin.coveralls.jacoco +import io.mockk.every import io.mockk.mockk import io.mockk.verify import org.gradle.api.Action import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.internal.tasks.DefaultSourceSetContainer import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.testfixtures.ProjectBuilder import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test +import java.io.File internal class CoverallsJacocoPluginTest { @Test @@ -23,6 +28,20 @@ internal class CoverallsJacocoPluginTest { } } + @Test + fun `CoverallsJacocoPlugin runs on task execute`() { + val sourceSetContainer = mockk() + every { sourceSetContainer.getByName("main").allJava.srcDirs } returns emptySet() + val project = ProjectBuilder.builder().withProjectDir(File(".")).build() + project.extensions.add("sourceSets", sourceSetContainer) + + val plugin = CoverallsJacocoPlugin() + plugin.apply(project) + + val task = project.tasks.getByName("coverallsJacoco") + task.actions.forEach { it.execute(task) } + } + @Test fun `CoverallsJacocoPluginExtension has meaningful defaults`() { val extension = CoverallsJacocoPluginExtension()