Setting dependencies using a loop


(Mayura Viraj) #1

Hi

I’m trying to set dependencies using a loop. But i get an error. May be my syntax is wrong. Can anyone please look into the code and point me right direction ?

dependencies(dependsOn : 'setDepends') {
    compile project(':core:projectA')
    compile project(':core:projectB')
    compile project(':core:projectC')
    compile project(':core:projectD')
    compile project(':core:projectE')
}
  task setDepends << {
    [':core:projectA',
            ':core:projectB',
            ':core:projectC',
            ':core:projectD',
            ':core:projectD'].each {
        project("$it") {
            dependencies {
                compile project(':core:util')
            }
        }
    }
}

Can be a simple issue, appreciate help

Thanks