diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index ba03d31..2a7f1ab 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,79 +1,18 @@ 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 repo, String revision) { - m_repo = repo.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 registerPipelineScriptConfiguration(meta) { - def options = getNewToolOptions() - - options.toolName('pipeline script'); - registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(autobuilder.getautobuildpath())) + registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo(autobuilder.getautobuildpath())) } -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) +def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') { + def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) + gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) - registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir)) -} - -def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = '', int cloneDepth = 1, boolean shallowClone = true, String filter = '') { - echo "DEPRECATED method: gitCheckoutAndRegister(meta,, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, ...)" - def options = getNewToolOptions() - - options.toolName(tool); - options.toolRepo(gitURL, revision) - options.repoRoot(repoRoot) - options.clonedepth(cloneDepth) - options.shallowclone(shallowClone) - - getTool(meta, options, targetDir) + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) } return this diff --git a/configuration/tools.groovy b/configuration/tools.groovy new file mode 100644 index 0000000..fbd34a6 --- /dev/null +++ b/configuration/tools.groovy @@ -0,0 +1,59 @@ +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 repo, String revision) { + m_repo = repo.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