-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: #468 алгоритм сборки простых внешних обработок.
- Loading branch information
Showing
20 changed files
with
302 additions
and
13 deletions.
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
exts/yaxunit/src/CommonModules/ЮТВнешниеОбработкиСлужебныйСервер/Module.bsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
//©///////////////////////////////////////////////////////////////////////////©// | ||
// | ||
// Copyright 2021-2024 BIA-Technologies Limited Liability Company | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//©///////////////////////////////////////////////////////////////////////////©// | ||
|
||
#Область СлужебныйПрограммныйИнтерфейс | ||
|
||
Функция СкомпилирватьВнешнуюОбработку(ТекстМодуляОбъект = "", Знач ТекстМодуляФормы = "") Экспорт | ||
|
||
// Для сборки используется утилита v8unpack - https://github.com/e8tools/v8unpack | ||
|
||
ИдентификаторМодуляОбъекта = "00ab4620-8498-4b18-a4f8-18b53138fcb5.0"; | ||
ИдентификаторФормы = "a10cd1fd-c4ba-437c-9925-b7354192a1ea.0"; | ||
|
||
РабочийКаталог = ЮТФайлы.ОбъединитьПути(КаталогВременныхФайлов(), "yaxunit-v8unpack"); | ||
ПодготовитьРабочийКаталог(РабочийКаталог); | ||
|
||
КаталогСборки = ЮТФайлы.ОбъединитьПути(РабочийКаталог, "build"); | ||
КаталогФайловОбработки = ЮТФайлы.ОбъединитьПути(КаталогСборки, "unpack"); | ||
|
||
УдалитьФайлы(КаталогСборки); | ||
СоздатьКаталог(КаталогСборки); | ||
|
||
РаспаковатьОбработку(РабочийКаталог); | ||
|
||
ЮТФайлы.СкопироватьКаталог(ЮТФайлы.ОбъединитьПути(РабочийКаталог, "unpack"), КаталогФайловОбработки); | ||
|
||
// Модуль объекта | ||
ИмяФайлаМодуляОбъекта = ЮТФайлы.ОбъединитьПути(КаталогФайловОбработки, ИдентификаторМодуляОбъекта, "text"); | ||
ЮТФайлы.ЗаписатьТекстВФайла(ИмяФайлаМодуляОбъекта, ТекстМодуляОбъект); | ||
|
||
// Модуль формы | ||
ИмяФайлаФормы = ЮТФайлы.ОбъединитьПути(КаталогФайловОбработки, ИдентификаторФормы); | ||
ДанныеФормы = ЮТФайлы.ДанныеТекстовогоФайла(ИмяФайлаФормы); | ||
ТекстМодуляФормы = СтрЗаменить(ТекстМодуляФормы, """", """"""); | ||
ДанныеФормы = СтрЗаменить(ДанныеФормы, "MODULE_PLACEHOLDER", ТекстМодуляФормы); | ||
ЮТФайлы.ЗаписатьТекстВФайла(ИмяФайлаФормы, ДанныеФормы); | ||
|
||
СобратьОбработку(РабочийКаталог); | ||
|
||
Возврат ЮТФайлы.ОбъединитьПути(КаталогСборки, "out.epf"); | ||
|
||
КонецФункции | ||
|
||
#КонецОбласти | ||
|
||
#Область СлужебныеПроцедурыИФункции | ||
|
||
Процедура ПодготовитьРабочийКаталог(РабочийКаталог) | ||
|
||
Если ЮТФайлы.Существует(РабочийКаталог) Тогда | ||
Возврат; | ||
КонецЕсли; | ||
|
||
СоздатьКаталог(РабочийКаталог); | ||
Данные = ПолучитьОбщийМакет("ЮТV8UnpackWS"); | ||
Архив = Новый ЧтениеZipФайла(Данные.ОткрытьПотокДляЧтения()); | ||
Архив.ИзвлечьВсе(РабочийКаталог); | ||
Архив.Закрыть(); | ||
|
||
КонецПроцедуры | ||
|
||
Процедура РаспаковатьОбработку(РабочийКаталог) | ||
|
||
Если ЮТФайлы.Существует(ЮТФайлы.ОбъединитьПути(РабочийКаталог, "unpack")) Тогда | ||
Возврат; | ||
КонецЕсли; | ||
|
||
Если ЮТОкружение.ЭтоWindows() Тогда | ||
Команда = "v8unpack.exe -P template_managment.epf unpack"; | ||
Иначе | ||
Команда = "/bin/bash unpack-epf.sh > build/unpack.log"; | ||
КонецЕсли; | ||
|
||
КодВозврата = Неопределено; | ||
ЗапуститьПриложение(Команда, РабочийКаталог, Истина, КодВозврата); | ||
|
||
Если КодВозврата <> 0 Тогда | ||
ВызватьИсключение СтрШаблон("Не удалось распаковать шаблон обработки. Команда: `%1`", Команда); | ||
КонецЕсли; | ||
|
||
КонецПроцедуры | ||
|
||
Процедура СобратьОбработку(РабочийКаталог) | ||
|
||
Если ЮТОкружение.ЭтоWindows() Тогда | ||
Команда = "v8unpack.exe -B build\unpack build\out.epf"; | ||
Иначе | ||
Команда = "/bin/bash build-epf.sh > build/build.log"; | ||
КонецЕсли; | ||
|
||
КодВозврата = Неопределено; | ||
ЗапуститьПриложение(Команда, РабочийКаталог, Истина, КодВозврата); | ||
|
||
Если КодВозврата <> 0 Тогда | ||
ВызватьИсключение СтрШаблон("Не удалось собрать обработку. Команда: `%1`", Команда); | ||
КонецЕсли; | ||
|
||
КонецПроцедуры | ||
|
||
#КонецОбласти |
10 changes: 10 additions & 0 deletions
10
...src/CommonModules/ЮТВнешниеОбработкиСлужебныйСервер/ЮТВнешниеОбработкиСлужебныйСервер.mdo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mdclass:CommonModule xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="8c504a00-5ff1-46bb-9895-ee06bcb64454"> | ||
<name>ЮТВнешниеОбработкиСлужебныйСервер</name> | ||
<synonym> | ||
<key>ru</key> | ||
<value>Внешние обработки служебный сервер</value> | ||
</synonym> | ||
<server>true</server> | ||
<clientOrdinaryApplication>true</clientOrdinaryApplication> | ||
</mdclass:CommonModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
exts/yaxunit/src/CommonTemplates/ЮТV8UnpackWS/ЮТV8UnpackWS.mdo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mdclass:CommonTemplate xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="c08cb885-86fb-41fb-b8fc-9a407c087f60"> | ||
<name>ЮТV8UnpackWS</name> | ||
<synonym> | ||
<key>ru</key> | ||
<value>v8unpack рабочий каталог</value> | ||
</synonym> | ||
<comment>Содержит исполняемые файлы, скрипты и шаблоны обработок</comment> | ||
<templateType>BinaryData</templateType> | ||
</mdclass:CommonTemplate> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/src/CommonModules/ОМ_ЮТВнешниеОбработкиСлужебныйСервер/Module.bsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//©///////////////////////////////////////////////////////////////////////////©// | ||
// | ||
// Copyright 2021-2024 BIA-Technologies Limited Liability Company | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//©///////////////////////////////////////////////////////////////////////////©// | ||
|
||
#Область СлужебныйПрограммныйИнтерфейс | ||
|
||
Процедура ИсполняемыеСценарии() Экспорт | ||
|
||
ЮТТесты | ||
.ДобавитьТест("СкомпилирватьВнешнуюОбработку") | ||
; | ||
|
||
КонецПроцедуры | ||
|
||
Процедура СкомпилирватьВнешнуюОбработку() Экспорт | ||
|
||
Значение = ЮТест.Данные().СлучайнаяСтрока(); | ||
Алгоритм = СтрШаблон("Перем Реквизит Экспорт; | ||
|Реквизит = ""%1"";", Значение); | ||
ИмяФайлаОбработки = ЮТВнешниеОбработкиСлужебныйСервер.СкомпилирватьВнешнуюОбработку(Алгоритм); | ||
|
||
ЮТест.ОжидаетЧто(ИмяФайлаОбработки) | ||
.Заполнено(); | ||
ЮТест.ОжидаетЧто(ЮТФайлы.Существует(ИмяФайлаОбработки), "Не существует файл созданной обработки") | ||
.ЭтоИстина(); | ||
|
||
Обработка = ВнешниеОбработки.Создать(ИмяФайлаОбработки); | ||
|
||
ЮТест.ОжидаетЧто(Обработка) | ||
.Свойство("Реквизит") | ||
.Равно(Значение); | ||
|
||
КонецПроцедуры | ||
|
||
#КонецОбласти | ||
|
||
#Область СлужебныеПроцедурыИФункции | ||
|
||
#КонецОбласти |
6 changes: 6 additions & 0 deletions
6
...mmonModules/ОМ_ЮТВнешниеОбработкиСлужебныйСервер/ОМ_ЮТВнешниеОбработкиСлужебныйСервер.mdo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mdclass:CommonModule xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="ef210801-2b91-4498-8998-ba1a285b2a2c"> | ||
<name>ОМ_ЮТВнешниеОбработкиСлужебныйСервер</name> | ||
<server>true</server> | ||
<clientOrdinaryApplication>true</clientOrdinaryApplication> | ||
</mdclass:CommonModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
CURRENT_PATH=$(pwd) | ||
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
|
||
cd ${SCRIPTPATH}/v8unpack | ||
ls -lna | ||
zip -r -9 ../v8unpack.zip ./ | ||
mv ../v8unpack.zip ../../exts/yaxunit/src/CommonTemplates/ЮТV8UnpackLinux/Template.bin | ||
cd ${CURRENT_PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
export LC_ALL=C | ||
|
||
v8unpack -B build/unpack build/out.epf |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
export LC_ALL=C | ||
|
||
v8unpack -P template_managment.epf unpack |
Binary file not shown.
Binary file not shown.