diff --git a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy index bf96d40..9974a90 100644 --- a/src/ru/pulsar/jenkins/library/IStepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/IStepExecutor.groovy @@ -29,4 +29,6 @@ interface IStepExecutor { void createDir(String path) def withEnv(List strings, Closure body) + + def archiveArtifacts(String path) } \ No newline at end of file diff --git a/src/ru/pulsar/jenkins/library/StepExecutor.groovy b/src/ru/pulsar/jenkins/library/StepExecutor.groovy index e3ef72f..3ac4814 100644 --- a/src/ru/pulsar/jenkins/library/StepExecutor.groovy +++ b/src/ru/pulsar/jenkins/library/StepExecutor.groovy @@ -73,4 +73,9 @@ class StepExecutor implements IStepExecutor { body() } } + + @Override + def archiveArtifacts(String path) { + steps.archiveArtifacts path + } } diff --git a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy index 60aab6f..bfdae1f 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy @@ -27,30 +27,32 @@ class EdtValidate implements Serializable { def env = steps.env(); - def projectDir = "$env.WORKSPACE/build/project" + def resultFileRelative = 'build/out/edt-validate.xml' + def projectName = 'temp' def workspaceDir = "$env.WORKSPACE/build/workspace" - def resultFile = "$env.WORKSPACE/build/edt-validate.xml" + def resultFile = "$env.WORKSPACE/$resultFileRelative" def configurationRoot = new File(env.WORKSPACE, rootDir).getAbsolutePath() - steps.createDir(projectDir) steps.createDir(workspaceDir) steps.createDir(new File(resultFile).getParent()) - Logger.println("Конвертация исходников из формата конфигуратора в формат EDT") - def ringCommand = "ring edt workspace import --configuration-files '$configurationRoot' --project '$projectDir' --workspace-location '$workspaceDir'" - - steps.withEnv(['RING_OPTS="-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru"']) { + def ringCommand = "ring edt workspace import --configuration-files '$configurationRoot' --project-name $projectName --workspace-location '$workspaceDir'" + + def ringOpts = ['_JAVA_OPTS="-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru"'] + steps.withEnv(ringOpts) { steps.cmd(ringCommand) } Logger.println("Выполнение валидации EDT") - ringCommand = "ring edt workspace validate --workspace-location '$workspaceDir' --file '$resultFile' --project '$projectDir'" + ringCommand = "ring edt workspace validate --workspace-location '$workspaceDir' --file '$resultFile' --project-name-list $projectName" - steps.withEnv(['RING_OPTS="-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru"']) { + steps.withEnv(ringOpts) { steps.cmd(ringCommand) } + + steps.archiveArtifacts(resultFileRelative) } } diff --git a/src/ru/pulsar/jenkins/library/utils/Logger.groovy b/src/ru/pulsar/jenkins/library/utils/Logger.groovy index 3d10a24..b6808ab 100644 --- a/src/ru/pulsar/jenkins/library/utils/Logger.groovy +++ b/src/ru/pulsar/jenkins/library/utils/Logger.groovy @@ -10,4 +10,10 @@ class Logger implements Serializable { def env = steps.env(); steps.echo("Running on node $env.NODE_NAME") } + + static void println(String message) { + IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() + + steps.echo(message) + } }