Setting system properties for test in shared project


(Asher Tarnopolski) #1

hi all,
we have a number of projects built by dedicated builde.gradles, compiling a shared code taken from a “commons” module.
that commons module has tests now and they are ran as a part of build of each of the projects using

test.dependsOn(tasks.getByPath(’:commons:cleanTest’), tasks.getByPath(’:commons:test’))

now, in the project we need to set some system properties used in test, and we do this like

tasks.withType(Test) {
def logDirPath = project.hasProperty(“logDirPath”) ? project.logDirPath : project.buildDir.absolutePath + File.separator + ‘tmp’ ;
systemProperty ‘a.b.c’, 'hahaha’
systemProperty ‘logz.z’, logDirPath
}

what we need is to apply the same systemProperties to ‘:commons:test’. somehow we don’t find a solution for this.
thanks a lot