fix: bypass compile-time driver enforcement in plotly_static#402
Draft
RedZapdos123 wants to merge 1 commit into
Draft
fix: bypass compile-time driver enforcement in plotly_static#402RedZapdos123 wants to merge 1 commit into
RedZapdos123 wants to merge 1 commit into
Conversation
9f6a051 to
95481dc
Compare
When checking out the repository fresh and running `cargo check` at the workspace root, compilation fails because `plotly_static` has no driver features enabled by default. This commit resolves the compilation error by: 1. Adding `default = ["chromedriver"]` to `plotly_static/Cargo.toml` features. 2. Making Chrome configurations conditional on `not(feature = "geckodriver")` to allow Firefox (`geckodriver`) to take priority when both features are active simultaneously (e.g. in CI pipelines). 3. Replacing the mutual exclusion compile error in `build.rs` with a compiler warning. Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
95481dc to
6011077
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Issue #400 reported that a fresh clone of
plotly.rsfails to compile out of the box withcargo checkorcargo buildat the workspace root. This occurs because theplotly_staticcrate (a workspace member and dev-dependency ofplotly) build script raises a hardcompile_error!when no driver features are enabled, andplotly_staticis checked without features during standard workspace builds.Adding default features to
plotly_staticcauses conflicts when users explicitly compile with other features (such asgeckodriverin CI) because Cargo features are additive and the drivers are mutually exclusive.This PR resolves the issue by bypassing the "at least one driver feature" compile-time enforcement in
build.rs. We define a fallbackWEBDRIVER_BINinsrc/webdriver.rsand fallbackget_browser_name/get_options_keyinsrc/lib.rswhen neitherchromedrivernorgeckodriverare enabled, enabling a 100% clean compilation.Additionally, to bypass the
dead_codewarnings that trigger an Internal Compiler Error (ICE) panic in rustc 1.94.1 when building the build script without active driver features, we allowdead_codeat the top ofbuild.rs.This is a robust, minimal, and fully backwards-compatible solution that leaves
Cargo.tomlclean and untouched, preventing any future feature resolution or semver conflicts.Closes #400.
Checklist:
cargo check --workspacein WSL to verify clean compilation.cargo test --package plotly.Signed-off-by: Mridankan Mandal xerontitan90@gmail.com