Skip to content
Snippets Groups Projects
Commit df65635d authored by Viktor Vorobev's avatar Viktor Vorobev Committed by Ugo Albanese
Browse files

Merged in NRRPLT-8191-makefile-schema-generation (pull request #131)

[NRRPLT-8191] Generate schema parsers via Makefile

* [NRRPLT-8191] Added target for downloading and building of schemes
* [NRRPLT-8191] Added simplified target
* [NRRPLT-0000] Update .gitignore
* [NRRPLT-8191] Make schemas generation compatible with local install

Approved-by: Krzysztof Lebioda
parent aea287e6
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
REPOSITORY=$1
FILENAME_XSD=$2
TOPIC_BRANCH=$3
wget https://api.bitbucket.org/2.0/repositories/hbpneurorobotics/${REPOSITORY}/src/${TOPIC_BRANCH}/${FILENAME_XSD} -O ${FILENAME_XSD} \
&& echo ${FILENAME_XSD}:${TOPIC_BRANCH}
......@@ -42,42 +42,19 @@ export PYTHONPATH=hbp_nrp_commons:hbp_nrp_backend:hbp_nrp_cleserver:hbp_nrp_watc
cp ${HBP}/${USER_SCRIPTS_DIR}/config_files/CLE/config.ini.sample ${HBP}/${CLE_DIR}/hbp_nrp_cle/hbp_nrp_cle/config.ini
# Obtain schemas
REPOSITORY=experiments
[ -z "$(git ls-remote --heads https://bitbucket.org/hbpneurorobotics/${REPOSITORY}.git ${TOPIC_BRANCH})" ] \
&& CO_BRANCH="${DEFAULT_BRANCH}" \
|| CO_BRANCH="${TOPIC_BRANCH}"
bash ./.ci/bitbucket_api_get.bash "${REPOSITORY}" bibi_configuration.xsd "${CO_BRANCH}"
bash ./.ci/bitbucket_api_get.bash "${REPOSITORY}" ExDConfFile.xsd "${CO_BRANCH}"
REPOSITORY=models
[ -z "$(git ls-remote --heads https://bitbucket.org/hbpneurorobotics/${REPOSITORY}.git ${TOPIC_BRANCH})" ] \
&& CO_BRANCH="${DEFAULT_BRANCH}" \
|| CO_BRANCH="${TOPIC_BRANCH}"
bash ./.ci/bitbucket_api_get.bash "${REPOSITORY}" robot_model_configuration.xsd "${CO_BRANCH}"
bash ./.ci/bitbucket_api_get.bash "${REPOSITORY}" environment_model_configuration.xsd "${CO_BRANCH}"
# Generate schemas
make devinstall # Otherwise it can't find pyxbgen
. $VIRTUAL_ENV_PATH/bin/activate \
&& pyxbgen -u bibi_configuration.xsd -m bibi_api_gen \
&& pyxbgen -u ExDConfFile.xsd -m exp_conf_api_gen \
&& pyxbgen -u robot_model_configuration.xsd -m robot_conf_api_gen \
&& pyxbgen -u environment_model_configuration.xsd -m environment_conf_api_gen
mv bibi_api_gen.py exp_conf_api_gen.py robot_conf_api_gen.py environment_conf_api_gen.py hbp_nrp_commons/hbp_nrp_commons/generated
touch hbp_nrp_commons/hbp_nrp_commons/generated/__init__.py
deactivate
# This variable is needed for common_makefile during schemas generation
export DEFAULT_CO_BRANCH=${DEFAULT_BRANCH}
export TOPIC_BRANCH
make schemas-install
# version.txt
if [ -f "version.txt" ]; then sed -i -f version.txt hbp_nrp_backend/hbp_nrp_backend/version.py hbp_nrp_backend/requirements.txt; sed -i -f version.txt hbp_nrp_commons/hbp_nrp_commons/version.py hbp_nrp_commons/requirements.txt; sed -i -f version.txt hbp_nrp_cleserver/hbp_nrp_cleserver/version.py hbp_nrp_cleserver/requirements.txt; fi
# Run tests
export IGNORE_LINT='platform_venv|hbp_nrp_commons/hbp_nrp_commons/generated|hbp-flask-restful-swagger-master|migrations|nest|ci_download_directory'
# Egg-links have to be removed because make devinstall set them up wrongly
# devinstall is run in order to fail build in case installation/requirements fails
# then continue make to the end ignoring errors (-i)
pushd $VIRTUAL_ENV_PATH/lib/python${PYTHON_VERSION_MAJOR_MINOR}/site-packages && rm -f hbp-nrp-backend.egg-link hbp-nrp-cleserver.egg-link hbp-nrp-watchdog.egg-link hbp-nrp-commons.egg-link hbp-flask-restful-swagger.egg-link && popd
# verify_base-ci fails on dependencies mismatch, but ignores linter errors, which are cought by Jenkins afterwards
. $VIRTUAL_ENV_PATH/bin/activate \
&& source /opt/ros/noetic/setup.bash \
&& source $HBP/GazeboRosPackages/devel/setup.bash \
&& echo "PYTHONPATH $PYTHONPATH" \
&& make verify_base -i
&& make verify_base-ci
......@@ -11,6 +11,7 @@ ci_dep.txt
dist/
pep8.txt
pylint.txt
pycodestyle.txt
test-reports/
coverage.xml
build/
......@@ -32,3 +33,8 @@ hbp_nrp_commons/hbp_nrp_commons/generated/robot_conf_api_gen.py
hbp_nrp_commons/hbp_nrp_commons/generated/environment_conf_api_gen.py
hbp_nrp_commons/hbp_nrp_commons/generated/robot_conf_api_gen.py
htmlcov/*
bibi_configuration.xsd
ExDConfFile.xsd
environment_model_configuration.xsd
robot_model_configuration.xsd
.vscode/settings.json
......@@ -14,6 +14,17 @@ COVER_PACKAGES=hbp_nrp_commons,hbp_nrp_watchdog,hbp_nrp_cleserver,hbp_nrp_backen
#documentation to build
DOC_MODULES=hbp_nrp_commons/doc hbp_nrp_watchdog/doc hbp_nrp_cleserver/doc hbp_nrp_backend/doc
#pyxbgen schemas to generate
# use repository:file:module notation
# use repository notation the same as used in directory layout (i.e., capital letter)
SCHEMA_GENERATION=Experiments:bibi_configuration.xsd:bibi_api_gen \
Experiments:ExDConfFile.xsd:exp_conf_api_gen \
Models:robot_model_configuration.xsd:robot_conf_api_gen \
Models:environment_model_configuration.xsd:environment_conf_api_gen
SCHEMA_TARGET_LOCATION=hbp_nrp_commons/hbp_nrp_commons/generated/
SCHEMA_REQS?=pyxb==1.2.6
PYTHON_PIP_VERSION?=pip>=19
##
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment