Skip to content

Commit

Permalink
Forward port changes from v0.6 release branch
Browse files Browse the repository at this point in the history
Merge release-0.6 branch into main.

This merges a number of fixes and cleanups about docs, CI, and
build/release scripts.
  • Loading branch information
bettio committed Feb 18, 2024
2 parents 230193c + 49c7927 commit ea6440f
Show file tree
Hide file tree
Showing 53 changed files with 255 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
- '*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-on-freebsd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
- '*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
- '*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
- '*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ name: Build Docs

# Controls when the workflow will run
on:
# Triggers the workflow on push request and tag events on master branch
# Triggers the workflow on push request and tag events on main branch
pull_request:
tag:
tags:
- '**'
branches:
- 'master'
- 'main'
- 'release-**'
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
Expand All @@ -36,7 +37,7 @@ on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-formatting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
- '**/*.erl'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
- cron: '45 18 * * 5'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/esp32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
- 'src/libAtomVM/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/esp32-mkimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pico-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ name: Publish Docs

# Controls when the workflow will run
on:
# Triggers the workflow on pull request, tag events and pushes on master
# Triggers the workflow on pull request, tag events and pushes on main
push:
tags:
- '**'
branches:
- 'master'
- 'main'
- 'release-**'
paths:
- '.github/workflows/publish-docs.yaml'
- 'CMakeLists.txt'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reuse-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: REUSE Compliance Check
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests-with-beam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
- '*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stm32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
- 'src/libAtomVM/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

env:
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AtomVM is open to any contribution.
However before contributing, please read carefully our [Code of Conduct](CODE_OF_CONDUCT.md) and
the following contribution guidelines.

Please, also make sure to understand the [Apache 2.0 license](LICENSE.md) and the
Please, also make sure to understand the [Apache 2.0 license](LICENSES/Apache-2.0.txt) and the
[Developer Certificate of Origin](https://developercertificate.org/).

Last but not least, **do not use GitHub issues for vulnerability reports**, read instead the
Expand Down Expand Up @@ -66,13 +66,13 @@ All source code modules should include copyright headers that are formatted for

### C Code

C source code style is enforced with [clang-format-13](https://releases.llvm.org/13.0.1/tools/clang/docs/ClangFormat.html). To automatically fix a file, run:
C source code style is enforced with [`clang-format-16`](https://releases.llvm.org/16.0.0/tools/clang/docs/ClangFormat.html). To automatically fix a file, run:

clang-format-13 --style=file -i file.c
clang-format-16 --style=file -i file.c

#### Indentation

* [K&R identation and braces style](https://en.wikipedia.org/wiki/Indentation_style#K&R_style)
* [K&R indentation and braces style](https://en.wikipedia.org/wiki/Indentation_style#K&R_style)
* [Mandatory braces](https://en.wikipedia.org/wiki/Indentation_style#Variant:_mandatory_braces)
* 4 space indentation (no tabs)

Expand Down Expand Up @@ -169,7 +169,7 @@ C source modules (`.c`) should be organized as follows:

#### Documentation

[Doxygen Javadoc style](https://www.doxygen.nl/manual/docblocks.html) code comments will be picked up and added to the documentation. Changes will automatically be added to the [libAtomVM Source Files](https://www.atomvm.net/doc/master/c_api_docs.html#libatomvm-source-files) and the [libAtomVM Index](https://www.atomvm.net/doc/master/apidocs/libatomvm/index.html#libatomvm-index). But to have `Data Strucures`, `Types`, `MACROS`, and `Functions` appear in the correct C Library APIs section the corresponding entries must be added to the similarly named `*.rst` files in the `AtomVM/doc/src/apidocs/libatomvm/` directory. The exact names of the flies that need to be altered are: `data_structures.rst`, `functions.rst`, `macros.rst`, and `types.rst`. The other files in the directory handle auto`generated content and do not need to be altered.
[Doxygen Javadoc style](https://www.doxygen.nl/manual/docblocks.html) code comments will be picked up and added to the documentation. Changes will automatically be added to the [libAtomVM Source Files](https://www.atomvm.net/doc/main/c_api_docs.html#libatomvm-source-files) and the [libAtomVM Index](https://www.atomvm.net/doc/main/apidocs/libatomvm/index.html#libatomvm-index). But to have `Data Structures`, `Types`, `MACROS`, and `Functions` appear in the correct C Library APIs section the corresponding entries must be added to the similarly named `*.rst` files in the `AtomVM/doc/src/apidocs/libatomvm/` directory. The exact names of the files that need to be altered are: `data_structures.rst`, `functions.rst`, `macros.rst`, and `types.rst`. The other files in the directory handle auto`generated content and do not need to be altered.

In the rare case that a function declaration and definition are both in different header files (rather than the definition in a `*.c` file) this can cause rendering errors for `Doxygen`. The work around for these cases can be demonstrated with this example for the function `sys_listener_destroy` it is documented and declared in `sys.h` and defined as follows in `listeners.h`:

Expand Down
20 changes: 10 additions & 10 deletions README.Md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ might be supported in a near future.
Getting Started
===============
There is much more information, including a more complete
["Getting Started Guide"](https://www.atomvm.net/doc/master/getting-started-guide.html),
[extensive documentation](https://www.atomvm.net/doc/master/build-instructions.html),
["Getting Started Guide"](https://www.atomvm.net/doc/main/getting-started-guide.html),
[extensive documentation](https://www.atomvm.net/doc/main/build-instructions.html),
[examples](https://www.atomvm.net/sample-code),
detailed [build instructions](https://www.atomvm.net/doc/master/build-instructions.html),
detailed [build instructions](https://www.atomvm.net/doc/main/build-instructions.html),
and [contact information](https://www.atomvm.net/contact) available on the
[AtomVM](https://atomvm.net) project website.

Expand Down Expand Up @@ -77,19 +77,19 @@ $ ./src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm
$ ./src/AtomVM ./tests/libs/alisp/test_alisp.avm
```

Complete [Build Instructions](https://www.atomvm.net/doc/master/build-instructions.html) are
Complete [Build Instructions](https://www.atomvm.net/doc/main/build-instructions.html) are
available in the documentation for
[Generic UNIX](https://www.atomvm.net/doc/master/build-instructions.html) (Linux, MacOS, FreeBSD),
[ESP32](https://www.atomvm.net/doc/master/build-instructions.html#building-for-esp32),
[STM32](https://www.atomvm.net/doc/master/build-instructions.html#building-for-stm32),
[Raspberry Pi Pico](https://www.atomvm.net/doc/master/build-instructions.html#building-for-raspberry-pi-pico)
[Generic UNIX](https://www.atomvm.net/doc/main/build-instructions.html) (Linux, MacOS, FreeBSD),
[ESP32](https://www.atomvm.net/doc/main/build-instructions.html#building-for-esp32),
[STM32](https://www.atomvm.net/doc/main/build-instructions.html#building-for-stm32),
[Raspberry Pi Pico](https://www.atomvm.net/doc/main/build-instructions.html#building-for-raspberry-pi-pico)
(rp2040), and
[WASM](https://www.atomvm.net/doc/master/build-instructions.html#building-for-nodejs-web) (NodeJS/Web).
[WASM](https://www.atomvm.net/doc/main/build-instructions.html#building-for-nodejs-web) (NodeJS/Web).

Project Status
==============

[![Build and Test](https://github.com/atomvm/AtomVM/actions/workflows/build-and-test.yaml/badge.svg?branch=master)](https://github.com/atomvm/AtomVM/actions/workflows/build-and-test.yaml)
[![Build and Test](https://github.com/atomvm/AtomVM/actions/workflows/build-and-test.yaml/badge.svg?branch=main)](https://github.com/atomvm/AtomVM/actions/workflows/build-and-test.yaml)

AtomVM is still in its early stages, but it can run simple applications similar to those available
in [examples](examples/) and [tests](tests/).
Expand Down
58 changes: 33 additions & 25 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ project(doc)

# Prepare souces in build directory
include(${CMAKE_SOURCE_DIR}/CMakeModules/GetVersion.cmake)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/_static)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/edoc)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY ${CMAKE_SOURCE_DIR}/CONTRIBUTING.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src)
file(COPY ${CMAKE_SOURCE_DIR}/CHANGELOG.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src)
file(COPY ${CMAKE_SOURCE_DIR}/UPDATING.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src)
file(COPY ${CMAKE_SOURCE_DIR}/CODE_OF_CONDUCT.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src)
file(COPY ${CMAKE_SOURCE_DIR}/LICENSES/Apache-2.0.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src/LICENSES)
file(COPY ${CMAKE_SOURCE_DIR}/SECURITY.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/release-notes.md.in ${CMAKE_CURRENT_BINARY_DIR}/src/release-notes.md @ONLY)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/edoc/edown_dep DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/edoc/)

# Configure libAtomVM restucturedtext skeleton.
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/apidocs/libatomvm/files)
file(GLOB SOURCE_FILES LIST_DIRECTORIES false RELATIVE ${CMAKE_SOURCE_DIR}/src/libAtomVM/ ${CMAKE_SOURCE_DIR}/src/libAtomVM/*.c ${CMAKE_SOURCE_DIR}/src/libAtomVM/*.h)
foreach(SOURCE_TARGET ${SOURCE_FILES})
set(SOURCE_FILE ${SOURCE_TARGET})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/apidocs/libatomvm/file.rst.in ${CMAKE_CURRENT_BINARY_DIR}/src/apidocs/libatomvm/files/${SOURCE_FILE}.rst @ONLY)
endforeach(SOURCE_TARGET)
foreach(SOURCE_FILE ${SOURCE_FILES})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/apidocs/libatomvm/file.rst.in ${CMAKE_CURRENT_BINARY_DIR}/src/apidocs/libatomvm/src/${SOURCE_FILE}.rst @ONLY)
endforeach(SOURCE_FILE)

# Support for edoc -> markdown.
add_custom_target(edown-escript
Expand All @@ -46,8 +46,8 @@ add_custom_target(edown-escript
COMMENT "Preparing edown escript" VERBATIM
)

# Get the version tree name, tag if this is a tagged commit, otherwise master.
execute_process(COMMAND "bash" "-c" "tag=$(git for-each-ref --points-at=HEAD --format='%(refname:lstrip=2)' refs/tags); ( [ $tag ] && echo $tag ) || echo 'master'"
# Get the version tree name, tag if this is a tagged commit, otherwise main.
execute_process(COMMAND "bash" "-c" "tag=$(git for-each-ref --points-at=HEAD --format='%(refname:lstrip=2)' refs/tags); ( [ $tag ] && echo $tag ) || echo 'main'"
OUTPUT_VARIABLE
DOC_TREE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE )
Expand All @@ -58,8 +58,14 @@ execute_process(COMMAND "bash" "-c" "tag=$(git for-each-ref --points-at=HEAD --f
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/apidocs/erlang)
file(COPY ${CMAKE_SOURCE_DIR}/libs/include DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/edoc/)

foreach(ERLANG_LIB estdlib eavmlib alisp etest)
set(ERL_LIB ${ERLANG_LIB}) # to allow passing ERL_LIB to gendoc.erl.in
set(ERLANG_LIBS
estdlib
eavmlib
alisp
etest
)

foreach(ERLANG_LIB ${ERLANG_LIBS})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/edoc/gendoc.erl.in ${CMAKE_CURRENT_BINARY_DIR}/edoc/${ERLANG_LIB}/gendoc.erl @ONLY)
file(COPY ${CMAKE_SOURCE_DIR}/libs/${ERLANG_LIB} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/edoc/)
add_custom_target(edoc-${ERLANG_LIB}
Expand All @@ -82,7 +88,6 @@ set(DOT_FILES
find_package(Graphviz)
if(GRAPHVIZ_FOUND)
message("Graphiz found")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/_static)
foreach(DOT_FILE ${DOT_FILES})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/_static/${DOT_FILE}.svg
Expand All @@ -91,7 +96,7 @@ if(GRAPHVIZ_FOUND)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating SVG for ${DOT_FILE}.dot" VERBATIM
)
set(ERLANG_DOTFILE_TARGETS ${ERLANG_DOTFILE_TARGETS} ${CMAKE_CURRENT_BINARY_DIR}/src/_static/${DOT_FILE}.svg)
set(DOTFILE_TARGETS ${DOTFILE_TARGETS} ${CMAKE_CURRENT_BINARY_DIR}/src/_static/${DOT_FILE}.svg)
endforeach()
else()
message("WARNING: Graphviz not found. Some images may be missing in generated documentation.")
Expand All @@ -102,30 +107,31 @@ endif()
##
find_package(Sphinx)
if(SPHINX_FOUND)

message("Sphinx found: ${SPHINX_BUILD_EXECUTABLE}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/pdf_stylesheet.rts DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/pdf_template.rtt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/apidocs/libatomvm)
add_custom_target(sphinx-html
${SPHINX_BUILD_EXECUTABLE} -b html -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/ ${CMAKE_CURRENT_BINARY_DIR}/html/
${SPHINX_BUILD_EXECUTABLE} -q -b html -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/ ${CMAKE_CURRENT_BINARY_DIR}/html/
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Sphinx HTML documentation" VERBATIM
DEPENDS ${ERLANG_DOTFILE_TARGETS} ${ERLANG_EDOC_TARGETS}
DEPENDS ${DOTFILE_TARGETS} ${ERLANG_EDOC_TARGETS}
)

add_custom_target(sphinx-pdf
${SPHINX_BUILD_EXECUTABLE} -D exclude_patterns=**/c_api_docs.rst,**/libatomvm/** -b rinoh -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/ ${CMAKE_CURRENT_BINARY_DIR}/pdf/
${SPHINX_BUILD_EXECUTABLE} -q -D exclude_patterns=apidocs/libatomvm/** -b rinoh -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/ ${CMAKE_CURRENT_BINARY_DIR}/pdf/
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Sphinx PDF documentation" VERBATIM
DEPENDS ${ERLANG_DOTFILE_TARGETS} ${ERLANG_EDOC_TARGETS} ${CMAKE_CURRENT_BINARY_DIR}/conf.py
DEPENDS ${DOTFILE_TARGETS} ${ERLANG_EDOC_TARGETS}
)

add_custom_target(sphinx-epub
${SPHINX_BUILD_EXECUTABLE} -D exclude_patterns=**/c_api_docs.rst,**/libatomvm/** -b epub -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/ ${CMAKE_CURRENT_BINARY_DIR}/epub/
${SPHINX_BUILD_EXECUTABLE} -q -D exclude_patterns=apidocs/libatomvm/**,LICENSES/** -b epub -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/ ${CMAKE_CURRENT_BINARY_DIR}/epub/
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Sphinx EPub documentation" VERBATIM
DEPENDS ${ERLANG_DOTFILE_TARGETS} ${ERLANG_EDOC_TARGETS} ${CMAKE_CURRENT_BINARY_DIR}/conf.py
DEPENDS ${DOTFILE_TARGETS} ${ERLANG_EDOC_TARGETS}
)

## This target is intended for CI `Publish Docs` workflow.
Expand All @@ -143,17 +149,19 @@ else()
endif()

## Fix URLs and change title to include "library" instead of "application"
foreach(LIBAVM_ERL_LIB estdlib eavmlib alisp etest)
add_custom_command(TARGET edoc-${LIBAVM_ERL_LIB}
POST_BUILD
foreach(LIBAVM_ERL_LIB ${ERLANG_LIBS})
add_custom_command(TARGET edoc-${LIBAVM_ERL_LIB} POST_BUILD
COMMAND find ./ -name *.md -exec sed -i -e "s/\#types/\#data-types/g" {} \;
COMMAND find ./ -name *.md -exec sed -i -e "s/\#index/\#function-index/g" {} \;
COMMAND find ./ -name *.md -exec sed -i -e "s/\#functions/\#function-details/g" {} \;
COMMAND sed -i -e "s/\.md/\.html/g; s/application/library/g" ${CMAKE_CURRENT_BINARY_DIR}/src/apidocs/erlang/${LIBAVM_ERL_LIB}/README.md
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Fixing html link locations for ${LIBAVM_ERL_LIB}." VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/apidocs/erlang/${LIBAVM_ERL_LIB}
COMMENT "Fixing links in ${LIBAVM_ERL_LIB} documentation." VERBATIM
)
endforeach(LIBAVM_ERL_LIB)

add_custom_target(doc #ALL
DEPENDS ${ERLANG_EDOC_TARGETS} sphinx-html sphinx-pdf sphinx-epub
DEPENDS sphinx-html sphinx-pdf sphinx-epub
)

if (TARGET GitHub_CI_Publish_Docs)
Expand Down
Loading

0 comments on commit ea6440f

Please sign in to comment.