Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@ryansg.com>2019-12-04 11:18:12 -0500
committerMike Gerwitz <mike.gerwitz@ryansg.com>2020-02-24 14:56:28 -0500
commit3248c429fe26360509113446ed648a91555c2e23 (patch)
tree9a89b1546532433bd40a621486409ac5eee54ca8
parent0147cb7cb4972405a683fed581533d3508c23a07 (diff)
downloadtame-3248c429fe26360509113446ed648a91555c2e23.tar.gz
tame-3248c429fe26360509113446ed648a91555c2e23.tar.bz2
tame-3248c429fe26360509113446ed648a91555c2e23.zip
Makefile.am (doc, html): Use intra_rustdoc_links
This is enabled by default in nightly, and is not available at all in stable. Considering the PITA that it will be to go back and rewrite docs to use the new format, and how important of a feature this is, we will just make use of it now.
-rw-r--r--tamer/Makefile.am2
-rw-r--r--tamer/build-aux/intra_rustdoc_links_check.rs23
-rw-r--r--tamer/configure.ac19
3 files changed, 43 insertions, 1 deletions
diff --git a/tamer/Makefile.am b/tamer/Makefile.am
index 8e78117..1334211 100644
--- a/tamer/Makefile.am
+++ b/tamer/Makefile.am
@@ -27,7 +27,7 @@ all:
doc: html
html-am:
- @CARGO@ doc
+ @CARGO@ @CARGO_DOC_FLAGS@ doc
# note that 'cargo check' is something else; see 'cargo --help'
test: check
diff --git a/tamer/build-aux/intra_rustdoc_links_check.rs b/tamer/build-aux/intra_rustdoc_links_check.rs
new file mode 100644
index 0000000..d0f59be
--- /dev/null
+++ b/tamer/build-aux/intra_rustdoc_links_check.rs
@@ -0,0 +1,23 @@
+// Feature check for `test`
+//
+// Copyright (C) 2014-2019 Ryan Specialty Group, LLC.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+// As of the time of writing, this feature is unstable and can only be
+// enabled in nightly. This file is intended to be used in the `configure`
+// script to determine whether a nightly version of Rust must be used to
+// build documentation.
+#![feature(intra_rustdoc_links)]
+
diff --git a/tamer/configure.ac b/tamer/configure.ac
index f2a1bff..8cca174 100644
--- a/tamer/configure.ac
+++ b/tamer/configure.ac
@@ -55,6 +55,16 @@ AX_COMPARE_VERSION([$rustc_version], [ge], [$rustc_ver_req],
AC_ARG_VAR([CARGO_BUILD_FLAGS],
[Flags to be passed to `cargo build' when invoked via Make])
+# The `intra_rustdoc_links` feature is required for building
+# documentation. If unavailable, then it's still an unstable feature and
+# we'll need to use nightly. We don't check for nightly here, though---if
+# it's missing, then cargo will tell the user what to do.
+AC_MSG_CHECKING([`intra_rustdoc_links_check` feature support])
+AS_IF(["$RUSTC" --crate-type lib build_aux/intra_rustdoc_links_check.rs &>/dev/null],
+ [AC_MSG_RESULT(available)],
+ [AC_MSG_RESULT([no (nightly required)])
+ AC_SUBST([CARGO_DOC_FLAGS], [+nightly])])
+
# The `test` feature is required for benchmarking. If unavailable, then
# it's still an unstable feature and we'll need to use nightly. We don't
# check for nightly here, though---if it's missing, then cargo will tell the
@@ -74,6 +84,15 @@ AS_IF([cargo fmt --help &>/dev/null],
cargo fmt --help # run again so user can see output
AC_MSG_ERROR([missing cargo-fmt for active toolchain])])
+# Cargo commands may be available but not necessarily installed for the
+# active toolchain. Let's check that.
+AC_MSG_CHECKING([whether cargo-doc is available for toolchain])
+AS_IF([cargo $CARGO_DOC_FLAGS doc --help &>/dev/null],
+ [AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+ cargo $CARGO_DOC_FLAGS doc --help # run again so user can see output
+ AC_MSG_ERROR([missing cargo-doc for toolchain])])
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT