Skip to content

Apache DataFusion SQL Query Engine

perf(build): don't build the doc-generator binaries by default (#24338)

Daniël Heresf17158738b74
diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.toml
index 0fe48ddf6a..81e0418dd2 100644
--- a/datafusion/core/Cargo.toml
+++ b/datafusion/core/Cargo.toml
@@ -39,6 +39,13 @@ all-features = true
workspace = true
[features]
+# Enables the `print_config_docs`, `print_runtime_config_docs` and
+# `print_functions_docs` binaries, which regenerate the docs under
+# `docs/source/user-guide`. Off by default: they are only run by
+# `dev/update_config_docs.sh` and `dev/update_function_docs.sh`, and each one
+# links a ~174MB binary that would otherwise be relinked on every build of this
+# crate.
+docs_generation = []
nested_expressions = ["datafusion-functions-nested"]
# This feature is deprecated. Use the `nested_expressions` feature instead.
array_expressions = ["nested_expressions"]
@@ -190,6 +197,21 @@ ignored = ["datafusion-doc", "datafusion-macros", "dashmap"]
[target.'cfg(not(target_os = "windows"))'.dev-dependencies]
nix = { version = "0.31.3", features = ["fs"] }
+[[bin]]
+name = "print_config_docs"
+path = "src/bin/print_config_docs.rs"
+required-features = ["docs_generation"]
+
+[[bin]]
+name = "print_runtime_config_docs"
+path = "src/bin/print_runtime_config_docs.rs"
+required-features = ["docs_generation"]
+
+[[bin]]
+name = "print_functions_docs"
+path = "src/bin/print_functions_docs.rs"
+required-features = ["docs_generation"]
+
[[bench]]
harness = false
name = "aggregate_query_sql"
diff --git a/dev/update_config_docs.sh b/dev/update_config_docs.sh
index 7ab998f3da..df40c65210 100755
--- a/dev/update_config_docs.sh
+++ b/dev/update_config_docs.sh
@@ -27,8 +27,8 @@ cd "${ROOT_DIR}"
source "${ROOT_DIR}/ci/scripts/utils/tool_versions.sh"
TARGET_FILE="docs/source/user-guide/configs.md"
-PRINT_CONFIG_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_config_docs"
-PRINT_RUNTIME_CONFIG_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_runtime_config_docs"
+PRINT_CONFIG_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --features docs_generation --bin print_config_docs"
+PRINT_RUNTIME_CONFIG_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --features docs_generation --bin print_runtime_config_docs"
echo "Inserting header"
cat <<'EOF' > "$TARGET_FILE"
diff --git a/dev/update_function_docs.sh b/dev/update_function_docs.sh
index 86a272ae19..04266b8cbc 100755
--- a/dev/update_function_docs.sh
+++ b/dev/update_function_docs.sh
@@ -27,7 +27,7 @@ cd "${ROOT_DIR}"
source "${ROOT_DIR}/ci/scripts/utils/tool_versions.sh"
TARGET_FILE="docs/source/user-guide/sql/aggregate_functions.md"
-PRINT_AGGREGATE_FUNCTION_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_functions_docs -- aggregate"
+PRINT_AGGREGATE_FUNCTION_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --features docs_generation --bin print_functions_docs -- aggregate"
echo "Inserting header"
cat <<'EOF' > "$TARGET_FILE"
@@ -121,7 +121,7 @@ npx "prettier@${PRETTIER_VERSION}" --write "$TARGET_FILE"
echo "'$TARGET_FILE' successfully updated!"
TARGET_FILE="docs/source/user-guide/sql/scalar_functions.md"
-PRINT_SCALAR_FUNCTION_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_functions_docs -- scalar"
+PRINT_SCALAR_FUNCTION_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --features docs_generation --bin print_functions_docs -- scalar"
echo "Inserting header"
cat <<'EOF' > "$TARGET_FILE"
@@ -165,7 +165,7 @@ npx "prettier@${PRETTIER_VERSION}" --write "$TARGET_FILE"
echo "'$TARGET_FILE' successfully updated!"
TARGET_FILE="docs/source/user-guide/sql/window_functions.md"
-PRINT_WINDOW_FUNCTION_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_functions_docs -- window"
+PRINT_WINDOW_FUNCTION_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --features docs_generation --bin print_functions_docs -- window"
echo "Inserting header"
cat <<'EOF' > "$TARGET_FILE"