diff --git a/.gitignore b/.gitignore index ce17377..d5bfb86 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ build.rabs.db* /.project /.settings /.vscode +/docs/_build diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..298ea9e --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,19 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/_build/doctrees/targets/expressions.doctree b/docs/_build/doctrees/targets/expressions.doctree new file mode 100644 index 0000000..af64cc9 Binary files /dev/null and b/docs/_build/doctrees/targets/expressions.doctree differ diff --git a/docs/_build/doctrees/targets/meta.doctree b/docs/_build/doctrees/targets/meta.doctree new file mode 100644 index 0000000..88e7629 Binary files /dev/null and b/docs/_build/doctrees/targets/meta.doctree differ diff --git a/docs/_build/doctrees/targets/scans.doctree b/docs/_build/doctrees/targets/scans.doctree new file mode 100644 index 0000000..01ce8c3 Binary files /dev/null and b/docs/_build/doctrees/targets/scans.doctree differ diff --git a/docs/_build/doctrees/targets/symbols.doctree b/docs/_build/doctrees/targets/symbols.doctree new file mode 100644 index 0000000..626237a Binary files /dev/null and b/docs/_build/doctrees/targets/symbols.doctree differ diff --git a/docs/_build/doctrees/targets/targets.doctree b/docs/_build/doctrees/targets/targets.doctree new file mode 100644 index 0000000..6a8dc6c Binary files /dev/null and b/docs/_build/doctrees/targets/targets.doctree differ diff --git a/docs/_build/html/_sources/targets/expressions.rst.txt b/docs/_build/html/_sources/targets/expressions.rst.txt new file mode 100644 index 0000000..ca0a086 --- /dev/null +++ b/docs/_build/html/_sources/targets/expressions.rst.txt @@ -0,0 +1,3 @@ +Expression Targets +================== + diff --git a/docs/_build/html/_sources/targets/meta.rst.txt b/docs/_build/html/_sources/targets/meta.rst.txt new file mode 100644 index 0000000..9a776d9 --- /dev/null +++ b/docs/_build/html/_sources/targets/meta.rst.txt @@ -0,0 +1,3 @@ +Meta Targets +============ + diff --git a/docs/_build/html/_sources/targets/scans.rst.txt b/docs/_build/html/_sources/targets/scans.rst.txt new file mode 100644 index 0000000..3a9a90d --- /dev/null +++ b/docs/_build/html/_sources/targets/scans.rst.txt @@ -0,0 +1,3 @@ +Scan Targets +============ + diff --git a/docs/_build/html/_sources/targets/symbols.rst.txt b/docs/_build/html/_sources/targets/symbols.rst.txt new file mode 100644 index 0000000..c6d7675 --- /dev/null +++ b/docs/_build/html/_sources/targets/symbols.rst.txt @@ -0,0 +1,3 @@ +Symbol Targets +============== + diff --git a/docs/_build/html/_sources/targets/targets.rst.txt b/docs/_build/html/_sources/targets/targets.rst.txt new file mode 100644 index 0000000..6e9308b --- /dev/null +++ b/docs/_build/html/_sources/targets/targets.rst.txt @@ -0,0 +1,3 @@ +Targets +======= + diff --git a/docs/_build/html/targets/expressions.html b/docs/_build/html/targets/expressions.html new file mode 100644 index 0000000..100c2a0 --- /dev/null +++ b/docs/_build/html/targets/expressions.html @@ -0,0 +1,192 @@ + + + + + + + + + + + Expression Targets — Rabs documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Expression Targets

+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/targets/meta.html b/docs/_build/html/targets/meta.html new file mode 100644 index 0000000..63bb245 --- /dev/null +++ b/docs/_build/html/targets/meta.html @@ -0,0 +1,192 @@ + + + + + + + + + + + Meta Targets — Rabs documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Meta Targets

+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/targets/scans.html b/docs/_build/html/targets/scans.html new file mode 100644 index 0000000..ae0c3f1 --- /dev/null +++ b/docs/_build/html/targets/scans.html @@ -0,0 +1,192 @@ + + + + + + + + + + + Scan Targets — Rabs documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Scan Targets

+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/targets/symbols.html b/docs/_build/html/targets/symbols.html new file mode 100644 index 0000000..f1cf532 --- /dev/null +++ b/docs/_build/html/targets/symbols.html @@ -0,0 +1,192 @@ + + + + + + + + + + + Symbol Targets — Rabs documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Symbol Targets

+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/targets/targets.html b/docs/_build/html/targets/targets.html new file mode 100644 index 0000000..6bea958 --- /dev/null +++ b/docs/_build/html/targets/targets.html @@ -0,0 +1,192 @@ + + + + + + + + + + + Targets — Rabs documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Targets

+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..12d1c78 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,54 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# 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('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'Rabs' +copyright = '2019, Raja Mukherji' +author = 'Raja Mukherji' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + +# -- 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 = "sphinx_rtd_theme" + +# 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 = ['_static'] + +master_doc = 'index' diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..2b53b87 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,31 @@ +.. Rabs documentation master file, created by + sphinx-quickstart on Thu May 9 07:06:34 2019. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Rabs's documentation! +================================ + +Introduction +------------ + +Rabs is a general purpose build system, designed for fast and consistent incremental rebuilds. + +Rabs is designed to build (or rebuild) a set of targets as necessary, by considering dependencies and changes to the contents / values of those dependencies. +For a general overview of targets in Rabs, see here: :doc:`targets/targets`. + +Rabs provides several types of targets: + +* :doc:`targets/files` +* :doc:`targets/symbols` +* :doc:`targets/meta` +* :doc:`targets/expressions` +* :doc:`targets/scans` + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..7893348 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/readthedocs.yaml b/docs/readthedocs.yaml new file mode 100644 index 0000000..3de0001 --- /dev/null +++ b/docs/readthedocs.yaml @@ -0,0 +1,9 @@ +version: 2 +formats: [] +python: + version: 3.7 + install: + - requirements: requirements.txt +sphinx: + builder: html + configuration: conf.py \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..52b04f2 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +sphinx_rtd_theme \ No newline at end of file diff --git a/docs/targets/expressions.rst b/docs/targets/expressions.rst new file mode 100644 index 0000000..ca0a086 --- /dev/null +++ b/docs/targets/expressions.rst @@ -0,0 +1,3 @@ +Expression Targets +================== + diff --git a/docs/targets/files.rst b/docs/targets/files.rst new file mode 100644 index 0000000..5365a49 --- /dev/null +++ b/docs/targets/files.rst @@ -0,0 +1,3 @@ +File Targets +============ + diff --git a/docs/targets/meta.rst b/docs/targets/meta.rst new file mode 100644 index 0000000..9a776d9 --- /dev/null +++ b/docs/targets/meta.rst @@ -0,0 +1,3 @@ +Meta Targets +============ + diff --git a/docs/targets/scans.rst b/docs/targets/scans.rst new file mode 100644 index 0000000..3a9a90d --- /dev/null +++ b/docs/targets/scans.rst @@ -0,0 +1,3 @@ +Scan Targets +============ + diff --git a/docs/targets/symbols.rst b/docs/targets/symbols.rst new file mode 100644 index 0000000..c6d7675 --- /dev/null +++ b/docs/targets/symbols.rst @@ -0,0 +1,3 @@ +Symbol Targets +============== + diff --git a/docs/targets/targets.rst b/docs/targets/targets.rst new file mode 100644 index 0000000..6e9308b --- /dev/null +++ b/docs/targets/targets.rst @@ -0,0 +1,3 @@ +Targets +======= + diff --git a/minilang b/minilang index e7acb94..6d333fd 160000 --- a/minilang +++ b/minilang @@ -1 +1 @@ -Subproject commit e7acb9492bb3202abea4ee3faf7404a57bdb733b +Subproject commit 6d333fd830d2134cdd2f4999ba2709b4a18b8294 diff --git a/rabs.c b/rabs.c index f104a58..8b09b87 100644 --- a/rabs.c +++ b/rabs.c @@ -28,7 +28,7 @@ #include #endif -#define VERSION_STRING "2.0.0" +#define VERSION_STRING "2.0.2" const char *SystemName = "build.rabs"; const char *RootPath = 0; diff --git a/target.c b/target.c index 13d12c1..bb7f537 100644 --- a/target.c +++ b/target.c @@ -812,6 +812,7 @@ static ml_value_t *target_scan_source(void *Data, int Count, ml_value_t **Args) } static int build_scan_target_list(target_t *Depend, targetset_t *Scans) { + if (!ml_is((ml_value_t *)Depend, TargetT)) return 1; targetset_insert(Scans, Depend); return 0; } @@ -1266,8 +1267,15 @@ void target_update(target_t *Target) { cache_expr_set(Target, Result); } else if (Target->Type == ScanTargetT) { targetset_t Roots[1] = {TARGETSET_INIT}; + if (Result->Type != MLListT) { + fprintf(stderr, "\e[31mError: %s: scan results must be a list of targets\n\e[0m", Target->Id); + exit(1); + } targetset_init(Roots, ml_list_length(Result)); - ml_list_foreach(Result, Roots, (void *)build_scan_target_list); + if (ml_list_foreach(Result, Roots, (void *)build_scan_target_list)) { + fprintf(stderr, "\e[31mError: %s: scan results must be a list of targets\n\e[0m", Target->Id); + exit(1); + } targetset_t Scans[1] = {TARGETSET_INIT}; targetset_foreach(Roots, Scans, (void *)target_insert); targetset_foreach(Roots, Scans, (void *)target_find_leaves);