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

fix: ensure report rustc version while installation process #305

Merged
merged 4 commits into from
Sep 16, 2024
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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ License: MIT + file LICENSE
Language: en-US
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
SystemRequirements: Cargo (Rust's package manager), rustc
VignetteBuilder: knitr
Config/testthat/edition: 3
Expand Down
8 changes: 4 additions & 4 deletions LICENSE.note
Original file line number Diff line number Diff line change
Expand Up @@ -484,31 +484,31 @@ License: Apache-2.0 OR BSL-1.0
-------------------------------------------------------------

Name: savvy
Version: 0.6.3
Version: 0.6.4
Repository: https://github.com/yutannihilation/savvy/
Authors: Hiroaki Yutani
License: MIT

-------------------------------------------------------------

Name: savvy-bindgen
Version: 0.6.3
Version: 0.6.4
Repository: https://github.com/yutannihilation/savvy/
Authors: Hiroaki Yutani
License: MIT

-------------------------------------------------------------

Name: savvy-ffi
Version: 0.6.3
Version: 0.6.4
Repository: https://github.com/yutannihilation/savvy/
Authors: Hiroaki Yutani
License: MIT

-------------------------------------------------------------

Name: savvy-macro
Version: 0.6.3
Version: 0.6.4
Repository: https://github.com/yutannihilation/savvy/
Authors: Hiroaki Yutani
License: MIT
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# prqlr (development version)

## Bug fixes

- Fix to report rustc version even if installing with pre-built binaries. (#305)

## Miscellaneous

- On R-universe, installing with pre-built binaries is now default. (#305)

# prqlr 0.8.1

Just dependency updates. No user-facing changes.
Expand Down
24 changes: 14 additions & 10 deletions R/000-wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ NULL

# Check class and extract the external pointer embedded in the environment
.savvy_extract_ptr <- function(e, class) {
if(is.null(e)) {
return(NULL)
}

if(inherits(e, class)) {
e$.ptr
} else {
Expand All @@ -26,29 +30,29 @@ NULL
#' @param signature_comment a logical flag. Whether to add a signature comment to the output SQL query.
#' @return a list contains a SQL string or an error message.
#' @noRd
compile <- function(prql_query, target, format, signature_comment) {
.Call(savvy_compile__impl, prql_query, target, format, signature_comment)
`compile` <- function(`prql_query`, `target`, `format`, `signature_comment`) {
.Call(savvy_compile__impl, `prql_query`, `target`, `format`, `signature_comment`)
}

#' @noRd
prql_to_pl <- function(prql_query) {
.Call(savvy_prql_to_pl__impl, prql_query)
`prql_to_pl` <- function(`prql_query`) {
.Call(savvy_prql_to_pl__impl, `prql_query`)
}

#' @noRd
pl_to_rq <- function(pl_json) {
.Call(savvy_pl_to_rq__impl, pl_json)
`pl_to_rq` <- function(`pl_json`) {
.Call(savvy_pl_to_rq__impl, `pl_json`)
}

#' @noRd
rq_to_sql <- function(rq_json) {
.Call(savvy_rq_to_sql__impl, rq_json)
`rq_to_sql` <- function(`rq_json`) {
.Call(savvy_rq_to_sql__impl, `rq_json`)
}

#' @title prqlc's version
#' @return a prqlc's version string
#' @noRd
compiler_version <- function() {
`compiler_version` <- function() {
.Call(savvy_compiler_version__impl)
}

Expand All @@ -58,7 +62,7 @@ compiler_version <- function() {
#' @examples
#' prql_get_targets()
#' @export
prql_get_targets <- function() {
`prql_get_targets` <- function() {
.Call(savvy_prql_get_targets__impl)
}

Expand Down
24 changes: 22 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
NOT_CRAN=${NOT_CRAN:-"false"}
LIBPRQLR_BUILD=${LIBPRQLR_BUILD:-""}

# Detect if this is on R-universe.
MY_UNIVERSE=${MY_UNIVERSE:-""}

LIBNAME="libprqlr.a"
LIBPRQLR_DEFAULT_PATH="$(pwd)/tools/${LIBNAME}"
LIBPRQLR_PATH=${LIBPRQLR_PATH:-${LIBPRQLR_DEFAULT_PATH}}
Expand Down Expand Up @@ -39,18 +42,31 @@ check_bin_lib() {
LIBPRQLR_BUILD="false"
fi

# On R-universe, we try to download the pre-built binary from GitHub releases.
if [ -n "${MY_UNIVERSE}" ] && [ -z "${LIBPRQLR_BUILD}" ]; then
echo ""
echo "--------------------- [SETTING FOR R-UNIVERSE] ---------------------"
echo "It seems that this is on R-universe <${MY_UNIVERSE}>."
echo "Trying to download pre-built binary."
echo "--------------------------------------------------------------------"
echo ""
LIBPRQLR_BUILD="false"
fi

if [ "${LIBPRQLR_BUILD}" = "false" ] && [ -f "tools/lib-sums.tsv" ] && [ ! -f "${LIBPRQLR_PATH}" ]; then
echo ""
echo "--------------- [TRY TO DOWNLOAD PRE-BUILT BINARY] ---------------"
"${R_HOME}/bin${R_ARCH_BIN}/Rscript" "tools/prep-lib.R" || echo "Failed to download pre-built binary."
echo "--------------------------------------------------------------------"
echo "------------------------------------------------------------------"
echo ""
fi

if [ "${LIBPRQLR_BUILD}" = "false" ] && [ -f "${LIBPRQLR_PATH}" ]; then
echo ""
echo "---------------------- [LIBRARY BINARY FOUND] ----------------------"
echo "The library was found at <${LIBPRQLR_PATH}>. No need to build it."
echo ""
echo "Note: rustc version: $(rustc -V || echo 'Not found')"
echo "--------------------------------------------------------------------"
echo ""
sed -e "s|@RUST_TARGET@||" src/Makevars.in >src/Makevars
Expand All @@ -70,6 +86,8 @@ check_bin_lib() {
echo "The library was not found at <${LIBPRQLR_PATH}>,"
echo "but was found at <${LIBPRQLR_DEFAULT_PATH}>."
echo "No need to build it."
echo ""
echo "Note: rustc version: $(rustc -V || echo 'Not found')"
echo "--------------------------------------------------------------------"
echo ""
sed -e "s|@RUST_TARGET@||" src/Makevars.in >src/Makevars
Expand Down Expand Up @@ -114,6 +132,8 @@ else
fi

RUST_TARGET="${TARGET:-${HOST_TRIPLE}}"
sed -e "s|@RUST_TARGET@|${RUST_TARGET}|" src/Makevars.in >src/Makevars
sed \
-e "s|@RUST_TARGET@|${RUST_TARGET}|" \
src/Makevars.in >src/Makevars

exit 0
2 changes: 1 addition & 1 deletion inst/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Owners of dependent Rust crates. This list is generated from Crates.io Data <htt
- object: Nick Fitzgerald <https://github.com/fitzgen>, Philip Craig <https://github.com/philipc>
- once_cell: Alex Kladov <https://github.com/matklad>, Michal 'vorner' Vaner <https://github.com/vorner>
- proc-macro2: David Tolnay <https://github.com/dtolnay>
- prqlc: Maximilian Roos <https://github.com/max-sixty>
- prqlc: Maximilian Roos <https://github.com/max-sixty>, Aljaž Mur Eržen <https://github.com/aljazerzen>
- prqlc-ast: Maximilian Roos <https://github.com/max-sixty>
- prqlc-parser: Maximilian Roos <https://github.com/max-sixty>
- psm: Simonas Kazlauskas <https://github.com/nagisa>
Expand Down
16 changes: 8 additions & 8 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ SEXP handle_result(SEXP res_) {
return (SEXP)res;
}

SEXP savvy_compile__impl(SEXP prql_query, SEXP target, SEXP format, SEXP signature_comment) {
SEXP res = savvy_compile__ffi(prql_query, target, format, signature_comment);
SEXP savvy_compile__impl(SEXP c_arg__prql_query, SEXP c_arg__target, SEXP c_arg__format, SEXP c_arg__signature_comment) {
SEXP res = savvy_compile__ffi(c_arg__prql_query, c_arg__target, c_arg__format, c_arg__signature_comment);
return handle_result(res);
}

SEXP savvy_prql_to_pl__impl(SEXP prql_query) {
SEXP res = savvy_prql_to_pl__ffi(prql_query);
SEXP savvy_prql_to_pl__impl(SEXP c_arg__prql_query) {
SEXP res = savvy_prql_to_pl__ffi(c_arg__prql_query);
return handle_result(res);
}

SEXP savvy_pl_to_rq__impl(SEXP pl_json) {
SEXP res = savvy_pl_to_rq__ffi(pl_json);
SEXP savvy_pl_to_rq__impl(SEXP c_arg__pl_json) {
SEXP res = savvy_pl_to_rq__ffi(c_arg__pl_json);
return handle_result(res);
}

SEXP savvy_rq_to_sql__impl(SEXP rq_json) {
SEXP res = savvy_rq_to_sql__ffi(rq_json);
SEXP savvy_rq_to_sql__impl(SEXP c_arg__rq_json) {
SEXP res = savvy_rq_to_sql__ffi(c_arg__rq_json);
return handle_result(res);
}

Expand Down
8 changes: 4 additions & 4 deletions src/rust/api.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SEXP savvy_compile__ffi(SEXP prql_query, SEXP target, SEXP format, SEXP signature_comment);
SEXP savvy_prql_to_pl__ffi(SEXP prql_query);
SEXP savvy_pl_to_rq__ffi(SEXP pl_json);
SEXP savvy_rq_to_sql__ffi(SEXP rq_json);
SEXP savvy_compile__ffi(SEXP c_arg__prql_query, SEXP c_arg__target, SEXP c_arg__format, SEXP c_arg__signature_comment);
SEXP savvy_prql_to_pl__ffi(SEXP c_arg__prql_query);
SEXP savvy_pl_to_rq__ffi(SEXP c_arg__pl_json);
SEXP savvy_rq_to_sql__ffi(SEXP c_arg__rq_json);
SEXP savvy_compiler_version__ffi(void);
SEXP savvy_prql_get_targets__ffi(void);
Loading