Skip to content

Commit d878788

Browse files
build: Disable prql-elixir on Mac (#1902)
* build: Disable prql-elixir on Mac A temporary pause on building `prql-elixir` on Mac, as it's causing some build caching issues, as described in the Readme There are lots of ways to re-enable when we're ready. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 4c3fb3e commit d878788

File tree

9 files changed

+57
-42
lines changed

9 files changed

+57
-42
lines changed

.cargo/config.toml

-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
11
[target.wasm32-unknown-unknown]
22
runner = 'wasm-bindgen-test-runner'
3-
4-
[target.'cfg(target_os = "macos")']
5-
# Required for prql-elixir on Mac
6-
rustflags = [
7-
"-C", "link-arg=-undefined",
8-
"-C", "link-arg=dynamic_lookup",
9-
]

.github/workflows/test-elixir.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
test:
2626
strategy:
2727
matrix:
28-
os: [ubuntu-latest, windows-latest, macos-latest]
28+
# Currently disabling mac tests, see prql-elixir/readme.md for more details.
29+
os: [ubuntu-latest, windows-latest]
2930
otp: ["25.1.2"]
3031
elixir: ["1.14.2"]
3132
runs-on: ${{matrix.os}}

Taskfile.yml

+13-27
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ tasks:
6464
# Can't install atm with `--locked`
6565
- cargo install mdbook-footnote
6666
- cmd: |
67-
[ "$(which default-target)" ] || echo "🔴 Can't find a binary that cargo just installed. Is the cargo bin path (generally at ~/.cargo/bin) on the \$PATH?"
67+
[ "$(which cargo-insta)" ] || echo "🔴 Can't find a binary that cargo just installed. Is the cargo bin path (generally at ~/.cargo/bin) on the \$PATH?"
6868
silent: true
6969
7070
install-maturin:
@@ -151,17 +151,9 @@ tasks:
151151
Build everything.
152152
153153
Running this isn't required when developing; it's for caching or as a reference.
154-
vars:
155-
default_target:
156-
sh: default-target
157-
targets: |
158-
{{ .default_target }}
159-
wasm32-unknown-unknown
160154
cmds:
161-
- |
162-
{{ range ( .targets | trim | splitLines ) -}}
163-
cargo build --all-targets --target={{.}}
164-
{{ end -}}
155+
- cargo build --all-targets --target=wasm32-unknown-unknown
156+
- cargo build --all-targets
165157
- task: build-web
166158

167159
test-all:
@@ -177,14 +169,10 @@ tasks:
177169
- task: test-rust
178170
- task: build-all
179171
- task: test-js
180-
- task: test-elixir
181172
- pre-commit run -a
182173

183174
test-rust:
184175
desc: Test all rust code, accepting snapshots.
185-
vars:
186-
default_target:
187-
sh: default-target
188176
# Commenting out the ability to watch, since Task seems to trip over itself,
189177
# starting a new process before the old one has finished when a process
190178
# changes output files.
@@ -212,13 +200,11 @@ tasks:
212200
# tests to extract them, which include compiling prql-compiler, c) not
213201
# fail other compilation steps if they can't be extracted.
214202
- cargo insta test --accept -p mdbook-prql --test snapshot
215-
--target={{.default_target}}
216203
# Only delete unreferenced snapshots on the default target — lots are
217204
# excluded under wasm. Note that this will also over-delete on Windows.
218205
# Note that we need to pass the target explicitly to manage
219206
# https://github.com/rust-lang/cargo/issues/8899
220-
- cargo insta test --accept --target={{.default_target}}
221-
--unreferenced=auto
207+
- cargo insta test --accept --unreferenced=auto
222208
- cargo insta test --accept --target=wasm32-unknown-unknown
223209
# We build the book too, because that acts as a test
224210
- cd book && mdbook build
@@ -248,7 +234,6 @@ tasks:
248234
- "prql-compiler/**/*.snap"
249235
cmds:
250236
- cargo insta test --accept -p prql-compiler --lib
251-
--target=$(default-target)
252237

253238
build-web:
254239
desc: Build the website, including the book & playground.
@@ -276,14 +261,15 @@ tasks:
276261
- npm run build
277262
- npm cit
278263

279-
test-elixir:
280-
dir: prql-elixir
281-
cmds:
282-
# We could move this line into an `install` task
283-
- mix local.hex --force
284-
- mix deps.get --force
285-
- mix compile
286-
- mix test
264+
# Currently disabled; see prql-elixir/README.md for details
265+
# test-elixir:
266+
# dir: prql-elixir
267+
# cmds:
268+
# # We could move this line into an `install` task
269+
# - mix local.hex --force
270+
# - mix deps.get --force
271+
# - mix compile
272+
# - mix test
287273

288274
run-website:
289275
desc: Build & serve the static website.

book/book.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ git-repository-url = "https://github.com/PRQL/prql"
1313
# This is required because mdbook-prql isn't necessarily installed; maybe
1414
# there's a better way.
1515
#
16-
# We put the target directory in `target-book` because of
17-
# https://github.com/rust-lang/cargo/issues/8899, as an alternative to requiring
18-
# `default-target` to be installed.
19-
command = "cargo run --bin mdbook-prql --target-dir=target-book"
16+
command = "cargo run --bin mdbook-prql"
2017

2118
[preprocessor.admonish]
2219
assets_version = "2.0.0" # do not edit: managed by `mdbook-admonish install`

prql-compiler/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ insta = {version = "1.28", features = ["colors", "glob", "yaml"]}
4040
# For integration tests
4141
[target.'cfg(not(target_family="wasm"))'.dev-dependencies]
4242
chrono = "0.4"
43-
pretty_assertions = "1.3.0"
4443
criterion = "0.4.0"
4544
postgres = "0.19.3"
45+
pretty_assertions = "1.3.0"
4646
rusqlite = {version = "0.28.0", features = ["bundled", "csvtab"]}
4747

4848
# Re-enable on windows when duckdb supports it

prql-elixir/README.md

+31
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,34 @@ crate from this repo:
3838

3939
Future work includes publishing pre-compiled artifacts, so Elixir projects can
4040
run PRQL without needing a Rust toolchain.
41+
42+
## Mac
43+
44+
We currently don't enable compilation for Mac. This is possible to enable, but
45+
causes some issues with cargo's compilation cache. Briefly: it requires
46+
`RUST_FLAGS` to be set, and because of
47+
<https://github.com/rust-lang/cargo/issues/8716> &
48+
<https://github.com/rust-lang/cargo/issues/8899>, any compilation of a different
49+
target will bust the cache.
50+
51+
The possible future workarounds include:
52+
53+
- Passing `--target=aarch64-apple-darwin` to every cargo call, which is
54+
inconvenient and can be difficult in some situations; e.g. Rust Analyzer. This
55+
disables passing `RUST_FLAGS` (I'm actually unclear why `prql-elixir` builds
56+
successfully in that case...)
57+
- Directing other cargo calls to different paths, such as `/target-ra` for Rust
58+
Analyzer and `/target-book` for the book building. But one `cargo build` from
59+
the terminal without either the `target` or `target_dir` specified will bust
60+
the cache!
61+
- Never compiling for other targets. But our standard tests run for
62+
`--target=wasm32-unknown-unknown`, so this requires refraining from using
63+
them.
64+
- Removing `prql-elixir` from our workspace, so that `cargo` commands in the
65+
PRQL workspace don't require rust flags. This would work well, but means we
66+
need separate test coverage for this crate, which adds some weight to the
67+
tests.
68+
69+
If `prql-elixir` becomes more used (for example, we start publishing to Hex, or
70+
Mac developers want to work on it), then we can re-enable and deal with the
71+
caching issues. We can also re-enable them if the `cargo` issue is resolved.

prql-elixir/native/prql/.cargo/config.toml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Note that this doesn't apply when compiling from the workspace root. Because
2+
# we're not currently compiling for Mac, it's also impotent for now.
3+
14
[target.'cfg(target_os = "macos")']
25
rustflags = [
36
"-C", "link-arg=-undefined",

prql-elixir/native/prql/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ name = "prql"
1616
path = "src/lib.rs"
1717

1818
[dependencies]
19-
prql-compiler = {path = "../../../prql-compiler", default-features = false, version = "0.5.2" }
20-
[target.'cfg(not(any(target_family="wasm")))'.dependencies]
19+
prql-compiler = {path = "../../../prql-compiler", default-features = false, version = "0.5.2"}
20+
21+
# See Readme for details on Mac
22+
[target.'cfg(not(any(target_family="wasm", target_os = "macos")))'.dependencies]
2123
rustler = "0.27.0"

prql-elixir/native/prql/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// See Readme for more information on Mac compiling
2+
#![cfg(not(target_os = "macos"))]
13
// These bindings aren't relevant on wasm
24
#![cfg(not(target_family = "wasm"))]
35
// TODO: unclear why we need this `allow`; it's required in `CompileOptions`,

0 commit comments

Comments
 (0)