Skip to content

Commit adf50c8

Browse files
authored
Merge branch 'develop' into develop
2 parents 39ee866 + 8da09e3 commit adf50c8

File tree

340 files changed

+7826
-7619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+7826
-7619
lines changed

.github/workflows/ci.yml

Lines changed: 94 additions & 48 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@
2727
/util/danger/node_modules/
2828
/.roadmap
2929
/AGENTS.md
30+
/CLAUDE.md
3031
# Ignore hidden OS files under golden fixtures
31-
test-files/golden-tests/**/.*
32+
/test-files/golden-tests/**/.*
33+
/.code

CMakeLists.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,8 @@ llvm_map_components_to_libnames(llvm_libs all)
293293
string(REGEX REPLACE " /W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
294294
string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
295295

296-
# Duktape
297-
find_package(duktape CONFIG)
298-
if (NOT DUKTAPE_FOUND)
299-
# Duktape doesn't natively support CMake.
300-
# Some config script patches use the capitalized version.
301-
find_package(Duktape REQUIRED CONFIG)
302-
endif()
296+
# JerryScript
297+
find_package(jerryscript REQUIRED CONFIG)
303298

304299
# Lua
305300
find_package(Lua CONFIG REQUIRED)
@@ -362,10 +357,11 @@ target_include_directories(mrdocs-core
362357
)
363358
target_include_directories(mrdocs-core
364359
SYSTEM PRIVATE
365-
"$<BUILD_INTERFACE:${DUKTAPE_INCLUDE_DIRS}>"
366-
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
360+
"$<BUILD_INTERFACE:${JERRYSCRIPT_INCLUDE_DIRS}>"
361+
"$<BUILD_INTERFACE:${jerryscript_ROOT}/include>"
362+
"$<BUILD_INTERFACE:/usr/local/include>"
367363
)
368-
target_link_libraries(mrdocs-core PRIVATE ${DUKTAPE_LIBRARY})
364+
target_link_libraries(mrdocs-core PRIVATE jerryscript::jerry-core jerryscript::jerry-port)
369365
target_link_libraries(mrdocs-core PRIVATE Lua::lua)
370366

371367
# Clang
@@ -443,8 +439,6 @@ list(APPEND TOOL_SOURCES
443439
${CMAKE_CURRENT_BINARY_DIR}/src/tool/PublicToolArgs.cpp)
444440

445441
add_executable(mrdocs ${TOOL_SOURCES})
446-
target_compile_definitions(mrdocs PRIVATE -DMRDOCS_TOOL)
447-
448442
target_include_directories(mrdocs
449443
PUBLIC
450444
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>"

CMakePresets.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
1818
"LLVM_ROOT": "$env{LLVM_ROOT}",
1919
"Clang_ROOT": "$env{LLVM_ROOT}",
20-
"duktape_ROOT": "$env{DUKTAPE_ROOT}",
21-
"Duktape_ROOT": "$env{DUKTAPE_ROOT}",
20+
"jerryscript_ROOT": "$env{JERRYSCRIPT_ROOT}",
2221
"libxml2_ROOT": "$env{LIBXML2_ROOT}",
2322
"LibXml2_ROOT": "$env{LIBXML2_ROOT}",
2423
"MRDOCS_BUILD_TESTS": "ON",

bootstrap.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
# Official repository: https://github.com/cppalliance/mrdocs
99
#
1010

11+
# Heads up (Dec 2025): bootstrap.py is still moving toward being the single
12+
# setup path for ci.yml. Some presets/paths (e.g., release-msvc vs. old
13+
# release-windows) and edge flags may be untested. Defaults can shift while we
14+
# finish the move. If it blows up: 1) wipe the build dir; 2) run the matching
15+
# CMake/Ninja preset by hand; 3) share the failing command. This note stays
16+
# until Bootstrap owns the CI flow.
17+
18+
TRANSITION_BANNER = (
19+
"Heads up: bootstrap.py is mid-move to replace the process in ci.yml; presets can differ. "
20+
"If it fails, try a clean build dir or run the preset yourself."
21+
)
22+
1123
import argparse
1224
import subprocess
1325
import os
@@ -3404,6 +3416,7 @@ def get_command_line_args(argv=None):
34043416
def main():
34053417
args = get_command_line_args()
34063418
installer = MrDocsInstaller(args)
3419+
installer.ui.warn(TRANSITION_BANNER)
34073420
if installer.options.refresh_all:
34083421
installer.refresh_all()
34093422
exit(0)

codecov.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#
2+
# Licensed under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
# Copyright (c) 2025 Alan de Freitas (alandefreitas@gmail.com)
7+
#
8+
# Official repository: https://github.com/cppalliance/mrdocs
9+
#
10+
11+
# Codecov Configuration
12+
# https://docs.codecov.com/docs/codecovyml-reference
13+
#
14+
# Patch Coverage Threshold Rationale
15+
# ==================================
16+
#
17+
# We allow a small threshold for patch coverage NOT because reduced coverage
18+
# is acceptable, but because some lines are inherently uncoverable and
19+
# produce false positives:
20+
#
21+
# - Class declarations (e.g., `class Foo : public Bar`)
22+
# - Struct declarations (e.g., `struct MyTest`)
23+
# - Access specifiers (`public:`, `private:`)
24+
# - Pure virtual method declarations
25+
# - Opening/closing braces on their own lines
26+
#
27+
# These are not executable code - they don't generate machine instructions -
28+
# yet coverage tools (gcov) report them as "uncovered lines."
29+
#
30+
# Preferred Solutions (in order)
31+
# ------------------------------
32+
#
33+
# 1st best: Configure gcov/lcov to exclude declarations from coverage
34+
# tracking entirely, so they never appear as uncovered lines.
35+
# This would eliminate false positives at the source.
36+
# Status: Not currently available/configured.
37+
#
38+
# 2nd best: Use an absolute threshold (e.g., "allow up to 5 uncovered lines")
39+
# rather than a percentage. This would be precise and predictable.
40+
# Status: Codecov only supports percentage-based thresholds.
41+
#
42+
# 3rd best: Use a percentage-based threshold (what we implement below).
43+
# The threshold is set small enough that any real logic
44+
# (conditionals, loops, function bodies, error paths) that isn't
45+
# covered will still trigger a failure. Only trivial declaration
46+
# noise should pass through.
47+
#
48+
# With typical PR sizes, a 90% patch target achieves a similar effect to
49+
# allowing ~5 uncovered lines in a 50-line change.
50+
51+
coverage:
52+
status:
53+
# Project-wide coverage should not decrease
54+
project:
55+
default:
56+
threshold: 1%
57+
58+
# Patch coverage: only applies to new/modified lines in the PR
59+
patch:
60+
default:
61+
target: 90%

docs/modules/ROOT/pages/contribute/codebase-tour.adoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,3 @@ The documentation is written in AsciiDoc and can be built using the Antora tool.
5959
==== `third-party/`—Helpers for third-party libraries
6060

6161
This directory contains build scripts and configuration files for third-party libraries.
62-
63-
* `third-party/`—Third-party libraries
64-
** `third-party/llvm/`—CMake Presets for LLVM
65-
** `third-party/duktape/`—CMake scripts for Duktape
66-
** `third-party/lua/`—A bundled Lua interpreter

docs/modules/ROOT/pages/install.adoc

Lines changed: 25 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ Feel free to install them anywhere you want and adjust the main Mr.Docs configur
8080
8181
[IMPORTANT]
8282
====
83-
All instructions in this document assume you are using a CMake version above 3.26.
83+
All instructions in this document assume you are using a CMake version at or above 3.13.
8484
Binaries are available at https://cmake.org/download/[CMake's official website,window="_blank"].
8585
====
8686
87-
=== Duktape
87+
=== JerryScript
8888
89-
Mr.Docs uses the `duktape` library for JavaScript parsing.
90-
From the `third-party` directory, you can download the `duktape` source code from the official release:
89+
Mr.Docs embeds the `JerryScript` engine for JavaScript helpers.
90+
From the `third-party` directory, download the 3.0.0 source archive from the official repository:
9191
9292
[tabs]
9393
====
@@ -96,95 +96,47 @@ Windows PowerShell::
9696
--
9797
[source,bash]
9898
----
99-
Invoke-WebRequest -Uri "https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz" -OutFile "duktape-2.7.0.tar.xz" <.>
99+
Invoke-WebRequest -Uri "https://github.com/jerryscript-project/jerryscript/archive/refs/tags/v3.0.0.tar.gz" -OutFile "jerryscript-3.0.0.tar.gz" <.>
100100
----
101101
102-
<.> Downloads the `duktape` source code.
102+
<.> Downloads the `JerryScript` source code.
103103
--
104104
105105
Unix Variants::
106106
+
107107
--
108108
[source,bash]
109109
----
110-
curl -LJO https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz <.>
110+
curl -LJO https://github.com/jerryscript-project/jerryscript/archive/refs/tags/v3.0.0.tar.gz <.>
111111
----
112112
113-
<.> Downloads the `duktape` source code.
113+
<.> Downloads the `JerryScript` source code.
114114
--
115115
====
116116
117-
Then patch the Duktape source code to provide CMake support.
117+
Patch the JerryScript source with our CMake shim and install it:
118118
119119
[source,bash]
120120
----
121-
tar -xf duktape-2.7.0.tar.xz <.>
122-
cp ../mrdocs/third-party/duktape/CMakeLists.txt ./duktape-2.7.0/CMakeLists.txt <.>
123-
cp ../mrdocs/third-party/duktape/duktapeConfig.cmake.in ./duktape-2.7.0/duktapeConfig.cmake.in <.>
124-
cd duktape-2.7.0
125-
----
126-
127-
<.> Extracts the `duktape` source code.
128-
<.> Patches the source code with a `CMakeLists.txt` file to the `duktape-2.7.0` directory so that we can build it with CMake.
129-
<.> Copies the `duktapeConfig.cmake.in` file to the `duktape-2.7.0` directory so that we can install it with CMake and find it later from other CMake projects.
130-
131-
Now adjust the `duk_config.h` file to indicate we are statically building Duktape.
121+
tar -xf jerryscript-3.0.0.tar.gz <.>
122+
cp ../mrdocs/third-party/patches/jerryscript/CMakeLists.txt ./jerryscript-3.0.0/CMakeLists.txt <.>
123+
cp ../mrdocs/third-party/patches/jerryscript/jerryscriptConfig.cmake.in ./jerryscript-3.0.0/jerryscriptConfig.cmake.in <.>
124+
cd jerryscript-3.0.0
132125
133-
[tabs]
134-
====
135-
Windows PowerShell::
136-
+
137-
--
138-
[source,bash]
139-
----
140-
$content = Get-Content -Path "src\duk_config.h" <.>
141-
$content = $content -replace '#define DUK_F_DLL_BUILD', '#undef DUK_F_DLL_BUILD' <.>
142-
$content | Set-Content -Path "src\duk_config.h" <.>
143-
----
144-
145-
<.> Read the content of `duk_config.h`
146-
<.> Replace the `DUK_F_DLL_BUILD` macro with `#undef DUK_F_DLL_BUILD`
147-
<.> Write the content back to the file
148-
--
149-
150-
Unix Variants::
151-
+
152-
--
153-
[source,bash]
154-
----
155-
sed -i 's/#define DUK_F_DLL_BUILD/#undef DUK_F_DLL_BUILD/g' "src/duk_config.h" <.>
156-
----
157-
158-
<.> Disables the `DUK_F_DLL_BUILD` macro in the `duk_config.h` file to indicate we are statically building duktape.
159-
--
160-
161-
MacOS::
162-
+
163-
--
164-
[source,bash]
165-
----
166-
sed -i '' 's/#define DUK_F_DLL_BUILD/#undef DUK_F_DLL_BUILD/g' src/duk_config.h <.>
167-
----
168-
169-
<.> Disables the `DUK_F_DLL_BUILD` macro in the `duk_config.h` file to indicate we are statically building duktape.
170-
--
171-
====
172-
173-
And finally install the library with CMake:
174-
175-
[source,bash]
176-
----
177-
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release <.>
178-
cmake --build ./build --config Release <.>
179-
cmake --install ./build --prefix ./install <.>
126+
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release \
127+
-DJERRY_PROFILE=es.next -DJERRY_CMDLINE=OFF -DJERRY_TESTS=OFF -DJERRY_DEBUGGER=OFF \
128+
-DJERRY_SNAPSHOT_SAVE=OFF -DJERRY_SNAPSHOT_EXEC=OFF \
129+
-DJERRY_MEM_STATS=OFF -DJERRY_PARSER_STATS=OFF -DJERRY_LINE_INFO=OFF \
130+
-DJERRY_LTO=OFF -DJERRY_LIBC=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
131+
cmake --build ./build --config Release
132+
cmake --install ./build --prefix ./install
180133
----
181134
182-
<.> Configures the `duktape` library with CMake.
183-
<.> Builds the `duktape` library in the `build` directory.
184-
<.> Installs the `duktape` library with CMake support in the `install` directory.
135+
<.> Extracts the `JerryScript` source code.
136+
<.> Adds CMake packaging files maintained in this repository.
185137
186-
The scripts above download the `duktape` source code, extract it, and configure it with CMake.
187-
The CMake scripts provided by MrDocs are copied to the `duktape-2.7.0` directory to facilitate the build process with CMake and provide CMake installation scripts for other projects.
138+
The build uses JerryScript's upstream default port implementation; no custom
139+
`port.c` from MrDocs is required.
188140
189141
=== Libxml2
190142
@@ -317,7 +269,7 @@ cd ../..
317269
318270
The MrDocs repository also includes a `CMakePresets.json` file that contains the parameters to configure MrDocs with CMake.
319271
320-
To specify the installation directories, you can use the `LLVM_ROOT`, `DUKTAPE_ROOT`, and `LIBXML2_ROOT` environment variables.
272+
To specify the installation directories, you can use the `LLVM_ROOT`, `JERRYSCRIPT_ROOT`, and `LIBXML2_ROOT` environment variables.
321273
To specify a generator (`-G`) and platform name (`-A`), you can use the `CMAKE_GENERATOR` and `CMAKE_GENERATOR_PLATFORM` environment variables.
322274
323275
You can also customize the presets by duplicating and editing the `CMakeUserPresets.json.example` file in the `mrdocs` directory.

docs/mrdocs.schema.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
"title": "Path to the Addons directory",
88
"type": "string"
99
},
10+
"addons-supplemental": {
11+
"default": [],
12+
"description": "Optional list of supplemental addons directories that are loaded after the base addons (built-in or replacement). Files in later supplemental directories override files from earlier ones and from the base addons. Use this to add or override a few templates/helpers without copying the entire addons tree.",
13+
"items": {
14+
"type": "string"
15+
},
16+
"title": "Additional addons layered on top of the base addons",
17+
"type": "array"
18+
},
1019
"auto-brief": {
1120
"default": true,
1221
"description": "When set to `true`, Mr.Docs uses the first line (until the first dot, question mark, or exclamation mark) of the comment as the brief of the symbol. When set to `false`, a explicit @brief command is required.",

include/mrdocs/Generator.hpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com)
8+
// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com)
89
//
910
// Official repository: https://github.com/cppalliance/mrdocs
1011
//
@@ -19,6 +20,7 @@
1920
#include <mrdocs/Config.hpp>
2021
#include <mrdocs/Corpus.hpp>
2122
#include <mrdocs/Support/Error.hpp>
23+
#include <memory>
2224
#include <ostream>
2325
#include <string>
2426
#include <string_view>
@@ -201,11 +203,50 @@ class MRDOCS_VISIBLE
201203
@param outputPath The specified output path, which can be a directory or file.
202204
@param extension The file extension to use for single-page output.
203205
*/
206+
MRDOCS_DECL
204207
Expected<std::string>
205208
getSinglePageFullPath(
206209
std::string_view outputPath,
207210
std::string_view extension);
208211

212+
/** Install a custom generator.
213+
214+
This function registers a generator with the global
215+
generator registry, making it available for use.
216+
217+
Plugins can use this function to register custom
218+
generators.
219+
220+
@par Thread Safety
221+
This function is thread-safe and may be called
222+
concurrently from multiple threads.
223+
224+
@return An error if a generator with the same id
225+
already exists.
226+
227+
@param G The generator to install. Ownership is
228+
transferred to the registry.
229+
*/
230+
MRDOCS_DECL
231+
Expected<void>
232+
installGenerator(std::unique_ptr<Generator> G);
233+
234+
/** Find a generator by its id.
235+
236+
@par Thread Safety
237+
This function is thread-safe and may be called
238+
concurrently from multiple threads.
239+
240+
@return A pointer to the generator, or `nullptr`
241+
if no generator with the given id exists.
242+
243+
@param id The symbolic name of the generator.
244+
The name must be an exact match, including case.
245+
*/
246+
MRDOCS_DECL
247+
Generator const*
248+
findGenerator(std::string_view id) noexcept;
249+
209250
} // mrdocs
210251

211252

0 commit comments

Comments
 (0)