mirror of https://github.com/rwf2/Rocket.git
Trim unneeded code in scripts.
This commit is contained in:
parent
8d3f1d65ac
commit
32c8199499
|
@ -37,9 +37,7 @@ function future_date() {
|
||||||
|
|
||||||
# Root of workspace-like directories.
|
# Root of workspace-like directories.
|
||||||
PROJECT_ROOT=$(relative "") || exit $?
|
PROJECT_ROOT=$(relative "") || exit $?
|
||||||
CORE_ROOT=$(relative "core") || exit $?
|
|
||||||
CONTRIB_ROOT=$(relative "contrib") || exit $?
|
CONTRIB_ROOT=$(relative "contrib") || exit $?
|
||||||
SITE_ROOT=$(relative "site") || exit $?
|
|
||||||
BENCHMARKS_ROOT=$(relative "benchmarks") || exit $?
|
BENCHMARKS_ROOT=$(relative "benchmarks") || exit $?
|
||||||
FUZZ_ROOT=$(relative "core/lib/fuzz") || exit $?
|
FUZZ_ROOT=$(relative "core/lib/fuzz") || exit $?
|
||||||
|
|
||||||
|
@ -47,35 +45,11 @@ FUZZ_ROOT=$(relative "core/lib/fuzz") || exit $?
|
||||||
CORE_LIB_ROOT=$(relative "core/lib") || exit $?
|
CORE_LIB_ROOT=$(relative "core/lib") || exit $?
|
||||||
CORE_CODEGEN_ROOT=$(relative "core/codegen") || exit $?
|
CORE_CODEGEN_ROOT=$(relative "core/codegen") || exit $?
|
||||||
CORE_HTTP_ROOT=$(relative "core/http") || exit $?
|
CORE_HTTP_ROOT=$(relative "core/http") || exit $?
|
||||||
GUIDE_TESTS_ROOT=$(relative "site/tests") || exit $?
|
|
||||||
|
|
||||||
# Root of infrastructure directories.
|
|
||||||
EXAMPLES_DIR=$(relative "examples") || exit $?
|
|
||||||
DOC_DIR=$(relative "target/doc") || exit $?
|
|
||||||
|
|
||||||
# Versioning information. These are changed as versions change.
|
|
||||||
VERSION=$(git grep -h "^version" "${CORE_LIB_ROOT}" | head -n 1 | cut -d '"' -f2)
|
|
||||||
MAJOR_VERSION=$(echo "${VERSION}" | cut -d'.' -f1-2)
|
|
||||||
GIT_BRANCH="$(git branch --show-current)"
|
|
||||||
GIT_BRANCH=${GIT_BRANCH:-$BRANCH}
|
|
||||||
IS_RELEASE_BRANCH=$( [[ $GIT_BRANCH == "v"* ]]; echo $? )
|
|
||||||
|
|
||||||
# A generated codename for this version. Use the git branch for pre-releases.
|
|
||||||
case $IS_RELEASE_BRANCH in
|
|
||||||
1)
|
|
||||||
CODENAME="${GIT_BRANCH}"
|
|
||||||
DOC_VERSION="${GIT_BRANCH}-$(future_date)"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
CODENAME="${MAJOR_VERSION}"
|
|
||||||
DOC_VERSION="${VERSION}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CORE_CRATE_ROOTS=(
|
CORE_CRATE_ROOTS=(
|
||||||
"${CORE_HTTP_ROOT}"
|
|
||||||
"${CORE_CODEGEN_ROOT}"
|
|
||||||
"${CORE_LIB_ROOT}"
|
"${CORE_LIB_ROOT}"
|
||||||
|
"${CORE_CODEGEN_ROOT}"
|
||||||
|
"${CORE_HTTP_ROOT}"
|
||||||
)
|
)
|
||||||
|
|
||||||
CONTRIB_SYNC_DB_POOLS_CRATE_ROOTS=(
|
CONTRIB_SYNC_DB_POOLS_CRATE_ROOTS=(
|
||||||
|
@ -88,38 +62,38 @@ CONTRIB_DB_POOLS_CRATE_ROOTS=(
|
||||||
"${CONTRIB_ROOT}/db_pools/codegen"
|
"${CONTRIB_ROOT}/db_pools/codegen"
|
||||||
)
|
)
|
||||||
|
|
||||||
ALL_CRATE_ROOTS=(
|
# Root of infrastructure directories.
|
||||||
"${CORE_HTTP_ROOT}"
|
EXAMPLES_DIR=$(relative "examples") || exit $?
|
||||||
"${CORE_CODEGEN_ROOT}"
|
DOC_DIR=$(relative "target/doc") || exit $?
|
||||||
"${CORE_LIB_ROOT}"
|
|
||||||
"${CONTRIB_ROOT}/sync_db_pools/codegen"
|
# Versioning information.
|
||||||
"${CONTRIB_ROOT}/sync_db_pools/lib"
|
VERSION=$(git grep -h "^version" "${CORE_LIB_ROOT}" | head -n 1 | cut -d '"' -f2)
|
||||||
"${CONTRIB_ROOT}/db_pools/codegen"
|
GIT_BRANCH="$(git branch --show-current)"
|
||||||
"${CONTRIB_ROOT}/db_pools/lib"
|
GIT_BRANCH=${GIT_BRANCH:-$BRANCH}
|
||||||
"${CONTRIB_ROOT}/dyn_templates"
|
IS_DEV_BRANCH=$( [[ $GIT_BRANCH == "v"* ]]; echo $? )
|
||||||
"${CONTRIB_ROOT}/ws"
|
|
||||||
)
|
case $IS_DEV_BRANCH in
|
||||||
|
1) DOC_VERSION="${GIT_BRANCH}-$(future_date)" ;;
|
||||||
|
*) DOC_VERSION="${VERSION}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
function print_environment() {
|
function print_environment() {
|
||||||
echo " VERSION: ${VERSION}"
|
echo " VERSION: ${VERSION}"
|
||||||
echo " MAJOR_VERSION: ${MAJOR_VERSION}"
|
|
||||||
echo " GIT_BRANCH: ${GIT_BRANCH}"
|
echo " GIT_BRANCH: ${GIT_BRANCH}"
|
||||||
echo " IS_RELEASE_BRANCH: ${IS_RELEASE_BRANCH}"
|
echo " IS_DEV_BRANCH: ${IS_DEV_BRANCH}"
|
||||||
echo " CODENAME: ${CODENAME}"
|
|
||||||
echo " DOC_VERSION: ${DOC_VERSION}"
|
echo " DOC_VERSION: ${DOC_VERSION}"
|
||||||
echo " SCRIPT_DIR: ${SCRIPT_DIR}"
|
echo " SCRIPT_DIR: ${SCRIPT_DIR}"
|
||||||
echo " PROJECT_ROOT: ${PROJECT_ROOT}"
|
echo " PROJECT_ROOT: ${PROJECT_ROOT}"
|
||||||
echo " CORE_ROOT: ${CORE_ROOT}"
|
|
||||||
echo " CONTRIB_ROOT: ${CONTRIB_ROOT}"
|
echo " CONTRIB_ROOT: ${CONTRIB_ROOT}"
|
||||||
echo " SITE_ROOT: ${SITE_ROOT}"
|
echo " FUZZ_ROOT: ${FUZZ_ROOT}"
|
||||||
echo " BENCHMARKS_ROOT: ${BENCHMARKS_ROOT}"
|
echo " BENCHMARKS_ROOT: ${BENCHMARKS_ROOT}"
|
||||||
echo " CORE_LIB_ROOT: ${CORE_LIB_ROOT}"
|
echo " CORE_LIB_ROOT: ${CORE_LIB_ROOT}"
|
||||||
echo " CORE_CODEGEN_ROOT: ${CORE_CODEGEN_ROOT}"
|
echo " CORE_CODEGEN_ROOT: ${CORE_CODEGEN_ROOT}"
|
||||||
echo " CORE_HTTP_ROOT: ${CORE_HTTP_ROOT}"
|
echo " CORE_HTTP_ROOT: ${CORE_HTTP_ROOT}"
|
||||||
echo " GUIDE_TESTS_ROOT: ${GUIDE_TESTS_ROOT}"
|
echo " CONTRIB_SYNC_DB_POOLS_CRATE_ROOTS: ${CONTRIB_SYNC_DB_POOLS_CRATE_ROOTS[*]}"
|
||||||
|
echo " CONTRIB_DB_POOLS_CRATE_ROOTS: ${CONTRIB_DB_POOLS_CRATE_ROOTS[*]}"
|
||||||
echo " EXAMPLES_DIR: ${EXAMPLES_DIR}"
|
echo " EXAMPLES_DIR: ${EXAMPLES_DIR}"
|
||||||
echo " DOC_DIR: ${DOC_DIR}"
|
echo " DOC_DIR: ${DOC_DIR}"
|
||||||
echo " ALL_CRATE_ROOTS: ${ALL_CRATE_ROOTS[*]}"
|
|
||||||
echo " date(): $(future_date)"
|
echo " date(): $(future_date)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,9 @@ echo ":::: Generating docs (${DOC_VERSION})..."
|
||||||
pushd "${PROJECT_ROOT}" > /dev/null 2>&1
|
pushd "${PROJECT_ROOT}" > /dev/null 2>&1
|
||||||
# Set the crate version and fill in missing doc URLs with docs.rs links.
|
# Set the crate version and fill in missing doc URLs with docs.rs links.
|
||||||
RUSTDOCFLAGS="-Z unstable-options \
|
RUSTDOCFLAGS="-Z unstable-options \
|
||||||
|
--extern-html-root-url rocket=https://api.rocket.rs/${GIT_BRANCH}/rocket/ \
|
||||||
--crate-version ${DOC_VERSION} \
|
--crate-version ${DOC_VERSION} \
|
||||||
|
--enable-index-page \
|
||||||
--generate-link-to-definition" \
|
--generate-link-to-definition" \
|
||||||
cargo doc -Zrustdoc-map --no-deps --all-features \
|
cargo doc -Zrustdoc-map --no-deps --all-features \
|
||||||
-p rocket \
|
-p rocket \
|
||||||
|
@ -31,17 +33,16 @@ pushd "${PROJECT_ROOT}" > /dev/null 2>&1
|
||||||
-p rocket_ws
|
-p rocket_ws
|
||||||
popd > /dev/null 2>&1
|
popd > /dev/null 2>&1
|
||||||
|
|
||||||
# Generating redirection list: from to.
|
|
||||||
echo ":::: Generating redirects..."
|
|
||||||
REDIRECTS="
|
REDIRECTS="
|
||||||
/ /v0.5/rocket/ 302!
|
/ /v0.5/rocket/ 302!
|
||||||
/rocket/ /v0.5/rocket/ 302!
|
/rocket/ /v0.5/rocket/ 302!
|
||||||
/:v /:v/rocket/
|
/:v /:v/rocket/
|
||||||
/:v/* https://:v--rocket-docs.netlify.app/:splat 200
|
/:v/* https://:v--rocket-docs.netlify.app/:splat 200
|
||||||
"
|
"
|
||||||
|
# Generating redirection list: from to.
|
||||||
if [ "${GIT_BRANCH}" = "master" ]; then
|
if [ "${GIT_BRANCH}" = "master" ]; then
|
||||||
|
echo ":::: Generating redirects..."
|
||||||
echo "${REDIRECTS}" | tee "${DOC_DIR}/_redirects"
|
echo "${REDIRECTS}" | tee "${DOC_DIR}/_redirects"
|
||||||
else
|
else
|
||||||
echo "-> '${GIT_BRANCH}' branch does not require redirects"
|
echo ":: Skipping redirects for branch '${GIT_BRANCH}'"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -208,7 +208,7 @@ echo ":: Ensuring contrib sync_db_pools versions match..."
|
||||||
check_versions_match "${CONTRIB_SYNC_DB_POOLS_CRATE_ROOTS[@]}"
|
check_versions_match "${CONTRIB_SYNC_DB_POOLS_CRATE_ROOTS[@]}"
|
||||||
|
|
||||||
echo ":: Ensuring contrib db_pools versions match..."
|
echo ":: Ensuring contrib db_pools versions match..."
|
||||||
check_versions_match "${CONTRIB_SYNC_DB_POOLS_CRATE_ROOTS[@]}"
|
check_versions_match "${CONTRIB_DB_POOLS_CRATE_ROOTS[@]}"
|
||||||
|
|
||||||
echo ":: Ensuring minimum style requirements are met..."
|
echo ":: Ensuring minimum style requirements are met..."
|
||||||
check_style
|
check_style
|
||||||
|
|
Loading…
Reference in New Issue