From 17b81c7c72f7a51da17c9c8c02a2e24a10a948d3 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Tue, 26 Dec 2023 20:51:14 -0500 Subject: [PATCH] Add a script to build every possible feature combination. --- .../build_all_feature_flag_combinations.bash | 43 +++++++++++++++++++ src/bin_wasm.rs | 6 ++- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100755 scripts/build_all_feature_flag_combinations.bash diff --git a/scripts/build_all_feature_flag_combinations.bash b/scripts/build_all_feature_flag_combinations.bash new file mode 100755 index 0000000..0897c89 --- /dev/null +++ b/scripts/build_all_feature_flag_combinations.bash @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# +# Time running a single parse without invoking a compare with emacs. +set -euo pipefail +IFS=$'\n\t' +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +: ${PROFILE:="debug"} + +function main { + local features=(compare foreign_document_test tracing event_count wasm wasm_test) + ENABLED_FEATURES= for_each_combination "${features[@]}" +} + +function for_each_combination { + local additional_flags=() + if [ "$PROFILE" = "dev" ] || [ "$PROFILE" = "debug" ]; then + PROFILE="debug" + else + additional_flags+=(--profile "$PROFILE") + fi + + + local flag=$1 + shift + + if [ "$#" -gt 0 ]; then + ENABLED_FEATURES="$ENABLED_FEATURES" for_each_combination "${@}" + elif [ -z "$ENABLED_FEATURES" ]; then + (cd "$DIR/../" && echo "\n\n\n========== no features ==========\n\n\n" && set -x && cargo build "${additional_flags[@]}" --no-default-features) + else + (cd "$DIR/../" && echo "\n\n\n========== ${ENABLED_FEATURES:1} ==========\n\n\n" && set -x && cargo build "${additional_flags[@]}" --no-default-features --features "${ENABLED_FEATURES:1}") + fi + + ENABLED_FEATURES="$ENABLED_FEATURES,$flag" + if [ "$#" -gt 0 ]; then + ENABLED_FEATURES="$ENABLED_FEATURES" for_each_combination "${@}" + else + (cd "$DIR/../" && echo "\n\n\n========== ${ENABLED_FEATURES:1} ==========\n\n\n" && set -x && cargo build "${additional_flags[@]}" --no-default-features --features "${ENABLED_FEATURES:1}") + fi +} + +main "${@}" diff --git a/src/bin_wasm.rs b/src/bin_wasm.rs index 2683a72..01b5622 100644 --- a/src/bin_wasm.rs +++ b/src/bin_wasm.rs @@ -1,5 +1,3 @@ -#![no_main] - use wasm::wasm_parse_org; use wasm_bindgen::prelude::wasm_bindgen; @@ -11,3 +9,7 @@ pub fn parse_org(org_contents: &str) -> wasm_bindgen::JsValue { let rust_parsed = wasm_parse_org(org_contents); serde_wasm_bindgen::to_value(&rust_parsed).unwrap() } + +fn main() -> Result<(), Box> { + Ok(()) +}