Skip to content

Commit 7df902a

Browse files
committed
use rhub
1 parent ca32b96 commit 7df902a

File tree

11 files changed

+125
-39
lines changed

11 files changed

+125
-39
lines changed

.github/workflows/rhub.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
2+
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
3+
# You can update this file to a newer version using the rhub2 package:
4+
#
5+
# rhub::rhub_setup()
6+
#
7+
# It is unlikely that you need to modify this file manually.
8+
9+
name: R-hub
10+
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"
11+
12+
on:
13+
workflow_dispatch:
14+
inputs:
15+
config:
16+
description: 'A comma separated list of R-hub platforms to use.'
17+
type: string
18+
default: 'linux,windows,macos'
19+
name:
20+
description: 'Run name. You can leave this empty now.'
21+
type: string
22+
id:
23+
description: 'Unique ID. You can leave this empty now.'
24+
type: string
25+
26+
jobs:
27+
28+
setup:
29+
runs-on: ubuntu-latest
30+
outputs:
31+
containers: ${{ steps.rhub-setup.outputs.containers }}
32+
platforms: ${{ steps.rhub-setup.outputs.platforms }}
33+
34+
steps:
35+
# NO NEED TO CHECKOUT HERE
36+
- uses: r-hub/actions/setup@v1
37+
with:
38+
config: ${{ github.event.inputs.config }}
39+
id: rhub-setup
40+
41+
linux-containers:
42+
needs: setup
43+
if: ${{ needs.setup.outputs.containers != '[]' }}
44+
runs-on: ubuntu-latest
45+
name: ${{ matrix.config.label }}
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
config: ${{ fromJson(needs.setup.outputs.containers) }}
50+
container:
51+
image: ${{ matrix.config.container }}
52+
53+
steps:
54+
- uses: r-hub/actions/checkout@v1
55+
- uses: r-hub/actions/platform-info@v1
56+
with:
57+
token: ${{ secrets.RHUB_TOKEN }}
58+
job-config: ${{ matrix.config.job-config }}
59+
- uses: r-hub/actions/setup-deps@v1
60+
with:
61+
token: ${{ secrets.RHUB_TOKEN }}
62+
job-config: ${{ matrix.config.job-config }}
63+
- uses: r-hub/actions/run-check@v1
64+
with:
65+
token: ${{ secrets.RHUB_TOKEN }}
66+
job-config: ${{ matrix.config.job-config }}
67+
68+
other-platforms:
69+
needs: setup
70+
if: ${{ needs.setup.outputs.platforms != '[]' }}
71+
runs-on: ${{ matrix.config.os }}
72+
name: ${{ matrix.config.label }}
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
config: ${{ fromJson(needs.setup.outputs.platforms) }}
77+
78+
steps:
79+
- uses: r-hub/actions/checkout@v1
80+
- uses: r-hub/actions/setup-r@v1
81+
with:
82+
job-config: ${{ matrix.config.job-config }}
83+
token: ${{ secrets.RHUB_TOKEN }}
84+
- uses: r-hub/actions/platform-info@v1
85+
with:
86+
token: ${{ secrets.RHUB_TOKEN }}
87+
job-config: ${{ matrix.config.job-config }}
88+
- uses: r-hub/actions/setup-deps@v1
89+
with:
90+
job-config: ${{ matrix.config.job-config }}
91+
token: ${{ secrets.RHUB_TOKEN }}
92+
- uses: r-hub/actions/run-check@v1
93+
with:
94+
job-config: ${{ matrix.config.job-config }}
95+
token: ${{ secrets.RHUB_TOKEN }}

DESCRIPTION

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
Package: cpp4r
2-
Title: Header-Only C++ and R Interface
3-
Version: 0.2.0
2+
Title: Header-Only 'C++' and 'R' Interface
3+
Version: 0.3.0
44
Authors@R: c(
55
person("Mauricio", "Vargas Sepulveda", , "[email protected]", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-1017-7574")),
77
person(, "Posit Software, PBC", role = "aut",
88
comment = "Original cpp11 package")
99
)
10-
Description: Provides a header only, C++ interface to R's C API with enhancements over 'cpp11'. Enforces copy-on-write
11-
semantics consistent with R's behavior. Offers improved safety when interfacing with R's C API, native support for
12-
ALTREP objects, UTF-8 string handling throughout, modern C++11 features and idioms, and faster compilation with
13-
reduced memory requirements. Avoids Application Binary Interface (ABI) compatibility issues by being header-only and
14-
allows for headers vendoring, making it useful for restricted environments. Compared to 'cpp11', it provides support
15-
for converting C++ maps to R lists, Roxygen documentation directly in C++ code, proper handling of matrix
16-
attributes, support for nullable external pointers, bidirectional copy of complex number types, flexibility in type
17-
conversions, use of nullable pointers, and various performance optimizations.
10+
Description: Provides a header only, 'C++' interface to 'R' with enhancements over 'cpp11'. Enforces copy-on-write
11+
semantics consistent with 'R' behavior. Offers native support for ALTREP objects, 'UTF-8' string handling, modern
12+
'C++11' features and idioms, and reduced memory requirements. Allows for vendoring, making it useful for restricted
13+
environments. Compared to 'cpp11', it adds support for converting 'C++' maps to 'R' lists, 'Roxygen' documentation
14+
directly in 'C++' code, proper handling of matrix attributes, support for nullable external pointers, bidirectional
15+
copy of complex number types, flexibility in type conversions, use of nullable pointers, and various performance
16+
optimizations.
1817
License: Apache License (>= 2)
1918
URL: https://cpp4r.org, https://github.com/pachadotdev/cpp4r
2019
BugReports: https://github.com/pachadotdev/cpp4r/issues

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Added `as_logicals()` and `as_strings()` in the same style of `as_doubles()` and `as_integers()`
44
* Improved memory management for `r_vector` iterators
55
* Slightly faster than `cpp11`
6+
* `vendor()` and `unvendor()` use `path = NULL` as default to adhere to CRAN policies.
67

78
# cpp4r 0.2.0
89

R/register.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#'
1010
#' In order to use `register()` the `cli`, `decor`, `desc`, `glue`,
1111
#' `tibble` and `vctrs` packages must also be installed.
12-
#' @param path The path to the package root directory
12+
#' @param path The path to the package root directory. The default is \code{NULL},
1313
#' @param quiet If `TRUE` suppresses output from this function
1414
#' @param extension The file extension to use for the generated src/cpp4r file.
1515
#' `.cpp` by default, but `.cc` is also supported.
@@ -36,7 +36,9 @@
3636
#'
3737
#' # cleanup
3838
#' unlink(dir, recursive = TRUE)
39-
register <- function(path = ".", quiet = !is_interactive(), extension = c(".cpp", ".cc")) {
39+
register <- function(path = NULL, quiet = !is_interactive(), extension = c(".cpp", ".cc")) {
40+
stopifnot(!is.null(path), dir.exists(path))
41+
4042
stop_unless_installed(get_register_needs())
4143
extension <- match.arg(extension)
4244

R/unvendor.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
#' This function removes the vendored cpp4r headers from your package by
44
#' automatically finding the vendored headers.
55
#'
6-
#' @param path The directory with the vendored headers
6+
#' @param path The directory with the vendored headers. It is recommended to use \code{"./src/vendor"}.
7+
#' The default is \code{NULL}.
78
#' @return The path to the unvendored code (invisibly).
89
#' @export
910
#' @examples
@@ -19,7 +20,9 @@
1920
#'
2021
#' # cleanup
2122
#' unlink(dir, recursive = TRUE)
22-
unvendor <- function(path = "./src/vendor") {
23+
unvendor <- function(path = NULL) {
24+
stopifnot(!is.null(path), dir.exists(path))
25+
2326
# Check if the cpp4r directory exists
2427
cpp4r_dir <- file.path(path, "cpp4r")
2528
cpp4r_hpp_path <- file.path(path, "cpp4r.hpp")

cran-comments.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
Dear CRAN Team:
22

3-
I have fixed these noted in your last email:
3+
I have fixed the notes in your last email.
44

5-
Possibly misspelled words in DESCRIPTION:
6-
ABI (19:71)
7-
ALTREP (18:5)
8-
Roxygen (21:41)
9-
nullable (22:29, 23:25)
10-
vendoring (20:24)
11-
12-
Found the following (possibly) invalid URLs:
13-
URL: https://cpp4r.org/articles/00-motivations.html#vendoring
14-
From: README.md
15-
Status: 404
16-
Message: Not Found
17-
URL: https://cpp4r.org/articles/14-internals.html
18-
From: README.md
19-
Status: 404
20-
Message: Not Found
5+
Change: `vendor()` and `unvendor()` use `path = NULL` as default to adhere to CRAN policies.
216

227
Best,
238
MVS

man/cpp4r-package.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/register.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/unvendor.Rd

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-register.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ bar <- function(baz) {
520520

521521
describe("register", {
522522
it("returns an invisible empty character if there are no decorations", {
523-
f <- tempfile()
523+
f <- tempdir()
524524
expect_equal(register(f), character())
525525

526526
dir.create(f)

0 commit comments

Comments
 (0)