-
Notifications
You must be signed in to change notification settings - Fork 28
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
Address R CMD check _abort
WARNING
#419
base: main
Are you sure you want to change the base?
Conversation
…ould be good? git push
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting on major changes / additions for context
publish = FALSE, | ||
version = "0.1.0", | ||
edition = edition, | ||
`rust-version` = "1.65" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explicitly specifies the msrv for extendr to ensure that a version 4 cargo.lock file isn't generated.
use_rextendr_template( | ||
"config.R", | ||
save_as = file.path("tools", "config.R"), | ||
quiet = quiet, | ||
overwrite = overwrite | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the config.R
is used instead of a configure.win
and configure
file. Making it easier to maintain (plus its R which is just nicer to use imo).
@@ -198,6 +215,9 @@ use_extendr <- function(path = ".", | |||
Sys.chmod("configure", "0755") | |||
} | |||
|
|||
# Set the minimum version of R to 4.2 which is 64 bit | |||
usethis::use_package("R", "Depends", "4.2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the minimum supported version of R in extendr explicitly.
usethis::use_build_ignore( | ||
file.path("src", "rust", "target") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure no accidental incorporation of target files into a bundle. Has no effect other than preventing it from being included in the final tarball
@@ -1,9 +1,11 @@ | |||
TARGET_DIR = ./rust/target | |||
LIBDIR = $(TARGET_DIR)/release | |||
LIBDIR = $(TARGET_DIR)/@LIBDIR@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is used to permit debug / release builds based on the DEBUG
env var
STATLIB = $(LIBDIR)/lib{{{lib_name}}}.a | ||
PKG_LIBS = -L$(LIBDIR) -l{{{lib_name}}} | ||
|
||
all: C_clean | ||
all: $(SHLIB) rust_clean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used to clean up target and vendor directory which is the main resolution for the new WARNING
all: C_clean | ||
all: $(SHLIB) rust_clean | ||
|
||
.PHONY: $(STATLIB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensures that the .so / .dll is always updated when being compiled e.g. register_extendr(compile = TRUE)
@@ -32,13 +34,13 @@ $(STATLIB): | |||
|
|||
export CARGO_HOME=$(CARGOTMP) && \ | |||
export PATH="$(PATH):$(HOME)/.cargo/bin" && \ | |||
RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) | |||
RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --lib @PROFILE@ --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) | |||
|
|||
# Always clean up CARGOTMP | |||
rm -Rf $(CARGOTMP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PROFILE@
is used to match the DEBUG
env var
C_clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) | ||
rust_clean: | ||
rm -Rf $(CARGOTMP) $(VENDOR_DIR) @CLEAN_TARGET@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CLEAN_TARGET@
is based on the DEBUG
env var so that we do not clean the target directory in a debug build and permit incremental compilation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I trust in you and green checkmarks
R 4.5 a new check was introduces that identifies undesirable C function calls
https://github.com/r-devel/r-svn/blob/5695e158124051562158767089a55de80e7da452/src/library/tools/R/check.R#L3953-L3971
This has affected 24 packages on CRAN a good number of which use extendr.
Inspiration was taken from https://github.com/r-rust/hellorust/blob/9a3ab01fd7ce6b3e5ee24d5af5e8ca3b28abd71f/src/Makevars#L7
closes #418
sneaks in a resolution and closes #375