def _groovy_common_scriptSource(data):
 scriptSource = XML.Element('scriptSource')
 if (('command' in data) and ('file' in data)):
  raise JenkinsJobsException("Use just one of 'command' or 'file'")
 if ('command' in data):
  command = XML.SubElement(scriptSource, 'command')
  command.text = str(data['command'])
  scriptSource.set('class', 'hudson.plugins.groovy.StringScriptSource')
 elif ('file' in data):
  scriptFile = XML.SubElement(scriptSource, 'scriptFile')
  scriptFile.text = str(data['file'])
  scriptSource.set('class', 'hudson.plugins.groovy.FileScriptSource')
 else:
  raise JenkinsJobsException('A groovy command or file is required')
 return scriptSource

def _groovy_common_scriptSource ( data ) : scriptSource = XML . Element ( 'scriptSource' ) if ( ( 'command' in data ) and ( 'file' in data ) ) : raise JenkinsJobsException ( "Use just one of 'command' or 'file'" ) if ( 'command' in data ) : command = XML . SubElement ( scriptSource , 'command' ) command . text = str ( data [ 'command' ] ) scriptSource . set ( 'class' , 'hudson.plugins.groovy.StringScriptSource' ) elif ( 'file' in data ) : scriptFile = XML . SubElement ( scriptSource , 'scriptFile' ) scriptFile . text = str ( data [ 'file' ] ) scriptSource . set ( 'class' , 'hudson.plugins.groovy.FileScriptSource' ) else : raise JenkinsJobsException ( 'A groovy command or file is required' ) return scriptSource
helper function to generate the xml element common to groovy builders .