Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set common configuration for multiple sourcesets #44

Closed
amimas opened this issue Mar 28, 2018 · 1 comment
Closed

How to set common configuration for multiple sourcesets #44

amimas opened this issue Mar 28, 2018 · 1 comment
Labels

Comments

@amimas
Copy link

amimas commented Mar 28, 2018

Hello,

I've used this plugin to create 2 sourcesets named integrationTest and functionalTest. The 2nd sourceset is extended from the 1st one.

There are some common configurations for both of them. For example:

integrationTest {
  outputs.upToDateWhen { false }
  testLogging { ... }
}

How can I get functionalTest to inherit those same configurations?

Do I need to use task graph to handle this or does this plugin already provide a feature for this that I'm not using?

@tkrullmann
Copy link
Member

Hi,
I'm afraid the "inheritance" you're trying to achieve isn't possible. There is no direct relationship between the Test tasks created for each test set. Having task configuration automatically inherited would also go a bit against the general approach of Gradle, where everything should be simple but explicit and obvious.

So, something you could try instead: Configure multiple extra Test tasks at once, e.g.

[integrationTest, functionalTest]*.configure {
    outputs.upToDateWhen { false }
    // ...
}

Or, if you want to go through the testSets, you can get to the Test task via the testTaskName property:

testSets.matching { it.name != 'unitTest' }.all {
    tasks[it.testTaskName].configure {
        outputs.upToDateWhen { false }
        // ...
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants