Is it possible to add ability run Gradle tasks matching specified task paths within wildcards?

(Maksim Kostromin) #1

Hello Gradle Team, I’m just moving here my question from github issue tracker

Very often I have to create some specific tasks to group my other subproject tasks by some parent level gradle multi-module project tasks tree context just to achieve possibility use single task to run some groups of similar tasks in other subprojects. So as more subprojects I have and as more different areas I need to cover - gradle build-files growing more and ugly…

Expected Behavior

What I need is possibility to run my tasks like so:

./gradlew :apps:*web*app:test

or it will be even better, if I could do something like so:

./gradlew :apps:**:company-*web*:*tests

so by using first example I’m would like to execute test task, but only for my webapp submodules (matching, for example, project names: ‘company-public-web-app’ and ‘company-internal-test-web-app’) which are located inside apps submodule

Current Behavior

I this case as an ugly workaround at the moment I’m creating for each of my web app task named webtests which is simply task of type Test


subprojects { sp ->

  if (sp.absolutePath is: contains /apps/, following by *web*, and endsWith app) {
    tasks.create(name: 'webtests', type: Test)

  if (sp.absolutePath is matches to other ugly condition)
    tasks.create(name: 'someOtherGroupTaskName', ...)

Then I can use it as task name from root of my multi-project build:

./gradlew webtests

but it’s obviously no so good as it might be…