nebula.test.multiproject.MultiProjectIntegrationHelper.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 nebula.test.IntegrationSpec
@CompileStatic
class MultiProjectIntegrationHelper {
static String lineEnd = System.getProperty('line.separator')
File projectDir
File settingsFile
MultiProjectIntegrationHelper(File projectDir, File settingsFile) {
this.projectDir = projectDir
this.settingsFile = settingsFile
}
MultiProjectIntegrationHelper(IntegrationSpec spec) {
this(spec.projectDir, spec.settingsFile)
}
Map create(Collection projectNames) {
Map info = [:]
projectNames.each {
settingsFile << "include '${it}'${lineEnd}"
def dir = new File(projectDir, it)
dir.mkdirs()
def buildFile = new File(dir, 'build.gradle')
info[it] = new MultiProjectIntegrationInfo(name: it, directory: dir, buildGradle: buildFile)
}
info
}
File addSubproject(String name) {
settingsFile << "include '${name}'${lineEnd}"
def dir = new File(projectDir, name)
dir.mkdirs()
dir
}
File addSubproject(String name, String gradleContents) {
def dir = addSubproject(name)
new File(dir, 'build.gradle').text = gradleContents
dir
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy