Skip to content

Commit

Permalink
prepare for release
Browse files Browse the repository at this point in the history
JosiahParry committed May 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 444f80e commit 261b184
Showing 20 changed files with 5,148 additions and 66 deletions.
6 changes: 5 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -6,4 +6,8 @@
^dev$
^README\.Rmd$
^README\.md$
^.Rprofile$
^.Rprofile$
^.github/$
^src/vendor/$
^src/rust/vendor$
.github
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
config.log
config.status
autom4te.cache
.Rproj.user
.Rprofile
.Rprofile
17 changes: 12 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
Package: arcgisplaces
Title: What the Package Does (One Line, Title Case)
Title: Search for POIs using ArcGIS 'Places Service'
Version: 0.0.0.9003
Authors@R:
person("Josiah", "Parry", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-9910-865X"))
Description: What the package does (one paragraph).
Description: The ArcGIS 'Places service' is a ready-to-use location
service that can search for businesses and geographic locations around
the world. It allows you to find, locate, and discover detailed
information about each place. Query for places near a point, within a
bounding box, filter based on categories, or provide search text.
'arcgisplaces' integrates with 'sf' for out of the box compatibility
with other spatial libraries.
License: Apache License (>= 2)
Encoding: UTF-8
Language: en
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Imports:
arcgisutils (>= 0.2.0.9001),
arcgisutils (>= 0.3.0),
cli,
httr2 (>= 1.0.0),
rlang,
wk
Config/rextendr/version: 0.3.1.9000
SystemRequirements: Cargo (Rust's package manager), rustc
SystemRequirements: Cargo (Rust's package manager), rustc, OpenSSL
Suggests:
sf
Depends:
R (>= 2.10)
LazyData: true
Remotes: r-arcgis/arcgisutils
Remotes:
r-arcgis/arcgisutils
1 change: 1 addition & 0 deletions R/core-near-point.R
Original file line number Diff line number Diff line change
@@ -108,6 +108,7 @@ near_point <- function(

#' Create a prototype data.frame for the near-point query
#' @keywords internal
#' @noRd
near_point_ptype <- function() {
geometry <- structure(
list(),
9 changes: 3 additions & 6 deletions R/core-place-details.R
Original file line number Diff line number Diff line change
@@ -24,14 +24,13 @@
#' res <- place_details(place_ids)
#' }
#' @references [API Documentation](https://developers.arcgis.com/rest/places/place-id-get/)
#' @returns an sf object
place_details <- function(
place_id,
requested_fields,
icon = NULL,
token = arc_token(),
.progress = TRUE
) {

.progress = TRUE) {
# place_id must be a character vector with no NA values
check_character(place_id)

@@ -113,7 +112,5 @@ place_details <- function(
)
)

res

res
}

1 change: 1 addition & 0 deletions R/extendr-wrappers.R
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ parse_categories <- function(x) .Call(wrap__parse_categories, x)

#' Parse `/categories/{categoryId}` results vectorized
#' @keywords internal
#' @noRd
parse_category_details <- function(x) .Call(wrap__parse_category_details, x)

near_point_ <- function(x, y, radius, category_id, search_text, token) .Call(wrap__near_point_, x, y, radius, category_id, search_text, token)
2,515 changes: 2,515 additions & 0 deletions configure

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
AC_INIT

# Export PATH to include Cargo binary directory
export PATH="$PATH:$HOME/.cargo/bin"

# Check for Rustc
AC_CHECK_PROGS([RUSTC], [rustc], [no])
if test "$RUSTC" = "no"; then
echo "----------------------- [RUST NOT FOUND]---------------------------"
echo "The 'rustc' compiler was not found on the PATH. Please install Rust"
echo "from: https://www.rust-lang.org/tools/install"
echo ""
echo "Alternatively, you may install Rust from your OS package manager:"
echo " - Debian/Ubuntu: apt-get install rustc"
echo " - Fedora/CentOS: dnf install rustc"
echo " - macOS: brew install rustc"
echo "-------------------------------------------------------------------"
echo ""
exit 1
fi

# Check if Cargo is installed
if ! command -v cargo &> /dev/null; then
echo "----------------------- [CARGO NOT FOUND]--------------------------"
echo "The 'cargo' command was not found on the PATH. Please install Cargo"
echo "from: https://www.rust-lang.org/tools/install"
echo ""
echo "Alternatively, you may install Cargo from your OS package manager:"
echo " - Debian/Ubuntu: apt-get install cargo"
echo " - Fedora/CentOS: dnf install cargo"
echo " - macOS: brew install rustc"
echo "-------------------------------------------------------------------"
echo ""
exit 1
fi

AC_OUTPUT
2,515 changes: 2,515 additions & 0 deletions configure.win

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions man/arcgisplaces-package.Rd
12 changes: 0 additions & 12 deletions man/near_point_ptype.Rd

This file was deleted.

12 changes: 0 additions & 12 deletions man/parse_category_details.Rd

This file was deleted.

3 changes: 3 additions & 0 deletions man/place_details.Rd
26 changes: 15 additions & 11 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
TARGET_DIR = ./rust/target
LIBDIR = $(TARGET_DIR)/release
STATLIB = $(LIBDIR)/libarcgisplaces.a
PKG_LIBS = -L$(LIBDIR) -larcgisplaces -lssl
PKG_LIBS = -L$(LIBDIR) -larcgisplaces -lssl -lcrypto
CRAN_FLAGS=-j 2 --offline

all: C_clean

$(SHLIB): $(STATLIB)

CARGOTMP = $(CURDIR)/.cargo
VENDOR_DIR = $(CURDIR)/vendor

$(STATLIB):
# In some environments, ~/.cargo/bin might not be included in PATH, so we need
# to set it here to ensure cargo can be invoked. It is appended to PATH and
# therefore is only used if cargo is absent from the user's PATH.
if [ "$(NOT_CRAN)" != "true" ]; then \
if [ -f ./rust/vendor.tar.xz ]; then \
tar xf ./rust/vendor.tar.xz && \
mkdir -p $(CARGOTMP) && \
cp ./rust/vendor-config.toml $(CARGOTMP)/config.toml; \
fi; \
export CARGO_HOME=$(CARGOTMP); \
fi && \
export PATH="$(PATH):$(HOME)/.cargo/bin" && \
cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)
if [ "$(NOT_CRAN)" != "true" ]; then \
rm -Rf $(CARGOTMP) && \
rm -Rf $(LIBDIR)/build; \
cargo build $(CRAN_FLAGS) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR); \
rm -Rf $(CARGOTMP) $(VENDOR_DIR) $(LIBDIR)/build; \
else \
export PATH="$(PATH):$(HOME)/.cargo/bin" && \
cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR); \
fi

C_clean:
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS)
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS)

clean:
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR) $(VENDOR_DIR)
31 changes: 16 additions & 15 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -5,36 +5,37 @@ LIBDIR = $(TARGET_DIR)/$(TARGET)/release
STATLIB = $(LIBDIR)/libarcgisplaces.a
PKG_LIBS = -L$(LIBDIR) -larcgisplaces -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll -lcrypt32 -lssl -lcrypto -lsecur32

CRAN_FLAGS=-j 2 --offline

all: C_clean

$(SHLIB): $(STATLIB)

CARGOTMP = $(CURDIR)/.cargo
VENDOR_DIR = $(CURDIR)/vendor

$(STATLIB):
mkdir -p $(TARGET_DIR)/libgcc_mock
# `rustc` adds `-lgcc_eh` flags to the compiler, but Rtools' GCC doesn't have
# `libgcc_eh` due to the compilation settings. So, in order to please the
# compiler, we need to add empty `libgcc_eh` to the library search paths.
#
# For more details, please refer to
# https://github.com/r-windows/rtools-packages/blob/2407b23f1e0925bbb20a4162c963600105236318/mingw-w64-gcc/PKGBUILD#L313-L316
touch $(TARGET_DIR)/libgcc_mock/libgcc_eh.a

# CARGO_LINKER is provided in Makevars.ucrt for R >= 4.2
if [ "$(NOT_CRAN)" != "true" ]; then \
export CARGO_HOME=$(CARGOTMP); \
fi && \
if [ -f ./rust/vendor.tar.xz ]; then \
tar xf rust/vendor.tar.xz && \
mkdir -p $(CARGOTMP) && \
cp rust/vendor-config.toml $(CARGOTMP)/config.toml; \
fi; \
export CARGO_HOME=$(CARGOTMP) && \
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \
cargo build --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)
if [ "$(NOT_CRAN)" != "true" ]; then \
rm -Rf $(CARGOTMP) && \
rm -Rf $(LIBDIR)/build; \
cargo build --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR); \
rm -Rf $(CARGOTMP) $(VENDOR_DIR) $(LIBDIR)/build; \
else \
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \
cargo build --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR); \
fi

C_clean:
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS)

clean:
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR)
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR) $(VENDOR_DIR)
3 changes: 2 additions & 1 deletion src/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -18,4 +18,5 @@ extendr-api = { git = "https://github.com/extendr/extendr" }


[profile.release]
lto = true
lto = true
codegen-units = 1
1 change: 1 addition & 0 deletions src/rust/src/category_details.rs
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ use serde_esri::places::CategoryDetails;
#[extendr]
/// Parse `/categories/{categoryId}` results vectorized
/// @keywords internal
/// @noRd
fn parse_category_details(x: Strings) -> List {
x.into_iter()
.map(|xi| {
9 changes: 9 additions & 0 deletions src/rust/vendor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[source.crates-io]
replace-with = "vendored-sources"

[source."git+https://github.com/extendr/extendr"]
git = "https://github.com/extendr/extendr"
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
Binary file added src/rust/vendor.tar.xz
Binary file not shown.
7 changes: 7 additions & 0 deletions tools/gen-configs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

autoreconf -i

cp configure configure.win

sed -i '' 's|RSCRIPT="\${R_HOME}/bin/Rscript"|RSCRIPT="\${R_HOME}/bin/${R_ARCH_BIN}/Rscript.exe"|g' configure.win

0 comments on commit 261b184

Please sign in to comment.