59 lines
1.6 KiB
Groovy
59 lines
1.6 KiB
Groovy
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
|
|
|
class ToolOptions {
|
|
def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo)
|
|
|
|
String m_toolName
|
|
|
|
String m_gitURL
|
|
String m_revision
|
|
String m_repoRoot
|
|
int m_cloneDepth
|
|
boolean m_shallowClone
|
|
|
|
ToolOptions(script) {
|
|
m_script = script
|
|
m_gitURL = '-'
|
|
m_revision = '-'
|
|
m_repoRoot = ''
|
|
m_cloneDepth = 1
|
|
m_shallowClone = true
|
|
}
|
|
|
|
void toolName(String name) {
|
|
m_toolName = name.trim()
|
|
}
|
|
|
|
void toolRepo(String gitURL, String revision) {
|
|
m_gitURL = gitURL.trim()
|
|
m_revision = revision.trim()
|
|
}
|
|
|
|
void repoRoot(String root) {
|
|
m_repoRoot = root.trim()
|
|
}
|
|
|
|
void clonedepth(int depth) {
|
|
m_cloneDepth = depth
|
|
}
|
|
|
|
void shallowclone(boolean shallow) {
|
|
m_shallowClone = shallow
|
|
}
|
|
}
|
|
|
|
ToolOptions getNewToolOptions() {
|
|
return new ToolOptions(this)
|
|
}
|
|
|
|
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
|
|
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
|
|
}
|
|
|
|
def getTool(meta, ToolOptions options, String targetDir) {
|
|
gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone)
|
|
|
|
registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir))
|
|
}
|
|
|
|
return this
|