From aa8f96de70e962578ede01d27dccbdfc265ae2fc Mon Sep 17 00:00:00 2001 From: Nikita Gryzlov Date: Tue, 28 Apr 2020 14:03:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D1=87=D0=B5=D1=81=D1=8B?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B5=D0=B4=D1=82-=D1=88?= =?UTF-8?q?=D0=B0=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/IStepExecutor.groovy | 2 ++ .../jenkins/library/StepExecutor.groovy | 5 +++++ .../jenkins/library/steps/EdtValidate.groovy | 20 ++++++++++--------- .../jenkins/library/utils/Logger.groovy | 6 ++++++ 4 files changed, 24 insertions(+), 9 deletions(-) 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) + } }