unbroken-dome / gradle-testsets-plugin

A plugin for the Gradle build system that allows specifying test sets (like integration or acceptance tests).
MIT License
230 stars 50 forks source link

library api dependencies not available for library compilation #105

Closed gpaglia closed 4 years ago

gpaglia commented 4 years ago

Hello, maybe I have misunderstood the semantic of the library test set, but it seems to be that when I define a testCommon library, the dependencies defined in testCommonApi are not made available for compilation within the testCommon sourceSet. I have to add the very same dependencies as testCommonImplementation to have them available for compilation.

The testCommonApi dependencies are anyways exported to other sourceSets (like the integrationTest sourceSet, importing from testCommon in my example).

I have seen the same behaviour with version 3.0.0 andversion 2.2.1. I am running with gradle 6.3, java 11 and Intellij Idea 2019.3.4 community ed.

Here's my build.gradle:

plugins {
    id 'java'
    id 'org.unbroken-dome.test-sets' version '3.0.0'
}

group 'org.example'
version '1.0-SNAPSHOT'

sourceCompatibility = 11

repositories {
    mavenCentral()
}

testSets {
    libraries { testCommon }
    unitTest { imports libraries.testCommon }
    integrationTest { imports libraries.testCommon }
}

dependencies {

    testCompile group: 'junit', name: 'junit', version: '4.12'

    testCommonApi group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'

    // need to add this line to have apache commons lang3 be resolved for compilation in testCommon
    testCommonImplementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'

}

pls refer to the example at test-sets-issue project on github.

tkrullmann commented 4 years ago

Hi, and thanks for the report! You're right, there is something missing about the api configuration for libraries. I'll investigate and provide a fix

gpaglia commented 4 years ago
Thanks a lot.G Da: Till KrullmannInviato: venerdì 10 aprile 2020 16:34A: unbroken-dome/gradle-testsets-pluginCc: Gian Enrico Paglia; AuthorOggetto: Re: [unbroken-dome/gradle-testsets-plugin] library api dependencies not available for library compilation (#105) Hi, and thanks for the report!You're right, there is something missing about the api configuration for libraries. I'll investigate and provide a fix—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.