aboutsummaryrefslogtreecommitdiff
path: root/generate-readme.sh
diff options
context:
space:
mode:
authorFrederick Mayle <fmayle@google.com>2023-09-28 16:36:41 -0700
committerFrederick Mayle <fmayle@google.com>2023-10-13 11:18:21 -0700
commita6c4e29bef30220216eeb5bde00a4a9dda6597c9 (patch)
tree487673684b83e84a687e6b73541a2e1290b9befa /generate-readme.sh
parent4402b52bd3a7bbdeadae7e6e77972501d32e935f (diff)
downloadzerocopy-a6c4e29bef30220216eeb5bde00a4a9dda6597c9.tar.gz
Upgrade zerocopy to 0.7.5
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update rust/crates/zerocopy For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md The crate now uses `assert_matches` in unit tests. That isn't imported in AOSP, so I've disabled tests for now. Bug: 302709631 Test: TreeHugger Change-Id: Ie3a8eeedc24e485d750bd425c4d404124e6dc79d
Diffstat (limited to 'generate-readme.sh')
-rwxr-xr-xgenerate-readme.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/generate-readme.sh b/generate-readme.sh
new file mode 100755
index 0000000..b900737
--- /dev/null
+++ b/generate-readme.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Copyright 2022 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -eo pipefail
+
+COPYRIGHT_HEADER=$(mktemp)
+BODY=$(mktemp)
+DISCLAIMER_FOOTER=$(mktemp)
+
+cat > $COPYRIGHT_HEADER <<'EOF'
+<!-- Copyright 2022 The Fuchsia Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+
+WARNING: DO NOT EDIT THIS FILE. It is generated automatically. Edits should be
+made in the doc comment on `src/lib.rs` or in `generate-readme.sh`.
+-->
+
+EOF
+
+# This uses the `cargo readme` tool, which you can install via `cargo install
+# cargo-readme --version 3.2.0`.
+#
+# The `sed` command is used to strip code links like:
+#
+# /// Here is a link to [`Vec`].
+#
+# These links don't work in a Markdown file, and so we remove the `[` and `]`
+# characters to convert them to non-link code snippets.
+cargo readme --no-license | sed 's/\[\(`[^`]*`\)]/\1/g' > $BODY
+
+cat > $DISCLAIMER_FOOTER <<'EOF'
+
+## Disclaimer
+
+Disclaimer: Zerocopy is not an officially supported Google product.
+EOF
+
+cat $COPYRIGHT_HEADER $BODY $DISCLAIMER_FOOTER