2021-06-09 21:14:24 +02:00
|
|
|
import hudson.FilePath
|
2020-04-17 11:01:43 +02:00
|
|
|
import ru.pulsar.jenkins.library.configuration.JobConfiguration
|
|
|
|
import ru.pulsar.jenkins.library.ioc.ContextRegistry
|
2021-06-09 21:14:24 +02:00
|
|
|
import ru.pulsar.jenkins.library.utils.FileUtils
|
2021-11-01 12:20:18 +02:00
|
|
|
import ru.pulsar.jenkins.library.utils.VRunner
|
2020-04-17 11:01:43 +02:00
|
|
|
|
|
|
|
def call(JobConfiguration config) {
|
|
|
|
|
|
|
|
ContextRegistry.registerDefaultContext(this)
|
|
|
|
|
2020-04-17 13:31:30 +02:00
|
|
|
// TODO: Вынести в отдельный класс по аналогии с SonarScanner
|
|
|
|
|
2020-04-17 11:01:43 +02:00
|
|
|
printLocation()
|
|
|
|
|
2020-04-17 13:24:58 +02:00
|
|
|
if (!config.stageFlags.syntaxCheck) {
|
2020-04-17 11:01:43 +02:00
|
|
|
echo("Syntax-check step is disabled")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-04-17 13:24:58 +02:00
|
|
|
def options = config.syntaxCheckOptions
|
|
|
|
|
2020-04-17 11:01:43 +02:00
|
|
|
installLocalDependencies()
|
|
|
|
|
|
|
|
unzipInfobase()
|
|
|
|
|
2021-06-09 21:14:24 +02:00
|
|
|
FilePath pathToJUnitReport = FileUtils.getFilePath("$env.WORKSPACE/$options.pathToJUnitReport")
|
|
|
|
|
|
|
|
String outPath = pathToJUnitReport.getParent()
|
2020-04-27 17:05:45 +02:00
|
|
|
createDir(outPath)
|
2020-04-17 11:01:43 +02:00
|
|
|
|
2021-11-01 12:20:18 +02:00
|
|
|
String vrunnerPath = VRunner.getVRunnerPath();
|
|
|
|
String command = "$vrunnerPath syntax-check --ibconnection \"/F./build/ib\""
|
2020-04-17 11:01:43 +02:00
|
|
|
|
2020-04-17 13:45:44 +02:00
|
|
|
// Временно убрал передачу параметра.
|
|
|
|
// См. https://github.com/vanessa-opensource/vanessa-runner/issues/361
|
|
|
|
// command += " --workspace $env.WORKSPACE"
|
2020-04-17 12:22:15 +02:00
|
|
|
|
2020-04-17 11:01:43 +02:00
|
|
|
if (options.groupErrorsByMetadata) {
|
2021-06-09 21:14:24 +02:00
|
|
|
command += ' --groupbymetadata'
|
2020-04-17 11:01:43 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 21:14:24 +02:00
|
|
|
command += " --junitpath $pathToJUnitReport";
|
|
|
|
|
|
|
|
FilePath vrunnerSettings = FileUtils.getFilePath("$env.WORKSPACE/$options.vrunnerSettings")
|
|
|
|
if (vrunnerSettings.exists()) {
|
|
|
|
command += " --settings $vrunnerSettings";
|
|
|
|
}
|
2020-04-17 11:01:43 +02:00
|
|
|
|
2021-12-02 10:42:46 +02:00
|
|
|
if (!options.exceptionFile.empty && fileExists(options.exceptionFile)) {
|
|
|
|
command += " --exception-file $options.exceptionFile"
|
|
|
|
}
|
|
|
|
|
2021-06-09 21:14:24 +02:00
|
|
|
if (options.checkModes.length > 0) {
|
|
|
|
def checkModes = options.checkModes.join(" ")
|
|
|
|
command += " --mode $checkModes"
|
|
|
|
}
|
2020-04-17 11:01:43 +02:00
|
|
|
|
|
|
|
// Запуск синтакс-проверки
|
2021-11-08 19:29:24 +02:00
|
|
|
VRunner.exec(command, true)
|
2020-04-17 11:01:43 +02:00
|
|
|
|
2021-06-09 21:14:24 +02:00
|
|
|
junit allowEmptyResults: true, testResults: FileUtils.getLocalPath(pathToJUnitReport)
|
2020-04-17 11:01:43 +02:00
|
|
|
|
2021-06-09 21:14:24 +02:00
|
|
|
archiveArtifacts FileUtils.getLocalPath(pathToJUnitReport)
|
2020-04-17 11:01:43 +02:00
|
|
|
}
|