Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support query! for cargo-free systems #2927

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Conversation

kshramt
Copy link
Contributor

@kshramt kshramt commented Dec 10, 2023

Does your PR solve an issue?

Eagerly calling

pub fn workspace_root(&self) -> PathBuf {
results in build failure in Bazel builds.

Delete this text and add "fixes #(issue number)"

@kshramt
Copy link
Contributor Author

kshramt commented Dec 10, 2023

To provide additional context, I am attempting to get the following code to work.

# BUILD.bazel
rust_binary(
    name = "app",
    srcs = glob(["src/**/*.rs"]),
    aliases = aliases(),
    compile_data = [
        "@//:.sqlx",
    ],
    proc_macro_deps = all_crate_deps(
        proc_macro = True,
    ),
    rustc_env = {
        "SQLX_OFFLINE_DIR": ".sqlx",
    },
    visibility = ["//visibility:public"],
    deps = all_crate_deps(),
)

grim7reaper added a commit to grim7reaper/sqlx that referenced this pull request Dec 11, 2023
@grim7reaper
Copy link

grim7reaper commented Dec 11, 2023

I can confirm that this fixes our build issue with the 0.7.3 as well (we're also working with Bazel).

BTW, how did you troubleshoot this one @kshramt ?
In our case the build failure wasn't really explicit (process_wrapper failed: error executing command with no error message nor stderr output whatsoever), did you use some magic Bazel flags to get more info?

@kshramt
Copy link
Contributor Author

kshramt commented Dec 11, 2023

Thank you for confirming the resolution. As for your question about troubleshooting, I think I didn't do anything out of the ordinary. However, I did come across the error message "help: message: CARGO must be set: NotPresent." at https://github.com/kshramt/evidence_based_scheduling/actions/runs/7158836343/job/19491388204#step:5:207. I'm not entirely sure what made this error message visible in this instance.

@rbtcollins
Copy link
Contributor

@grim7reaper Did you consider the patch I put up in #2922 ? I think they will be ~functionally equivalent, and I expect this patch would work for us too.

grim7reaper added a commit to grim7reaper/sqlx that referenced this pull request Jan 5, 2024
@sbernauer
Copy link

Believe it or not, I patched sqlx to be able to build it in Nix and ended up independently with a 100% identical patch 😅 Just found this PR before opening my own.
Changing it from eagerly to lazy seems like such an obvious and good addition, fixed all my problems 👍

grim7reaper added a commit to grim7reaper/sqlx that referenced this pull request Jan 8, 2024
grim7reaper added a commit to grim7reaper/sqlx that referenced this pull request Jan 8, 2024
@abonander abonander merged commit b4269b7 into launchbadge:main Jan 18, 2024
@rbtcollins
Copy link
Contributor

Thank you for merging this! I just realised that 2 years ago I did the first implementation in #1415 - do we need some sort of test to prevent this reverting again in future?

kukabi pushed a commit to helikon-labs/sqlx that referenced this pull request Feb 22, 2024
Co-authored-by: kshramt <kshramt@example.com>
@NilsIrl
Copy link

NilsIrl commented Mar 14, 2024

Sorry if this is not the appropriate place to ask but I don't think there's many issues/threads with this many bazel and sqlx users so I'll shoot my shot.

What workflow do you use to update the offline dir? By default it only updates inside of the bazel sandbox so what I've done is just set SQLX_OFFLINE_DIR to /tmp but it's not very nice. Any advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants