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

follow @jennybc advice #1945

Merged
merged 11 commits into from
Jul 25, 2024
Merged

follow @jennybc advice #1945

merged 11 commits into from
Jul 25, 2024

Conversation

pachadotdev
Copy link
Contributor

this is a new version of #1921

@jennybc I took some time to type with 1 hand and I used the logic you proposed here #1921 (comment)

R/cpp11.R Outdated Show resolved Hide resolved
R/cpp11.R Outdated
Comment on lines 27 to 30
roxygen_ns_append(
sprintf("@useDynLib %s, .registration = TRUE", project_name())
) && roxygen_remind()

Copy link
Member

Choose a reason for hiding this comment

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

It appears that use_src() does exactly this already? Can you help me understand why use_cpp11() needs to do that again?

usethis/R/rcpp.R

Lines 74 to 75 in 93f4410

roxygen_ns_append(glue("@useDynLib {project_name()}, .registration = TRUE")) &&
roxygen_remind()

Comment on lines 8 to 16
skip_if_not_installed("cpp11")

create_local_package()
use_roxygen_md()
use_package_doc()

local_interactive(FALSE)
local_check_installed()
local_mocked_bindings(check_cpp_register_deps = function() invisible())

Copy link
Member

Choose a reason for hiding this comment

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

In terms of skips and mocks, I would expect this to look very much like the same test for use_rcpp():

test_that("use_rcpp() creates files/dirs, edits DESCRIPTION and .gitignore", {
create_local_package()
use_roxygen_md()
# pretend Rcpp is installed
local_check_installed()
use_rcpp("test")
expect_match(desc::desc_get("LinkingTo"), "Rcpp")
expect_match(desc::desc_get("Imports"), "Rcpp")
expect_proj_dir("src")
expect_proj_file("src", "test.cpp")
ignores <- read_utf8(proj_path("src", ".gitignore"))
expect_true(all(c("*.o", "*.so", "*.dll") %in% ignores))
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it to reflect this. The test "use_rcpp_armadillo() creates Makevars..." is something I can implement later for cpp11armadillo.

@jennybc
Copy link
Member

jennybc commented Jul 25, 2024

Whew, we got there!

@jennybc jennybc merged commit cc4d09c into r-lib:main Jul 25, 2024
12 checks passed
@pachadotdev pachadotdev deleted the cpp11_2 branch July 26, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants