Refactor groovy calling test script using newer common script apis; Transfer info across from build; Provide new interface for getting tools
This commit is contained in:
parent
d52de4b8cd
commit
718ebaa418
2 changed files with 90 additions and 5 deletions
|
|
@ -1,18 +1,89 @@
|
|||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = ''
|
||||
|
||||
configurationhelper.gitCheckoutAndRegister(
|
||||
meta,
|
||||
'xmlcoreutils',
|
||||
XMLCOREUTILSURL,
|
||||
XMLCOREUTILSREVISION,
|
||||
XMLCOREUTILSDIR
|
||||
)
|
||||
|
||||
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) {
|
||||
registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo(autobuilder.getautobuildpath()))
|
||||
def options = getNewToolOptions()
|
||||
|
||||
options.toolName('pipeline script');
|
||||
registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(autobuilder.getautobuildpath()))
|
||||
}
|
||||
|
||||
def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') {
|
||||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
|
||||
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
|
||||
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, tool, gitURL, revision, gh.getGitInfo(targetDir))
|
||||
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)
|
||||
}
|
||||
|
||||
return this
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ class ProductInfo extends GISJsonSerialised {
|
|||
this.variant = variant
|
||||
}
|
||||
|
||||
void set(ProductInfo otherinfo) {
|
||||
this.productname = otherinfo.productname
|
||||
this.subcomponentname = otherinfo.subcomponentname
|
||||
this.variant = otherinfo.variant
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
productname = rawmeta['productname']
|
||||
subcomponentname = rawmeta['subcomponentname']
|
||||
|
|
@ -110,6 +116,14 @@ class GitInfo extends GISJsonSerialised {
|
|||
this.remoteinfo = remoteinfo
|
||||
}
|
||||
|
||||
void set(GitInfo otherinfo) {
|
||||
this.sourcepath = otherinfo.sourcepath
|
||||
this.sourcerevision = otherinfo.sourcerevision
|
||||
this.gitrevision = otherinfo.gitrevision
|
||||
this.remoteurl = otherinfo.remoteurl
|
||||
this.remoteinfo = otherinfo.remoteinfo
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
sourcepath = rawmeta['sourcepath']
|
||||
sourcerevision = rawmeta['sourcerevision']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue