From d84e5d26db13454302288b4141250bc46419931c Mon Sep 17 00:00:00 2001 From: Renken Date: Sat, 14 Dec 2019 01:44:34 +0100 Subject: [PATCH] init --- .gitattributes | 9 + .gitignore | 2 + .gitlab-ci.yml | 95 +++++++++ .gitmodules | 6 + CMakeLists.txt | 59 ++++++ cicd/docker_targets/coreutils/Dockerfile | 3 + cicd/docker_targets/coreutils/Tagfile | 1 + cicd/docker_targets/coreutils/bootstrap.sh | 32 +++ cicd/docker_targets/sphinx_html/Dockerfile | 3 + cicd/docker_targets/sphinx_html/Tagfile | 1 + cicd/docker_targets/sphinx_html/bootstrap.sh | 64 ++++++ cmake/check.cmake | 10 + cmake/find_python_module.cmake | 48 +++++ cmake/line_limit.cmake | 4 + cmake/line_limit.sh | 17 ++ cmake/plantuml.cmake | 14 ++ cmake/regex_check.cmake | 4 + cmake/regex_check.sh | 21 ++ cmake/version.cmake | 62 ++++++ doc/CMakeLists.txt | 74 +++++++ doc/_static/shione.jpg | 3 + doc/_static/theme_overrides.css | 9 + doc/about.rst | 6 + doc/conf.py.in | 201 +++++++++++++++++++ doc/index.rst | 10 + doc/plantuml.cfg | 96 +++++++++ 26 files changed, 854 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 100644 cicd/docker_targets/coreutils/Dockerfile create mode 100644 cicd/docker_targets/coreutils/Tagfile create mode 100755 cicd/docker_targets/coreutils/bootstrap.sh create mode 100644 cicd/docker_targets/sphinx_html/Dockerfile create mode 100644 cicd/docker_targets/sphinx_html/Tagfile create mode 100755 cicd/docker_targets/sphinx_html/bootstrap.sh create mode 100644 cmake/check.cmake create mode 100644 cmake/find_python_module.cmake create mode 100644 cmake/line_limit.cmake create mode 100755 cmake/line_limit.sh create mode 100644 cmake/plantuml.cmake create mode 100644 cmake/regex_check.cmake create mode 100755 cmake/regex_check.sh create mode 100644 cmake/version.cmake create mode 100644 doc/CMakeLists.txt create mode 100644 doc/_static/shione.jpg create mode 100644 doc/_static/theme_overrides.css create mode 100644 doc/about.rst create mode 100644 doc/conf.py.in create mode 100644 doc/index.rst create mode 100644 doc/plantuml.cfg diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6a06028 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +*.png filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.gif filter=lfs diff=lfs merge=lfs -text +*.jpeg filter=lfs diff=lfs merge=lfs -text +*.webm filter=lfs diff=lfs merge=lfs -text +*.opus filter=lfs diff=lfs merge=lfs -text +*.ogg filter=lfs diff=lfs merge=lfs -text +*.kra filter=lfs diff=lfs merge=lfs -text +*.wav filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20fd9ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/build/ +/build_*/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f2c00e0 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,95 @@ +stages: + - analyse + - test + - deploy + +variables: + GIT_SUBMODULE_STRATEGY: normal + +line_limit: + stage: analyse + allow_failure: true + image: registry.git.mel.vin/shione/shione/cicd/coreutils:0.0 + script: + - mkdir build + - cd build + - cmake -DDOC:STRING=OFF -DLINE_LIMIT:BOOL=ON -DWERROR:BOOL=ON .. + - make line_limit + +regex_check: + stage: analyse + allow_failure: true + image: registry.git.mel.vin/shione/shione/cicd/coreutils:0.0 + script: + - mkdir build + - cd build + - cmake -DDOC:STRING=OFF -DREGEX_CHECK:BOOL=ON -DWERROR:BOOL=ON .. + - make regex_check + +sphinx_html: + stage: test + image: registry.git.mel.vin/shione/shione/cicd/sphinx_html:0.0 + script: + - mkdir build + - cd build + - cmake -DWERROR:BOOL=ON .. + - make + artifacts: + paths: + - build/doc/html + +review: + stage: deploy + variables: + GIT_STRATEGY: none + only: + - branches@shione/shione + dependencies: + - sphinx_html + image: registry.git.mel.vin/shione/shione/cicd/coreutils:0.0 + environment: + name: review/$CI_COMMIT_REF_NAME + url: https://doc.mel.vin/template/doc/$CI_ENVIRONMENT_SLUG + on_stop: review_stop + script: + - mkdir -p ~/.ssh + - echo "$DOC_SSH_KNOWNHOSTS" > ~/.ssh/known_hosts + - eval $(ssh-agent) + - echo "$DOC_SSH_KEY" | ssh-add - > /dev/null + - mv build/doc/html public + - rsync -a --delete public/ doc@mel.vin:~/template/doc/$CI_ENVIRONMENT_SLUG + +review_stop: + stage: deploy + variables: + GIT_STRATEGY: none + when: manual + dependencies: [] + image: registry.git.mel.vin/shione/shione/cicd/coreutils:0.0 + environment: + name: review/$CI_COMMIT_REF_NAME + action: stop + script: + - mkdir -p ~/.ssh + - echo "$DOC_SSH_KNOWNHOSTS" > ~/.ssh/known_hosts + - eval $(ssh-agent) + - echo "$DOC_SSH_KEY" | ssh-add - > /dev/null + - mkdir /tmp/empty + - rsync -a --delete --filter="+ $CI_ENVIRONMENT_SLUG" --filter='-,p *' + /tmp/empty/ doc@mel.vin:~/template/doc + - rmdir /tmp/empty + +pages: + stage: deploy + variables: + GIT_STRATEGY: none + only: + - tags@shione/shione + dependencies: + - sphinx_html + image: registry.git.mel.vin/shione/shione/cicd/coreutils:0.0 + script: + - mv build/doc/html public + artifacts: + paths: + - public diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..023fdd3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "cicd/docker"] + path = cicd/docker + url = https://git.mel.vin/cicd/docker.git +[submodule "cicd/style"] + path = cicd/style + url = https://git.mel.vin/cicd/style.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d6c5e68 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,59 @@ +# 3.8.2 required because template/c requires it +cmake_minimum_required(VERSION 3.8.2 FATAL_ERROR) +list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# set build type to release if none is specified +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + +# options +option(LINE_LIMIT "Check files with line_limit." OFF) +option(REGEX_CHECK "Check files with regex_check." OFF) +option(WERROR "Make all warnings into errors." OFF) +if(NOT DEFINED DOC) + set(DOC html CACHE STRING + "The documentation type to generate." FORCE) +endif() + +# disable base languages +unset(PROJECT_LANGUAGES) + +project(shione + VERSION 0.0.0 + DESCRIPTION "shione" + LANGUAGES ${PROJECT_LANGUAGES}) +set(PROJECT_VERSION_SUFFIX "") # alpha/beta/rc, e.g. "-rc0" +set(PROJECT_VERSION "${PROJECT_VERSION}${PROJECT_VERSION_SUFFIX}") +set(PROJECT_AUTHOR "renken") +set(PROJECT_COPYRIGHT "2019, renken") +set(PROJECT_MAIL "renken@verm.im") +# only set CMAKE variant when local name matches CMAKE name +# this avoids clashing when being used as a subproject +if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(CMAKE_PROJECT_VERSION "${PROJECT_VERSION}") + set(CMAKE_PROJECT_VERSION_SUFFIX "${PROJECT_VERSION_SUFFIX}") + set(CMAKE_PROJECT_AUTHOR "${PROJECT_AUTHOR}") + set(CMAKE_PROJECT_COPYRIGHT "${PROJECT_COPYRIGHT}") + set(CMAKE_PROJECT_MAIL "${PROJECT_MAIL}") +endif() +include(version) + +if(NOT DOC STREQUAL "OFF") + add_subdirectory(doc) +endif() + +if(${LINE_LIMIT}) + include(line_limit) +endif() + +if(${REGEX_CHECK}) + include(regex_check) +endif() + +if(${LINE_LIMIT} OR ${REGEX_CHECK}) + include(check) +endif() diff --git a/cicd/docker_targets/coreutils/Dockerfile b/cicd/docker_targets/coreutils/Dockerfile new file mode 100644 index 0000000..786afdb --- /dev/null +++ b/cicd/docker_targets/coreutils/Dockerfile @@ -0,0 +1,3 @@ +FROM debian:stretch +ADD bootstrap.sh / +RUN /bootstrap.sh && rm /bootstrap.sh diff --git a/cicd/docker_targets/coreutils/Tagfile b/cicd/docker_targets/coreutils/Tagfile new file mode 100644 index 0000000..dee3c0b --- /dev/null +++ b/cicd/docker_targets/coreutils/Tagfile @@ -0,0 +1 @@ +registry.git.mel.vin:443/shione/shione/cicd/coreutils:0.0 diff --git a/cicd/docker_targets/coreutils/bootstrap.sh b/cicd/docker_targets/coreutils/bootstrap.sh new file mode 100755 index 0000000..2d6c23a --- /dev/null +++ b/cicd/docker_targets/coreutils/bootstrap.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +DEBIAN=stretch + +set -e + +printf '%s\n' \ + "deb http://ftp.debian.org/debian $DEBIAN-backports main" \ + > /etc/apt/sources.list.d/$DEBIAN-backports.list + +apt-get update + +apt-get dist-upgrade -y + +# backported cmake requires backported libuv1 +apt-get install --no-install-recommends -y \ + bash \ + ca-certificates \ + cmake/$DEBIAN-backports \ + coreutils \ + findutils \ + git \ + grep \ + libuv1/$DEBIAN-backports \ + make \ + openssh-client \ + rsync \ + sed + +apt-get autoremove -y +apt-get clean +rm -rf /var/lib/apt/lists/* diff --git a/cicd/docker_targets/sphinx_html/Dockerfile b/cicd/docker_targets/sphinx_html/Dockerfile new file mode 100644 index 0000000..786afdb --- /dev/null +++ b/cicd/docker_targets/sphinx_html/Dockerfile @@ -0,0 +1,3 @@ +FROM debian:stretch +ADD bootstrap.sh / +RUN /bootstrap.sh && rm /bootstrap.sh diff --git a/cicd/docker_targets/sphinx_html/Tagfile b/cicd/docker_targets/sphinx_html/Tagfile new file mode 100644 index 0000000..3fb6c15 --- /dev/null +++ b/cicd/docker_targets/sphinx_html/Tagfile @@ -0,0 +1 @@ +registry.git.mel.vin:443/shione/shione/cicd/sphinx_html:0.0 diff --git a/cicd/docker_targets/sphinx_html/bootstrap.sh b/cicd/docker_targets/sphinx_html/bootstrap.sh new file mode 100755 index 0000000..f24045a --- /dev/null +++ b/cicd/docker_targets/sphinx_html/bootstrap.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +DEBIAN=stretch +PLANTUML=master + +set -e + +printf '%s\n' \ + "deb http://ftp.debian.org/debian $DEBIAN-backports main" \ + > /etc/apt/sources.list.d/$DEBIAN-backports.list + +apt-get update + +apt-get dist-upgrade -y + +# backported cmake requires backported libuv1 +apt-get install --no-install-recommends -y \ + ca-certificates \ + cmake/$DEBIAN-backports \ + curl \ + default-jre-headless \ + git \ + graphviz \ + libuv1/$DEBIAN-backports \ + make \ + python3-pip \ + python3-setuptools \ + python3-wheel + +# some font metapackages use recommends to install their subpackages +apt-get install -y \ + fonts-dejavu \ + fonts-liberation \ + fonts-noto + +ln -s /usr/bin/python3 /usr/local/bin/python +ln -s /usr/bin/pip3 /usr/local/bin/pip + +pip install \ + sphinx \ + sphinx_rtd_theme \ + sphinxcontrib-plantuml + +mkdir -p /opt/plantuml +for i in batik-all-1.7.jar jlatexmath-minimal-1.0.3.jar jlm_cyrillic.jar \ + jlm_greek.jar plantuml.jar +do + curl -Lf \ + -o /opt/plantuml/$i \ + https://git.mel.vin/mirror/plantuml/raw/$PLANTUML/$i +done + +printf '%s\n%s\n' \ + '#!/bin/sh' \ + 'exec java -jar /opt/plantuml/plantuml.jar "$@"' \ + > /usr/local/bin/plantuml +chmod +x /usr/local/bin/plantuml + +apt-get purge -y \ + curl + +apt-get autoremove -y +apt-get clean +rm -rf /var/lib/apt/lists/* diff --git a/cmake/check.cmake b/cmake/check.cmake new file mode 100644 index 0000000..4671406 --- /dev/null +++ b/cmake/check.cmake @@ -0,0 +1,10 @@ +# add check target as a convience target to invoke all checks +add_custom_target(check) + +if(${LINE_LIMIT}) + add_dependencies(check line_limit) +endif() + +if(${REGEX_CHECK}) + add_dependencies(check regex_check) +endif() diff --git a/cmake/find_python_module.cmake b/cmake/find_python_module.cmake new file mode 100644 index 0000000..f8fe638 --- /dev/null +++ b/cmake/find_python_module.cmake @@ -0,0 +1,48 @@ +function(find_python_module module module_u) + +if(${module_u}_FOUND) + return() +endif() + +# do not override user-specified values +if(NOT ${module_u}_PATH) + # set the default in case nothing is found + set("${module_u}_PATH" "" CACHE STRING "Path to ${module}." FORCE) + + # A module's location is usually a directory, but for binary modules + # it's an .so file. + execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" + "import os, re, ${module}; print(os.path.dirname(\ + re.compile('/__init__.py.*').sub('',${module}.__file__)))" + RESULT_VARIABLE "${module_u}_RESULT" + OUTPUT_VARIABLE "${module_u}_OUTPUT" + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + + # strip module directories to get the base path + # abc.foo.bar.xyz -> ... (three dots) + string(REGEX REPLACE "[^\\.]+" "" module_strip "${module}") + string(LENGTH "${module_strip}" module_strip) + # strip ${module_strip} times the final directory from path + if(module_strip GREATER 0) + # CMake's loops are inclusive so start at 1 + foreach(module_strip_i RANGE 1 ${module_strip}) + string(REGEX REPLACE "/[^/]+$" "" + "${module_u}_OUTPUT" "${${module_u}_OUTPUT}") + endforeach(module_strip_i) + endif() + + # if the exit code (RESULT) is non-zero python couldn't import module + if(NOT ${module_u}_RESULT) + set("${module_u}_PATH" "${${module_u}_OUTPUT}" CACHE STRING + "Path to ${module}." FORCE) + endif() +endif() + +if(NOT ${module_u}_PATH) + message(FATAL_ERROR "Could not find ${module}.") +endif() +set(${module_u}_FOUND ON CACHE BOOL "Found ${module}.") +mark_as_advanced(${module_u}_FOUND) +message(STATUS "Found ${module}: ${${module_u}_PATH}") + +endfunction(find_python_module) diff --git a/cmake/line_limit.cmake b/cmake/line_limit.cmake new file mode 100644 index 0000000..9d370c4 --- /dev/null +++ b/cmake/line_limit.cmake @@ -0,0 +1,4 @@ +add_custom_target(line_limit + COMMENT "Running line_limit checks" + COMMAND WERROR=${WERROR} ./cmake/line_limit.sh + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}") diff --git a/cmake/line_limit.sh b/cmake/line_limit.sh new file mode 100755 index 0000000..ed59f33 --- /dev/null +++ b/cmake/line_limit.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# intermediate script to support extra options for line_limit.sh + +# current script dir +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" + +# support WERROR option +[[ $WERROR == "ON" ]] && set -e + +# call line_limit.sh to check repo +"$SCRIPT_DIR/../cicd/style/line_limit.sh" \ + -e '^build[^/]*/' \ + -e '^.*\.svg$' \ + -i "$SCRIPT_DIR/.." + +exit 0 diff --git a/cmake/plantuml.cmake b/cmake/plantuml.cmake new file mode 100644 index 0000000..fce66e8 --- /dev/null +++ b/cmake/plantuml.cmake @@ -0,0 +1,14 @@ +if(PLANTUML_FOUND) + return() +endif() + +find_program(PLANTUML_PATH + NAMES plantuml plantuml.bat + DOC "Path to PlantUML wrapper script.") + +if(NOT PLANTUML_PATH) + message(FATAL_ERROR "Could not find PlantUML.") +endif() +set(PLANTUML_FOUND ON CACHE BOOL "Found PlantUML.") +mark_as_advanced(PLANTUML_FOUND) +message(STATUS "Found PlantUML: ${PLANTUML_PATH}") diff --git a/cmake/regex_check.cmake b/cmake/regex_check.cmake new file mode 100644 index 0000000..f638496 --- /dev/null +++ b/cmake/regex_check.cmake @@ -0,0 +1,4 @@ +add_custom_target(regex_check + COMMENT "Running regex_check checks" + COMMAND WERROR=${WERROR} ./cmake/regex_check.sh + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}") diff --git a/cmake/regex_check.sh b/cmake/regex_check.sh new file mode 100755 index 0000000..d79fbbf --- /dev/null +++ b/cmake/regex_check.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# intermediate script to support extra options for regex_check.sh + +# current script dir +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" + +# support WERROR option +[[ $WERROR == "ON" ]] && set -e + +# call regex_check.sh to check repo +"$SCRIPT_DIR/../cicd/style/regex_check.sh" \ + -e '^build[^/]*/' \ + -e '^.*\.svg$' \ + "$SCRIPT_DIR/.." +"$SCRIPT_DIR/../cicd/style/regex_check.sh" \ + -e '^build[^/]*/' \ + -r '(^$)|(^.*[^[:cntrl:][:blank:]]$)' \ + "$SCRIPT_DIR/.." + +exit 0 diff --git a/cmake/version.cmake b/cmake/version.cmake new file mode 100644 index 0000000..0dbdb21 --- /dev/null +++ b/cmake/version.cmake @@ -0,0 +1,62 @@ +if(NOT IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git") + return() +endif() + +find_package(Git REQUIRED) + +# output style is: +# 846ffe7, no tag yet +# 846ffe7+, no tag yet, dirty +# 1.3.2, an exact tag +# 1.3.2+, an exact tag, dirty +# 1.3.2-1-g846ffe7, one commit since tag +# 1.3.2-1-g846ffe7+, one commit since tag, dirty +execute_process(COMMAND "${GIT_EXECUTABLE}" describe --dirty=+ --tags --always + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" + OUTPUT_VARIABLE TMP_VER + OUTPUT_STRIP_TRAILING_WHITESPACE) + +# if there is no git tag prefix the CMake version +if(TMP_VER MATCHES "^[0-9a-f]+\\+?$") + set(TMP_VER "${PROJECT_VERSION}-1-g${TMP_VER}") +endif() + +# error if CMakeLists.txt version does not match the latest tag +string(REGEX REPLACE "^(.*)-[0-9]+-g[0-9a-f]+\\+?$" "\\1" TMP_TAG "${TMP_VER}") +# also support dirty tags, e.g. 1.3.2+ +if(TMP_VER STREQUAL TMP_TAG) + string(REGEX REPLACE "^(.*)\\+$" "\\1" TMP_TAG "${TMP_VER}") +endif() +if(NOT PROJECT_VERSION STREQUAL TMP_TAG) + message(FATAL_ERROR "CMake project version and git tag mismatch! \ +CMake: ${PROJECT_VERSION}, Git tag: ${TMP_TAG}.") +endif() + +# replace "-1-g" with "-", turning it into e.g. 1.3.2-846ffe7+ +string(REGEX REPLACE "^(.*)-[0-9]+-g([0-9a-f]+\\+?)$" "\\1-\\2" + TMP_VER "${TMP_VER}") + +# only set CMAKE variant when local name matches CMAKE name +# this avoids clashing when being used as a subproject +set(PROJECT_VERSION "${TMP_VER}") +if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(CMAKE_PROJECT_VERSION "${PROJECT_VERSION}") +endif() + +# do not message if actual version did not change +if(NOT PROJECT_VERSION STREQUAL PROJECT_VERSION_PREV) + set(PROJECT_VERSION_PREV "${PROJECT_VERSION}" CACHE STRING + "Project version during previous cache build." FORCE) + mark_as_advanced(PROJECT_VERSION_PREV) + message(STATUS "Updated version to ${PROJECT_VERSION}.") +endif() + +unset(TMP_VER) +unset(TMP_TAG) + +# force a reconfigure when the git index changes +# dirty detection won't run every for every build so it may outdated +# when the index/staging area changes it will however trigger +# this balances configuration time and dirty index detection +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS + "${CMAKE_SOURCE_DIR}/.git/index") diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..8f738fc --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,74 @@ +set(DOC_SRC "${PROJECT_SOURCE_DIR}/doc") +set(DOC_DEST "${PROJECT_BINARY_DIR}/doc/${DOC}") +set(DOC_TMP "${PROJECT_BINARY_DIR}/tmp/doc") + +if(DOC STREQUAL "html") + set(EXTRA_PYTHON_MODULES "sphinx_rtd_theme") +else() + unset(EXTRA_PYTHON_MODULES) +endif() + +find_package(PythonInterp REQUIRED) +include(find_python_module) + +# do not change the ENV, doesn't work with add_custom_target +# https://cmake.org/Bug/view.php?id=5145 +if(ENV{PYTHONPATH}) + set(PYTHONPATH "$ENV{PYTHONPATH}") +else() + # PYTHONPATH disables defaults, manually append them + execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" + "import sys; sys.stdout.write(':'.join(sys.path))" + OUTPUT_VARIABLE PYTHONPATH) +endif() + +foreach(module + sphinx + sphinxcontrib.plantuml + ${EXTRA_PYTHON_MODULES}) + string(TOUPPER "${module}" module_upper) + find_python_module("${module}" "${module_upper}") + set(PYTHONPATH "${${module_upper}_PATH}:${PYTHONPATH}") +endforeach(module) + +if(${WERROR}) + set(SPHINX_WERROR "-W") +else() + unset(SPHINX_WERROR) +endif() + +include(plantuml) + +configure_file( + "${DOC_SRC}/conf.py.in" + "${DOC_TMP}/sphinx/conf.py" + @ONLY) + +add_custom_target(doc ALL + COMMAND "${CMAKE_COMMAND}" -E echo + "Generating sphinx ${DOC} documentation" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${PYTHONPATH}" + "${PYTHON_EXECUTABLE}" -m sphinx -b "${DOC}" + -d "${DOC_TMP}/sphinx/doctrees" -j auto + -c "${DOC_TMP}/sphinx" -q ${SPHINX_WERROR} + "${DOC_SRC}" "${DOC_DEST}") +add_custom_command(TARGET doc POST_BUILD + COMMAND ; + COMMENT "Output at ${DOC_DEST}") + +add_custom_target(doc_nocache + COMMAND "${CMAKE_COMMAND}" -E echo + "Generating sphinx ${DOC} documentation, no cache" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${PYTHONPATH}" + "${PYTHON_EXECUTABLE}" -m sphinx -b "${DOC}" -E + -d "${DOC_TMP}/sphinx/doctrees" -j auto + -c "${DOC_TMP}/sphinx" -q ${SPHINX_WERROR} + "${DOC_SRC}" "${DOC_DEST}") +add_custom_command(TARGET doc_nocache POST_BUILD + COMMAND ; + COMMENT "Output at ${DOC_DEST}") + +add_custom_target(doc_clean + COMMAND "${CMAKE_COMMAND}" -E remove_directory "${DOC_DEST}" + COMMAND "${CMAKE_COMMAND}" -E remove_directory + "${DOC_TMP}/sphinx/doctrees") diff --git a/doc/_static/shione.jpg b/doc/_static/shione.jpg new file mode 100644 index 0000000..453112e --- /dev/null +++ b/doc/_static/shione.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3632e4d2c4db72d126332d9418076f480c6e7f951040cecf0f1d8db0344c1120 +size 182726 diff --git a/doc/_static/theme_overrides.css b/doc/_static/theme_overrides.css new file mode 100644 index 0000000..a2fcbf4 --- /dev/null +++ b/doc/_static/theme_overrides.css @@ -0,0 +1,9 @@ +/* override table width restrictions */ +@media screen and (min-width: 767px) { + .wy-table-responsive table td, .wy-table-responsive table th { + white-space: normal !important; + } + .wy-table-responsive { + overflow: visible !important; + } +} diff --git a/doc/about.rst b/doc/about.rst new file mode 100644 index 0000000..31f36d6 --- /dev/null +++ b/doc/about.rst @@ -0,0 +1,6 @@ +About +===== + +Hi, I'm renken, 20 years old from Algeria and I manange shione. + +Currently I'm working on vermim in addition to learning many new things. diff --git a/doc/conf.py.in b/doc/conf.py.in new file mode 100644 index 0000000..66b5f02 --- /dev/null +++ b/doc/conf.py.in @@ -0,0 +1,201 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# mel.vin GitLab documentation build configuration file, created by +# sphinx-quickstart on Mon Jul 10 23:38:21 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinxcontrib.plantuml'] + +# plantuml config +plantuml = '@PLANTUML_PATH@ -config "@PROJECT_SOURCE_DIR@/doc/plantuml.cfg"' +plantuml_output_format = 'svg_img' +plantuml_latex_output_format = 'pdf' + +# Add any paths that contain templates here, relative to this directory. +templates_path = [] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = '@PROJECT_NAME@' +copyright = '@PROJECT_COPYRIGHT@' +author = '@PROJECT_AUTHOR@' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '@PROJECT_VERSION@' +# The full version, including alpha/beta/rc tags. +release = version + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'en' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'colorful' + +# The name of a reST role to use as the default role, that is, for text marked +# up `like this`. The default role can always be set within individual +# documents using the standard reST default-role directive. +default_role = 'any' + +# The default language to highlight source code. +highlight_language = 'rst' + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' +html_sidebars = { + '**': [ + 'about.html', + 'navigation.html', + ] +} + +html_theme_options = { + 'font_family': 'Inconsolata', + 'font_size': '16px', + 'show_powered_by': 'false', + 'description': 'managed by @PROJECT_AUTHOR@' +} + + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['@DOC_SRC@/_static'] + +# Fix table line wrapping for RTD theme +# https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html +# https://github.com/rtfd/sphinx_rtd_theme/pull/432 +html_context = { + 'css_files': ['_static/theme_overrides.css'] +} + + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# This is required for the alabaster theme +# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars +html_sidebars = { + '**': [ + 'about.html', + 'navigation.html', + 'relations.html', # needs 'show_related': True theme option to display + ] +} + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = '@PROJECT_NAME@' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Underscores can cause issues in the generated LaTeX. +latex_prj_esc = '@PROJECT_NAME@'.replace("_", "\\_") +latex_aut_esc = '@PROJECT_AUTHOR@'.replace("_", "\\_") + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, '@PROJECT_NAME@.tex', latex_prj_esc, + latex_aut_esc, 'manual'), +] + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, '@PROJECT_NAME@', '@PROJECT_DESCRIPTION@', + '@PROJECT_AUTHOR@', 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, '@PROJECT_NAME@', '@PROJECT_NAME@', + '@PROJECT_AUTHOR@', '@PROJECT_NAME@', + '@PROJECT_DESCRIPTION@', 'Documentation'), +] diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..5a4b59d --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,10 @@ +Welcome to shione! +================== + +The name Shione means "sound of tide" (汐音 Shione). + +.. toctree:: + :glob: + :maxdepth: 1 + + about diff --git a/doc/plantuml.cfg b/doc/plantuml.cfg new file mode 100644 index 0000000..b07eefd --- /dev/null +++ b/doc/plantuml.cfg @@ -0,0 +1,96 @@ +skinparam ActivityBackgroundColor White +skinparam ActivityBorderColor Black +skinparam ActivityDiamondBackgroundColor #e6e6e6 +skinparam ActivityDiamondBorderColor Black +skinparam ActivityDiamondFontStyle Italic +skinparam ActorBackgroundColor White +skinparam ActorBorderColor Black +skinparam AgentBackgroundColor White +skinparam AgentBorderColor Black +skinparam ArrowColor Black +skinparam ArtifactBackgroundColor White +skinparam ArtifactBorderColor Black +skinparam BackgroundColor White +skinparam BoundaryBackgroundColor White +skinparam BoundaryBorderColor Black +skinparam CardBackgroundColor White +skinparam CardBorderColor Black +skinparam ClassBackgroundColor White +skinparam ClassBorderColor Black +skinparam ClassHeaderBackgroundColor White +skinparam CloudBackgroundColor White +skinparam CloudBorderColor Black +skinparam CollectionsBackgroundColor White +skinparam CollectionsBorderColor Black +skinparam ComponentBackgroundColor White +skinparam ComponentBorderColor Black +skinparam ControlBackgroundColor White +skinparam ControlBorderColor Black +skinparam DatabaseBackgroundColor White +skinparam DatabaseBorderColor Black +skinparam EntityBackgroundColor White +skinparam EntityBorderColor Black +skinparam FileBackgroundColor White +skinparam FileBorderColor Black +skinparam FolderBackgroundColor White +skinparam FolderBorderColor Black +skinparam FrameBackgroundColor White +skinparam FrameBorderColor Black +skinparam IconPackageBackgroundColor White +skinparam IconPrivateBackgroundColor White +skinparam IconProtectedBackgroundColor White +skinparam IconPublicBackgroundColor White +skinparam InterfaceBackgroundColor White +skinparam InterfaceBorderColor Black +skinparam LegendBackgroundColor White +skinparam LegendBorderColor Black +skinparam NodeBackgroundColor White +skinparam NodeBorderColor Black +skinparam NoteBackgroundColor #e7f2fa +skinparam NoteBorderColor #6ab0de +skinparam ObjectBackgroundColor White +skinparam ObjectBorderColor Black +skinparam PackageBackgroundColor White +skinparam PackageBorderColor Black +skinparam PageBorderColor Black +skinparam ParticipantBackgroundColor White +skinparam ParticipantBorderColor Black +skinparam PartitionBackgroundColor White +skinparam PartitionBorderColor Black +skinparam QueueBackgroundColor White +skinparam QueueBorderColor Black +skinparam RectangleBackgroundColor White +skinparam RectangleBorderColor Black +skinparam SequenceBoxBackgroundColor White +skinparam SequenceBoxBorderColor Black +skinparam SequenceDividerBackgroundColor White +skinparam SequenceDividerBorderColor Black +skinparam SequenceGroupBackgroundColor White +skinparam SequenceGroupBodyBackgroundColor White +skinparam SequenceGroupBorderColor Black +skinparam SequenceLifeLineBackgroundColor #e6e6e6 +skinparam SequenceLifeLineBorderColor Grey +skinparam SequenceReferenceBackgroundColor White +skinparam SequenceReferenceBorderColor Black +skinparam SequenceReferenceHeaderBackgroundColor White +skinparam StackBackgroundColor White +skinparam StackBorderColor Black +skinparam StateBackgroundColor White +skinparam StateBorderColor Black +skinparam StereotypeABackgroundColor White +skinparam StereotypeABorderColor Black +skinparam StereotypeCBackgroundColor White +skinparam StereotypeCBorderColor Black +skinparam StereotypeEBackgroundColor White +skinparam StereotypeEBorderColor Black +skinparam StereotypeIBackgroundColor White +skinparam StereotypeIBorderColor Black +skinparam StereotypeNBackgroundColor White +skinparam StereotypeNBorderColor Black +skinparam StorageBackgroundColor White +skinparam StorageBorderColor Black +skinparam SwimlaneBorderColor Black +skinparam TitleBackgroundColor White +skinparam TitleBorderColor Black +skinparam UsecaseBackgroundColor White +skinparam UsecaseBorderColor Black