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