From 792e0baf585b41de63898764a9022b3d09f539c8 Mon Sep 17 00:00:00 2001 From: Dima Date: Thu, 21 Nov 2024 20:01:45 +0300 Subject: [PATCH] continue --- .../library/edt/NativeEdtCliConverter.groovy | 14 ++++++++++---- .../jenkins/library/edt/RingConverter.groovy | 6 +++--- .../DesignerToEdtFormatTransformation.groovy | 2 ++ .../jenkins/library/steps/EdtValidate.groovy | 17 ++++++++++------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/edt/NativeEdtCliConverter.groovy b/src/ru/pulsar/jenkins/library/edt/NativeEdtCliConverter.groovy index c553f38d..87908f93 100644 --- a/src/ru/pulsar/jenkins/library/edt/NativeEdtCliConverter.groovy +++ b/src/ru/pulsar/jenkins/library/edt/NativeEdtCliConverter.groovy @@ -65,13 +65,14 @@ class NativeEdtCliConverter implements IEdtCliEngine { def workspaceDir = FileUtils.getFilePath("$env.WORKSPACE/$DesignerToEdtFormatTransformation.WORKSPACE") def srcDir = config.srcDir def configurationRoot = FileUtils.getFilePath("$env.WORKSPACE/$srcDir") - def projectName = configurationRoot.getName() + + def edtSrcRoot = FileUtils.getFilePath("$workspaceDir/$DesignerToEdtFormatTransformation.EDT_PROJECT_NAME") steps.deleteDir(workspaceDir) Logger.println("Конвертация исходников из формата конфигуратора в формат EDT с помощью 1cedtcli") - def edtcliCommand = "1cedtcli -data \"$workspaceDir\" -command import --configuration-files \"$configurationRoot\" --project-name \"$projectName\"" + def edtcliCommand = "1cedtcli -data \"$workspaceDir\" -command import --configuration-files \"$configurationRoot\" --project \"$edtSrcRoot\"" steps.cmd(edtcliCommand) @@ -85,9 +86,14 @@ class NativeEdtCliConverter implements IEdtCliEngine { String workspaceLocation = "$env.WORKSPACE/$DesignerToEdtFormatTransformation.WORKSPACE" def resultFile = "$env.WORKSPACE/$EdtValidate.RESULT_FILE" - def edtcliCommand = "1cedtcli -data \"$workspaceLocation\" -command validate --file \"$resultFile\" $projectList" + Logger.println("Версия EDT выше 2024.1.X, для валидации используется 1cedtcli") + + def edtcliCommand = "1cedtcli -v -data \"$workspaceLocation\" -vmargs -Xmx30g -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF8 -Dosgi.nl=ru -Duser.language=ru -command validate --file \"$resultFile\" $projectList" steps.catchError { - steps.cmd(edtcliCommand) +// String stdout = steps.cmd(edtcliCommand, false, true) +// steps.echo(stdout) + String stdout = steps.cmd("1cedtcli -v -data \"$workspaceLocation\" -command project --details", false, true) + steps.echo(stdout) } } diff --git a/src/ru/pulsar/jenkins/library/edt/RingConverter.groovy b/src/ru/pulsar/jenkins/library/edt/RingConverter.groovy index 8a0658a9..242c7bb8 100644 --- a/src/ru/pulsar/jenkins/library/edt/RingConverter.groovy +++ b/src/ru/pulsar/jenkins/library/edt/RingConverter.groovy @@ -65,15 +65,15 @@ class RingConverter implements IEdtCliEngine { def workspaceDir = FileUtils.getFilePath("$env.WORKSPACE/$DesignerToEdtFormatTransformation.WORKSPACE") def srcDir = config.srcDir def configurationRoot = FileUtils.getFilePath("$env.WORKSPACE/$srcDir") - def projectName = configurationRoot.getName() steps.deleteDir(workspaceDir) - steps.deleteDir(configurationRoot) + + def edtSrcRoot = FileUtils.getFilePath("$workspaceDir/$DesignerToEdtFormatTransformation.EDT_PROJECT_NAME") Logger.println("Конвертация исходников из формата конфигуратора в формат EDT с помощью ring") String edtVersionForRing = EDT.ringModule(config) - String ringCommand = "ring $edtVersionForRing workspace import --configuration-files \"$configurationRoot\" --project-name \"$projectName\" --workspace-location \"$workspaceDir\"" + String ringCommand = "ring $edtVersionForRing workspace import --configuration-files \"$configurationRoot\" --project \"$edtSrcRoot\" --workspace-location \"$workspaceDir\"" steps.ringCommand(ringCommand) diff --git a/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy b/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy index e9aa06f8..75c75fab 100644 --- a/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy +++ b/src/ru/pulsar/jenkins/library/steps/DesignerToEdtFormatTransformation.groovy @@ -12,6 +12,8 @@ class DesignerToEdtFormatTransformation implements Serializable { public static final String WORKSPACE_ZIP = 'build/edt-workspace.zip' public static final String WORKSPACE_ZIP_STASH = 'edt-workspace-zip' + public static final String EDT_PROJECT_NAME = 'cf' + private final JobConfiguration config DesignerToEdtFormatTransformation(JobConfiguration config) { diff --git a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy index bb4f7886..07b6f291 100644 --- a/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy +++ b/src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy @@ -30,25 +30,28 @@ class EdtValidate implements Serializable { } def env = steps.env() + def workspaceDir = FileUtils.getFilePath("$env.WORKSPACE/$DesignerToEdtFormatTransformation.WORKSPACE") String projectList + def projectDir if (config.sourceFormat == SourceFormat.DESIGNER) { + + // рабочая область в формате EDT уже была сформирована ранее, + // поэтому надо получить ее из stash + steps.unstash(DesignerToEdtFormatTransformation.WORKSPACE_ZIP_STASH) steps.unzip(DesignerToEdtFormatTransformation.WORKSPACE, DesignerToEdtFormatTransformation.WORKSPACE_ZIP) - def srcDir = config.srcDir - def configurationRoot = FileUtils.getFilePath("$env.WORKSPACE/$srcDir") + projectDir = FileUtils.getFilePath("$workspaceDir/$DesignerToEdtFormatTransformation.EDT_PROJECT_NAME") - def projectName = configurationRoot.getName() - - projectList = "--project-name-list $projectName" } else { def srcDir = config.srcDir - def projectDir = FileUtils.getFilePath("$env.WORKSPACE/$srcDir") - projectList = "--project-list \"$projectDir\"" + projectDir = FileUtils.getFilePath("$env.WORKSPACE/$srcDir") } + projectList = "--project-list \"$projectDir\"" + Logger.println("Выполнение валидации EDT") def engine = EdtCliEngineFactory.getEngine(config.edtVersion)