import com.urbancode.air.*
import com.urbancode.air.plugin.automation.*

final def apTool = new AirPluginTool(this.args[0], this.args[1])
final def workDir = new File('.').canonicalFile
def stepProps = apTool.getStepProperties()

def dir = new File(workDir, stepProps['workDirOffset'] ?: '.').canonicalFile

def serverUrl = stepProps['automation/serverUrl']
def username = stepProps['automation/username']
def password = stepProps['automation/password'] ? stepProps['automation/password'] : stepProps['automation/passwordscript']

def domain = stepProps['qcdomain']
def project = stepProps['qcproject']
def bugPattern = stepProps['bugpattern']

QCPublishBugReport report = new QCPublishBugReport()
report.serverUrl = serverUrl
report.username = username
report.password = password
report.domain = domain
report.project = project

report.bugPattern = bugPattern

report.workDir = dir

report.execute()