nebula.test.multiproject.MultiProjectHelper.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nebula-test Show documentation
Show all versions of nebula-test Show documentation
Test harness for Gradle plugins
package nebula.test.multiproject
import groovy.transform.CompileStatic
import org.gradle.api.Project
import org.gradle.testfixtures.ProjectBuilder
@CompileStatic
class MultiProjectHelper {
Project parent
MultiProjectHelper(Project parent) {
this.parent = parent
}
Map create(Collection projectNames) {
Map info = [:]
projectNames.each {
def subproject = ProjectBuilder.builder().withName(it).withParent(parent).build()
info[it] = new MultiProjectInfo(name: it, project: subproject, parent: parent)
}
info
}
Map createWithDirectories(Collection projectNames) {
Map info = [:]
projectNames.each {
def subDirectory = new File(parent.projectDir, it)
subDirectory.mkdirs()
def subproject = ProjectBuilder.builder().withName(it).withProjectDir(subDirectory).withParent(parent).build()
info[it] = new MultiProjectInfo(name: it, project: subproject, parent: parent, directory: subDirectory)
}
info
}
Project addSubproject(String name) {
ProjectBuilder.builder().withName(name).withParent(parent).build()
}
Project addSubprojectWithDirectory(String name) {
def dir = new File(parent.projectDir, name)
dir.mkdirs()
ProjectBuilder.builder().withName(name).withProjectDir(dir).withParent(parent).build()
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy