From cdcf013f610c169d2a2efa493d586c76da521053 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 14 Jul 2021 00:35:41 -0400 Subject: [PATCH] Fix build, Make the js package a feature that can be enabled for wasm, rather than always on (#545) * Fix build, add js feature * fix command --- .github/workflows/rust.yml | 2 +- arrow/Cargo.toml | 3 ++- arrow/README.md | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 76511bf6e65e..5579072effb4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -332,7 +332,7 @@ jobs: export CARGO_HOME="/github/home/.cargo" export CARGO_TARGET_DIR="/github/home/target" cd arrow - cargo build --target wasm32-unknown-unknown + cargo build --features=js --target wasm32-unknown-unknown # test builds with various feature flags default-build: diff --git a/arrow/Cargo.toml b/arrow/Cargo.toml index eef7dbc426ed..ca343eb9aad4 100644 --- a/arrow/Cargo.toml +++ b/arrow/Cargo.toml @@ -43,7 +43,7 @@ indexmap = "1.6" rand = { version = "0.8", default-features = false } # getrandom is a dependency of rand, not (directly) of arrow # need to specify `js` feature to build on wasm -getrandom = { version = "0.2", features = ["js"] } +getrandom = { version = "0.2", optional = true } num = "0.4" csv_crate = { version = "1.1", optional = true, package="csv" } regex = "1.3" @@ -64,6 +64,7 @@ csv = ["csv_crate"] ipc = ["flatbuffers"] simd = ["packed_simd"] prettyprint = ["prettytable-rs"] +js = ["getrandom/js"] # The test utils feature enables code used in benchmarks and tests but # not the core arrow code itself test_utils = ["rand/std", "rand/std_rng"] diff --git a/arrow/README.md b/arrow/README.md index f9b73085d686..77e36ec8e14b 100644 --- a/arrow/README.md +++ b/arrow/README.md @@ -30,6 +30,7 @@ The arrow crate provides the following optional features: - `csv` (default) - support for reading and writing Arrow arrays to/from csv files - `ipc` (default) - support for the [arrow-flight]((https://crates.io/crates/arrow-flight) IPC and wire format - `prettyprint` - support for formatting record batches as textual columns +- `js` - support for building arrow for WebAssembly / JavaScript - `simd` - (_Requires Nightly Rust_) alternate optimized implementations of some [compute](https://github.com/apache/arrow/tree/master/rust/arrow/src/compute) kernels using explicit SIMD processor intrinsics.