This commit is contained in:
Dmitry Arkhipov
2024-05-31 10:38:52 +03:00
parent 62b2083cc3
commit 2c42936714
8 changed files with 239 additions and 6 deletions
+21
View File
@@ -0,0 +1,21 @@
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt)
#
# Copyright 2024 Dmitry Arkhipov (grisumbras@yandex.ru)
# For Drone CI we use the Starlark scripting language to reduce duplication.
# As the yaml syntax for Drone CI is rather limited.
#
#
globalenv={'B2_CI_VERSION': '1', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on'}
linuxglobalimage="cppalliance/droneubuntu1804:1"
def main(ctx):
return [
linux_cxx("tests", "g++", packages="docbook docbook-xml docbook-xsl python3-jinja2 python3-pytest xsltproc libsaxonhe-java default-jre-headless flex libfl-dev bison unzip rsync", buildtype="test", buildscript="drone", image=linuxglobalimage, globalenv=globalenv),
linux_cxx("examples", "g++", packages="docbook docbook-xml docbook-xsl python3-jinja2 python3-pytest xsltproc libsaxonhe-java default-jre-headless flex libfl-dev bison unzip rsync", buildtype="example", buildscript="drone", image=linuxglobalimage, globalenv=globalenv),
]
# from https://github.com/boostorg/boost-ci
load("@boost_ci//ci/drone/:functions.star", "linux_cxx")
+91
View File
@@ -0,0 +1,91 @@
#!/bin/bash
# Copyright 2024 Dmitry Arkhipov (grisumbras@gmail.com)
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt)
set -e
export TRAVIS_OS_NAME=linux
export TRAVIS_BUILD_DIR=$(pwd)
export DRONE_BUILD_DIR=$(pwd)
export DRONE_BRANCH=${DRONE_BRANCH:-$(echo $GITHUB_REF | cut -d/ -f3-)}
export TRAVIS_BRANCH=$DRONE_BRANCH
export TRAVIS_EVENT_TYPE=$DRONE_BUILD_EVENT
export VCS_COMMIT_ID=$DRONE_COMMIT
export GIT_COMMIT=$DRONE_COMMIT
export REPO_NAME=$DRONE_REPO
export USER=$(whoami)
export CC=${CC:-gcc}
export PATH=~/.local/bin:/usr/local/bin:$PATH
if [ "$DRONE_JOB_BUILDTYPE" == "test" ]; then
echo '==================================> INSTALL'
export SELF=`basename $REPO_NAME`
pwd
cd ../..
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root --depth 1
cd boost-root
export BOOST_ROOT=$(pwd)
git submodule update --init tools/boostbook
git submodule update --init tools/boostdep
git submodule update --init tools/build
git submodule update --init tools/quickbook
rsync -av $TRAVIS_BUILD_DIR/ tools/docca
python tools/boostdep/depinst/depinst.py ../tools/quickbook
./bootstrap.sh
./b2 headers
echo '==================================> SCRIPT'
echo "using python : : python3 ;" > tools/build/src/user-config.jam
./b2 tools/docca/test
elif [ "$DRONE_JOB_BUILDTYPE" == "example" ]; then
echo '==================================> INSTALL'
export SELF=`basename $REPO_NAME`
pwd
cd ..
mkdir -p $HOME/cache && cd $HOME/cache
if [ ! -d doxygen ]; then git clone -b 'Release_1_8_15' --depth 1 https://github.com/doxygen/doxygen.git && echo "not-cached" ; else echo "cached" ; fi
cd doxygen
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
cd build
sudo make install
cd ../..
if [ ! -f saxonhe.zip ]; then
wget -O saxonhe.zip https://sourceforge.net/projects/saxon/files/Saxon-HE/9.9/SaxonHE9-9-1-4J.zip/download && echo "not-cached"
else
echo "cached"
fi
unzip -o saxonhe.zip
sudo rm /usr/share/java/Saxon-HE.jar
sudo cp saxon9he.jar /usr/share/java/Saxon-HE.jar
cd ..
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root --depth 1
cd boost-root
export BOOST_ROOT=$(pwd)
git submodule update --init tools/boostbook
git submodule update --init tools/boostdep
git submodule update --init tools/build
git submodule update --init tools/quickbook
rsync -av $TRAVIS_BUILD_DIR/ tools/docca
python tools/boostdep/depinst/depinst.py ../tools/quickbook
./bootstrap.sh
./b2 headers
echo '==================================> SCRIPT'
echo "using doxygen ; using boostbook ; using saxonhe ; using python : : python3 ;" > tools/build/src/user-config.jam
./b2 tools/docca/example
fi
+3
View File
@@ -0,0 +1,3 @@
/bin
/example/html
__pycache__
+11
View File
@@ -0,0 +1,11 @@
#
# Copyright (c) 2024 Dmitry Arkhipov (grisumbras@yandex.ru)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/boostorg/json
#
build-project test ;
build-project example ;
+6 -6
View File
@@ -59,7 +59,7 @@ docca.reference reference.qbk
# Produce the reference.qbk from C++ sources (Python implementation)
docca.pyreference reference2.qbk
: [ glob-tree-ex include/docca : *.hpp ]
<doxygen:param>ABBREVIATE_BRIEF=
: <doxygen:param>ABBREVIATE_BRIEF=
<doxygen:param>INLINE_INHERITED_MEMB=YES
<doxygen:param>JAVADOC_AUTOBRIEF=YES
<doxygen:param>MULTILINE_CPP_IS_BRIEF=YES
@@ -79,6 +79,8 @@ docca.pyreference reference2.qbk
<docca:config>config.json
;
explicit reference.qbk reference2.qbk ;
#-------------------------------------------------------------------------------
#
# Produce the Boost.Book XML from the QuickBook
@@ -94,11 +96,9 @@ install images
explicit images ;
xml json_doc
:
main.qbk
:
<use>reference.qbk
<dependency>images
: main.qbk
: <dependency>reference.qbk
<dependency>images
;
explicit json_doc ;
+60
View File
@@ -0,0 +1,60 @@
#
# Copyright (c) 2024 Dmitry Arkhipov (grisumbras@yandex.ru)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/boostorg/json
#
import common ;
import os ;
import testing ;
import toolset ;
import ../docca.jam ;
make python-tests
: docca_test.py
: @run-pytest
: <include>..
<dependency>../docca.py
;
.STATUS = [ modules.peek testing : .STATUS ] ;
.SET_STATUS = [ modules.peek testing : .SET_STATUS ] ;
.THEN = [ modules.peek testing : .THEN ] ;
.STATUS_0 = [ modules.peek testing : .STATUS_0 ] ;
.STATUS_NOT_0 = [ modules.peek testing : .STATUS_NOT_0 ] ;
.ENDIF = [ modules.peek testing : .ENDIF ] ;
.CATENATE = [ modules.peek testing : .CATENATE ] ;
.NULL_OUT = [ modules.peek common : NULL_OUT ] ;
.CP = [ common.copy-command ] ;
rule run-pytest ( target : sources + : properties * )
{
local includes = [ on $(target) return $(INCLUDE) ] ;
PYTHONPATH on $(target) = [
common.prepend-path-variable-command PYTHONPATH : $(includes) ] ;
}
actions run-pytest
{
$(PYTHONPATH)
"$(PYTHON)" -m pytest "$(>:W)" "$(FLAGS)" >"$(<:W).tmp" 2>&1
$(.SET_STATUS)
if $(.STATUS_0)
$(.CP) "$(<:W).tmp" "$(<)" $(.NULL_OUT)
$(.ENDIF)
if $(.STATUS_NOT_0)
echo ====== BEGIN OUTPUT ======
$(.CATENATE) "$(<:W).tmp"
echo ====== END OUTPUT ======
$(.ENDIF)
exit $(.STATUS)
}
toolset.flags $(__name__).run-pytest FLAGS <flags> ;
toolset.flags $(__name__).run-pytest INCLUDE <include> ;
toolset.flags $(__name__).run-pytest PYTHON <python.interpreter> ;
+9
View File
@@ -0,0 +1,9 @@
{ "include_private": false
, "legacy_behavior": false
, "link_prefix": "docca.ref."
, "default_namespace": "example"
, "convenience_header": "boost/json.hpp"
, "replace_strings":
{ "__see_below__": "``['see-below]``"
}
}
+38
View File
@@ -0,0 +1,38 @@
#
# Copyright (c) 2024 Dmitry Arkhipov (grisumbras@yandex.ru)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/boostorg/json
#
import docca
import jinja2
import jinja2.ext
def test_construct_environment():
conf = dict()
env = docca.construct_environment([], conf)
assert not env.autoescape
assert env.undefined == jinja2.StrictUndefined
assert [
ext for ext in env.extensions.values()
if isinstance(ext, jinja2.ext.do)
]
assert [
ext for ext in env.extensions.values()
if isinstance(ext, jinja2.ext.loopcontrols)
]
assert env.globals['Access'] == docca.Access
assert env.globals['FunctionKind'] == docca.FunctionKind
assert env.globals['VirtualKind'] == docca.VirtualKind
assert env.globals['Section'] == docca.Section
assert env.globals['ParameterList'] == docca.ParameterList
assert env.globals['Config'] == conf