Yes, I believe You understood my needs. It would be very nice if I could just
reuse existing gradle plugins but just for example I need 2 different unit
test configurations - one without resources and one with resources. Of
course I want build logs in readable form so I want to define testUnitTests
task for every project-module. I`m not redefining this task anywhere - I
want to get structure app:compileUnitTests,
ejb-session-module:compileUnitTests and so on with one block of code couse
they will do the same thing.

As I said, my project module build.gradle has single entry "artifactType =
'jar'"
This is my root build.gradle for now:
subprojects {
        usePlugin('java')
        afterEvaluate { Project subproject ->
                if (subproject.hasProperty('artifactType')){
                        if (subproject.artifactType.equals('jar') ||
subproject.artifactType.equals('ejb')) {
                                subproject.usePlugin('java')
                                task compileUnitTests(type: Compile, dependsOn: 
compile) << {
                                        task ->
                                        println subproject.getName() + " TODO: 
configure the unit tests
compilation..."
                                }

                                task testUnitTests(type: Test, dependsOn: 
compileUnitTests) << {
                                        task->
                                        println subproject.getName() + "TODO: 
configure unit tests..."
                                }
                        } else {
                                throw new StopExecutionException("Unsupported 
artifact
type:${subproject.artifactType}, project:${subproject.name}")
                        }
                } else {
                        println "Artifact type not found, 
project:${subproject.name}"
                }
        }
}

-- 
View this message in context: 
http://www.nabble.com/addAfterEvaluateListener--%3E-afterEvaluate---tp24589609p25370107.html
Sent from the gradle-user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to