diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-10-21 16:07:31 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-01-05 15:10:50 -0800 |
commit | 3d80a88bd3c3dc8f9e20bbda485b0b436fd79fb3 (patch) | |
tree | d8c4fe8fd2c76920a42e4090348681169974f2af /docs | |
parent | b2c2549b93a8001d8a6d9d6da1ce756645e59160 (diff) | |
download | meson-3d80a88bd3c3dc8f9e20bbda485b0b436fd79fb3.zip meson-3d80a88bd3c3dc8f9e20bbda485b0b436fd79fb3.tar.gz meson-3d80a88bd3c3dc8f9e20bbda485b0b436fd79fb3.tar.bz2 |
modules: Add an unstable-rust module
Like other language specific modules this module is module for holding
rust specific helpers. This commit adds a test() function, which
simplifies using rust's internal unittest mechanism.
Rust tests are generally placed in the same code files as they are
testing, in contrast to languages like C/C++ and python which generally
place the tests in separate translation units. For meson this is
somewhat problematic from a repetition point of view, as the only
changes are generally adding --test, and possibly some dependencies.
The rustmod.test() method provides a mechanism to remove the repatition:
it takes a rust target, copies it, and then addes the `--test` option,
then creates a Test() target with the `rust` protocol. You can pass
additional dependencies via the `dependencies` keyword. This all makes
for a nice, DRY, test definition.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Rust-module.md | 35 | ||||
-rw-r--r-- | docs/markdown/_Sidebar.md | 1 | ||||
-rw-r--r-- | docs/markdown/snippets/unstable-rust-module.md | 4 | ||||
-rw-r--r-- | docs/sitemap.txt | 11 | ||||
-rw-r--r-- | docs/theme/extra/templates/navbar_links.html | 45 |
5 files changed, 69 insertions, 27 deletions
diff --git a/docs/markdown/Rust-module.md b/docs/markdown/Rust-module.md new file mode 100644 index 0000000..0fdba94 --- /dev/null +++ b/docs/markdown/Rust-module.md @@ -0,0 +1,35 @@ +--- +short-description: Rust language integration module +authors: + - name: Dylan Baker + email: dylan@pnwbakers.com + years: [2020] +... + +# Unstable Rust module + +*(new in 0.57.0)* + +**Note** Unstable modules make no backwards compatible API guarantees. + +The rust module provides helper to integrate rust code into meson. The goal +is to make using rust in meson more pleasant, while still remaining mesonic, +this means that it attempts to make rust work more like meson, rather than +meson work more like rust. + +## Functions + +### test(name: string, target: library | executable, dependencies: []Dependency) + +This function creates a new rust unittest target from an existing rust based +target, which may be a library or executable. It does this by copying the +sources and arguments passed to the original target and adding the `--test` +argument to the compilation, then creates a new test target which calls that +executable, using the rust test protocol. + +This accepts all of the keyword arguments as the +[`test`](Reference-manual.md#test) function except `protocol`, it will set +that automatically. + +Additional, test only dependencies may be passed via the dependencies +argument. diff --git a/docs/markdown/_Sidebar.md b/docs/markdown/_Sidebar.md index 2637d68..0ca1762 100644 --- a/docs/markdown/_Sidebar.md +++ b/docs/markdown/_Sidebar.md @@ -12,3 +12,4 @@ * [gnome](Gnome-module.md) * [i18n](i18n-module.md) * [pkgconfig](Pkgconfig-module.md) +* [rust](Rust-module.md) diff --git a/docs/markdown/snippets/unstable-rust-module.md b/docs/markdown/snippets/unstable-rust-module.md new file mode 100644 index 0000000..15a7ecb --- /dev/null +++ b/docs/markdown/snippets/unstable-rust-module.md @@ -0,0 +1,4 @@ +## Untable Rust module + +A new unstable module has been added to make using rust with meson easier. +Currently it adds a single function to ease defining rust tests. diff --git a/docs/sitemap.txt b/docs/sitemap.txt index 4cae9fe..3164440 100644 --- a/docs/sitemap.txt +++ b/docs/sitemap.txt @@ -34,24 +34,25 @@ index.md Disabler.md Modules.md CMake-module.md + Cuda-module.md Dlang-module.md + External-Project-module.md Fs-module.md Gnome-module.md Hotdoc-module.md - i18n-module.md Icestorm-module.md + Keyval-module.md Pkgconfig-module.md - Python-module.md Python-3-module.md + Python-module.md Qt4-module.md Qt5-module.md RPM-module.md + Rust-module.md Simd-module.md SourceSet-module.md Windows-module.md - Cuda-module.md - Keyval-module.md - External-Project-module.md + i18n-module.md Java.md Vala.md D.md diff --git a/docs/theme/extra/templates/navbar_links.html b/docs/theme/extra/templates/navbar_links.html index 832bd2c..8df082f 100644 --- a/docs/theme/extra/templates/navbar_links.html +++ b/docs/theme/extra/templates/navbar_links.html @@ -5,28 +5,29 @@ Modules <span class="caret"></span> </a> <ul class="dropdown-menu" id="modules-menu"> - @for tup in ( \ - ("CMake-module.html","CMake"), \ - ("Cuda-module.html","CUDA"), \ - ("Dlang-module.html","Dlang"), \ - ("Fs-module.html","Filesystem"), \ - ("Gnome-module.html","GNOME"), \ - ("Hotdoc-module.html","Hotdoc"), \ - ("i18n-module.html","i18n"), \ - ("Icestorm-module.html","Icestorm"), \ - ("Keyval-module.html","Keyval"), \ - ("Pkgconfig-module.html","Pkgconfig"), \ - ("Python-module.html","Python"), \ - ("Python-3-module.html","Python 3"), \ - ("Qt4-module.html","Qt4"), \ - ("Qt5-module.html","Qt5"), \ - ("RPM-module.html","RPM"), \ - ("SourceSet-module.html","SourceSet"), \ - ("Windows-module.html","Windows")): - <li> - <a href="@tup[0]">@tup[1]</a> - </li> - @end + @for tup in [ \ + ("CMake-module.html","CMake"), \ + ("Cuda-module.html","CUDA"), \ + ("Dlang-module.html","Dlang"), \ + ("Fs-module.html","Filesystem"), \ + ("Gnome-module.html","GNOME"), \ + ("Hotdoc-module.html","Hotdoc"), \ + ("Icestorm-module.html","Icestorm"), \ + ("Keyval-module.html","Keyval"), \ + ("Pkgconfig-module.html","Pkgconfig"), \ + ("Python-3-module.html","Python 3"), \ + ("Python-module.html","Python"), \ + ("Qt4-module.html","Qt4"), \ + ("Qt5-module.html","Qt5"), \ + ("RPM-module.html","RPM"), \ + ("Rust-module.html","Rust"), \ + ("SourceSet-module.html","SourceSet"), \ + ("Windows-module.html","Windows"), \ + ("i18n-module.html","i18n")]: + <li> + <a href="@tup[0]">@tup[1]</a> + </li> + @end </ul> </li> \ |