Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions r/sedonadb/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
^compile_commands\.json$
^\.vscode$
^README\.Rmd$
^bootstrap\.R$
3 changes: 2 additions & 1 deletion r/sedonadb/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Suggests:
testthat (>= 3.0.0),
withr,
wk
Config/testthat/edition: 3
Imports:
geoarrow,
nanoarrow
Config/testthat/edition: 3
Config/build/bootstrap: TRUE
6 changes: 2 additions & 4 deletions r/sedonadb/README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ The goal of sedonadb is to provide an R interface to [Apache SedonaDB](https://s

You can install the development version of sedonadb from [GitHub](https://github.com/) with:

``` shell
git clone https://github.com/apache/sedona-db.git
cd sedona-db/r/sedonadb
R CMD INSTALL .
``` r
pak::pkg_install("apache/sedona-db/r/sedonadb")
```

Installing a development version of sedonadb requires a [Rust compiler](https://rustup.rs) and a GEOS system dependency (e.g., `brew install geos` or `apt-get install libgeos-dev`). Install instructions for these dependencies on other platforms can be found on the [sf package homepage](https://r-spatial.github.io/sf).
Expand Down
6 changes: 2 additions & 4 deletions r/sedonadb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ SQL with high function coverage and GeoParquet IO.
You can install the development version of sedonadb from
[GitHub](https://github.com/) with:

``` shell
git clone https://github.com/apache/sedona-db.git
cd sedona-db/r/sedonadb
R CMD INSTALL .
``` r
pak::pkg_install("apache/sedona-db/r/sedonadb")
```

Installing a development version of sedonadb requires a [Rust
Expand Down
52 changes: 52 additions & 0 deletions r/sedonadb/bootstrap.R
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this file should be added to .Rbuildignore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for catching!

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# R builds a package by copying only the sources under the directory of the R
# package, which means it cannot refer to the Rust files above the directory.
# So, this R script copies the necessary Rust crates under the R package dir.
# Note that, this is not a standard mechanism of R, but is only invoked by
# pkgbuild (cf. https://github.com/r-lib/pkgbuild/pull/157)

# Tweak Cargo.toml
cargo_toml <- "src/rust/Cargo.toml"
lines <- readLines(cargo_toml)
writeLines(
gsub("../../../../", "../", lines, fixed = TRUE),
cargo_toml
)

dir.create("src/dep_crates/")
file.copy(
c(
"../../rust",
"../../c",
"../../Cargo.toml",
"../../Cargo.lock"
),
"src/",
recursive = TRUE
)

# Tweak workspace Cargo.toml
top_cargo_toml <- "src/Cargo.toml"
lines <- readLines(top_cargo_toml)
# change the path to the R package's Rust code
lines <- gsub("r/sedonadb/src/rust", "rust", lines, fixed = TRUE)
# remove unnecessary workspace members
lines <- gsub('"python/sedonadb",', "", lines, fixed = TRUE)
lines <- gsub('"sedona-cli",', "", lines, fixed = TRUE)
writeLines(lines, top_cargo_toml)