Skip to content

Commit 33d04f4

Browse files
authored
Merge branch 'main' into vendoring
2 parents 6778095 + e350bbf commit 33d04f4

File tree

119 files changed

+8159
-3965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+8159
-3965
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ script.R
2929
^Meta$
3030
^CRAN-SUBMISSION$
3131
.vscode
32+
^\.cache$
33+
^docs$
34+
^pkgdown$

.github/workflows/R-CMD-check.yaml

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212

1313
name: R-CMD-check
1414

15+
permissions: read-all
16+
1517
jobs:
1618
R-CMD-check:
1719
runs-on: ${{ matrix.config.os }}
@@ -22,28 +24,28 @@ jobs:
2224
fail-fast: false
2325
matrix:
2426
config:
25-
- {os: macOS-latest, r: 'release'}
27+
- {os: macos-13, r: 'oldrel'}
28+
- {os: macos-latest, r: 'release'}
2629

2730
- {os: windows-latest, r: 'release'}
28-
# Use 3.6 to trigger usage of RTools35
29-
- {os: windows-latest, r: '3.6'}
31+
# use 4.1 to check with rtools40's older compiler
32+
- {os: windows-latest, r: '4.1'}
3033

3134
# Use older ubuntu to maximise backward compatibility
32-
- {os: ubuntu-20.04, r: 'devel', http-user-agent: 'release'}
33-
- {os: ubuntu-20.04, r: 'release'}
34-
- {os: ubuntu-20.04, r: 'release', custom: 'no-cpp11test'}
35-
- {os: ubuntu-20.04, r: 'release', custom: 'gcc 4.8'}
36-
- {os: ubuntu-20.04, r: 'oldrel-1'}
37-
- {os: ubuntu-20.04, r: 'oldrel-2'}
38-
- {os: ubuntu-20.04, r: 'oldrel-3'}
39-
- {os: ubuntu-20.04, r: 'oldrel-4'}
35+
- {os: ubuntu-22.04, r: 'devel', http-user-agent: 'release'}
36+
- {os: ubuntu-22.04, r: 'release'}
37+
- {os: ubuntu-22.04, r: 'release', custom: 'no-cpp11test'}
38+
- {os: ubuntu-22.04, r: 'oldrel-1'}
39+
- {os: ubuntu-22.04, r: 'oldrel-2'}
40+
- {os: ubuntu-22.04, r: 'oldrel-3'}
41+
- {os: ubuntu-22.04, r: 'oldrel-4'}
4042

4143
env:
4244
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4345
R_KEEP_PKG_SOURCE: yes
4446

4547
steps:
46-
- uses: actions/checkout@v2
48+
- uses: actions/checkout@v4
4749

4850
- uses: r-lib/actions/setup-pandoc@v2
4951

@@ -53,31 +55,14 @@ jobs:
5355
http-user-agent: ${{ matrix.config.http-user-agent }}
5456
use-public-rspm: true
5557

56-
- name : Install compiler version
57-
# We check on this old compiler specifically to support CentOS 7,
58-
# which uses this gcc version. RStudio products support CentOS 7 through
59-
# June 2024.
60-
# https://github.com/r-lib/cpp11/pull/78
61-
# https://www.rstudio.com/about/platform-support/
62-
# Ubuntu 20.04 technically dropped support for gcc 4.8, so we have to
63-
# add old archives back in manually to install it
64-
# https://github.com/r-lib/cpp11/pull/279
65-
if: matrix.config.custom == 'gcc 4.8'
66-
run: |
67-
echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" | sudo tee -a /etc/apt/sources.list
68-
echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe" | sudo tee -a /etc/apt/sources.list
69-
sudo apt update
70-
sudo apt-get install -y g++-4.8
71-
mkdir ~/.R/
72-
echo $'CXX1X=g++-4.8\nCXX11=g++-4.8\nCC=gcc-4.8 -std=c99\nCXX=g++-4.8 -std=gnu++11' >> ~/.R/Makevars
73-
7458
- name: Install macOS system dependencies
7559
if: runner.os == 'macOS'
7660
run: brew install --cask xquartz
7761

7862
- uses: r-lib/actions/setup-r-dependencies@v2
7963
with:
8064
extra-packages: any::rcmdcheck
65+
pak-version: devel
8166
needs: check
8267

8368
- name: Install cpp11test
@@ -92,6 +77,7 @@ jobs:
9277
- uses: r-lib/actions/check-r-package@v2
9378
with:
9479
upload-snapshots: true
80+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
9581

9682
- name: Run cpp11test tests
9783
if: matrix.config.custom != 'no-cpp11test'

.github/workflows/format.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ name: format_check
99

1010
jobs:
1111
format_check:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
steps:
1414
- uses: actions/checkout@v2
1515

1616
- name: Install ClangFormat
17-
run: sudo apt-get install -y clang-format-10
17+
run: sudo apt-get install -y clang-format-12
1818

1919
- name: Run ClangFormat
20-
run: make format clang_format=clang-format-10
20+
run: make format clang_format=clang-format-12
2121

2222
- name: Check for a non-empty diff
2323
run: git diff-files -U --exit-code

.github/workflows/pkgdown.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111

1212
name: pkgdown
1313

14+
permissions: read-all
15+
1416
jobs:
1517
pkgdown:
1618
runs-on: ubuntu-latest
@@ -19,8 +21,10 @@ jobs:
1921
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2022
env:
2123
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
24+
permissions:
25+
contents: write
2226
steps:
23-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2428

2529
- uses: r-lib/actions/setup-pandoc@v2
2630

@@ -41,7 +45,7 @@ jobs:
4145

4246
- name: Deploy to GitHub pages 🚀
4347
if: github.event_name != 'pull_request'
44-
uses: JamesIves/github-pages-deploy-action@4.1.4
48+
uses: JamesIves/github-pages-deploy-action@v4.5.0
4549
with:
4650
clean: false
4751
branch: gh-pages

.github/workflows/pr-commands.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66

77
name: Commands
88

9+
permissions: read-all
10+
911
jobs:
1012
document:
1113
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
@@ -14,7 +16,7 @@ jobs:
1416
env:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1618
steps:
17-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
1820

1921
- uses: r-lib/actions/pr-fetch@v2
2022
with:
@@ -51,7 +53,7 @@ jobs:
5153
env:
5254
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
5355
steps:
54-
- uses: actions/checkout@v2
56+
- uses: actions/checkout@v4
5557

5658
- uses: r-lib/actions/pr-fetch@v2
5759
with:

.github/workflows/test-coverage.yaml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,62 @@ on:
88

99
name: test-coverage
1010

11+
permissions: read-all
12+
1113
jobs:
1214
test-coverage:
1315
runs-on: ubuntu-latest
1416
env:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1618

1719
steps:
18-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
1921

2022
- uses: r-lib/actions/setup-r@v2
2123
with:
2224
use-public-rspm: true
2325

2426
- uses: r-lib/actions/setup-r-dependencies@v2
2527
with:
26-
extra-packages: any::covr
28+
extra-packages: any::covr, any::xml2
2729
needs: coverage
2830

2931
- name: Install cpp11test
3032
run: |
3133
options(warn = 2)
3234
pak::local_install_dev_deps("cpp11test", dependencies = TRUE)
35+
install.packages(".", repos = NULL, type = "source")
3336
install.packages("cpp11test", repos = NULL, INSTALL_opts = "--install-tests", type = "source")
3437
shell: Rscript {0}
3538

3639
- name: Test coverage
37-
run: covr::codecov(quiet = FALSE)
40+
run: |
41+
cov <- covr::package_coverage(
42+
quiet = FALSE,
43+
clean = FALSE,
44+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
45+
)
46+
covr::to_cobertura(cov)
3847
shell: Rscript {0}
48+
49+
- uses: codecov/codecov-action@v4
50+
with:
51+
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
52+
file: ./cobertura.xml
53+
plugin: noop
54+
disable_search: true
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
57+
- name: Show testthat output
58+
if: always()
59+
run: |
60+
## --------------------------------------------------------------------
61+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
62+
shell: bash
63+
64+
- name: Upload test results
65+
if: failure()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: coverage-test-failures
69+
path: ${{ runner.temp }}/package

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ TAGS
1818
/doc/
1919
/Meta/
2020
.vscode
21+
.cache
22+
docs

DESCRIPTION

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: cpp11
22
Title: A C++11 Interface for R's C Interface
3-
Version: 0.4.7.9000
4-
Authors@R:
3+
Version: 0.6.0.9000
4+
Authors@R:
55
c(
66
person("Davis", "Vaughan", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-4777-038X")),
77
person("Jim","Hester", role = "aut", comment = c(ORCID = "0000-0002-2739-7082")),
@@ -18,7 +18,7 @@ License: MIT + file LICENSE
1818
URL: https://cpp11.r-lib.org, https://github.com/r-lib/cpp11
1919
BugReports: https://github.com/r-lib/cpp11/issues
2020
Depends:
21-
R (>= 3.5.0)
21+
R (>= 4.0.0)
2222
Suggests:
2323
bench,
2424
brio,
@@ -31,7 +31,6 @@ Suggests:
3131
glue,
3232
knitr,
3333
lobstr,
34-
mockery,
3534
progress,
3635
rmarkdown,
3736
scales,
@@ -41,11 +40,11 @@ Suggests:
4140
utils,
4241
vctrs,
4342
withr
44-
VignetteBuilder:
43+
VignetteBuilder:
4544
knitr
4645
Config/Needs/website: tidyverse/tidytemplate
4746
Config/testthat/edition: 3
48-
Config/Needs/cpp11/cpp_register:
47+
Config/Needs/cpp11/cpp_register:
4948
brio,
5049
cli,
5150
decor,
@@ -55,4 +54,4 @@ Config/Needs/cpp11/cpp_register:
5554
vctrs
5655
Encoding: UTF-8
5756
Roxygen: list(markdown = TRUE)
58-
RoxygenNote: 7.3.1
57+
RoxygenNote: 7.3.2

MAINTENANCE.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ The state of cpp11 is pretty stable, it seems to have the features we need for m
77
### Running the cpp11test tests
88

99
Most of the test suite is in a sub-package, cpp11test.
10-
Probably the best way to run these tests is to install the development version of cpp11 and then run `devtools::test()` to run the cpp11test test suite.
10+
The best way to run these tests is to install the development version of cpp11 after any change, and then run `devtools::test("./cpp11test")`.
11+
Precisely, this looks like:
12+
13+
```r
14+
# Install dev cpp11, clean the cpp11test dll manually since it thinks nothing
15+
# has changed, then recompile and run its tests.
16+
devtools::install()
17+
devtools::clean_dll("./cpp11test")
18+
devtools::test("./cpp11test")
19+
```
1120

1221
If tests failures occur the output from Catch isn't always easy to interpret.
1322
I have a branch of testthat https://github.com/jimhester/testthat/tree/catch-detailed-output that should make things easier to understand.
@@ -17,28 +26,41 @@ In addition getting a debugger to catch when errors happen can be fiddly when ru
1726

1827
The GitHub Actions workflow has some additional logic to handle running the cpp11 tests https://github.com/r-lib/cpp11/blob/fd8ef97d006db847f7f17166cf52e1e0383b2d35/.github/workflows/R-CMD-check.yaml#L95-L102, https://github.com/r-lib/cpp11/blob/fd8ef97d006db847f7f17166cf52e1e0383b2d35/.github/workflows/R-CMD-check.yaml#L117-L124.
1928

20-
### False positive URL checks for git repositories in the vignettes
29+
## Ensure you use `Sys.setenv("CPP11_EVAL" = "true"); devtools::submit_cran()` when submitting.
30+
31+
If you forget to set `CPP_EVAL = "true"` then the vignette chunks will not run properly and the vignettes will not be rendered properly.
32+
33+
## Regenerating benchmark objects used in `motivations.Rmd`
2134

22-
If you run `urlchecker::url_check()` on the repo you will see the following false positives.
35+
If you need to regenerate the benchmark objects (RDS objects) utilized in `motivations.Rmd`, then you should set `Sys.setenv("CPP11TEST_SHOULD_RUN_BENCHMARKS" = "TRUE")` before running the Rmd. You'll also need to make sure that cpp11test is actually installed. See `cpp11test:::should_run_benchmarks()` for more.
36+
37+
## Usage with clangd
38+
39+
Since cpp11 is header only, if you use clangd you'll have a bit of an issue because tools like bear and pkgload won't know how to generate the `compile_commands.json` file. Instead, you can create it manually with something like this, which seems to work well. Note that the paths are specific to your computer.
2340

2441
```
25-
! Warning: vignettes/motivations.Rmd:363:11 Moved
26-
git clone https://github.com/r-lib/cpp11.git
27-
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28-
https://github.com/r-lib/cpp11
29-
! Warning: vignettes/motivations.Rmd:354:11 Moved
30-
git clone https://github.com/RcppCore/Rcpp.git
31-
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32-
https://github.com/RcppCore/Rcpp
33-
>
42+
[
43+
{
44+
"command": "g++ -std=gnu++11 -I\"/Users/davis/files/r/packages/cpp11/inst/include\" -I\"/Library/Frameworks/R.framework/Resources/include\" -I\"/Users/davis/Library/R/arm64/4.4/library/Rcpp/include\" -I\"/Users/davis/Library/R/arm64/4.4/library/testthat/include\" -I\"/opt/homebrew/include\" -Wall -pedantic",
45+
"file": "R.hpp",
46+
"directory": "/Users/davis/files/r/packages/cpp11/inst/include/cpp11"
47+
}
48+
]
3449
```
3550

36-
These only happen with the urlchecker package, they can be safely ignored and the real CRAN checks will not show them.
51+
Key notes:
3752

53+
- Only doing this for `R.hpp` seems to be enough. I imagine this could be any of the header files, but it is reasonable to pick the "root" one that pretty much all others include.
54+
- Using `-std=gnu++11` to keep us honest about only C++11 features.
55+
- Using `-I\"/Library/Frameworks/R.framework/Resources/include\"` for access to the R headers.
56+
- Using `-I\"/Users/davis/files/r/packages/cpp11/inst/include\"` as a "self include", which seems to be the key to the whole thing.
3857

39-
### Ensure you use `Sys.setenv("CPP11_EVAL" = "true"); devtools::submit_cran()` when submitting.
58+
If you are modifying any tests or benchmarks, you also need:
4059

41-
If you forget to set `CPP_EVAL = "true"` then the vignette chunks will not run properly and the vignettes will not be rendered properly.
60+
- `-I\"/Users/davis/Library/R/arm64/4.4/library/Rcpp/include\"` for Rcpp headers.
61+
- `-I\"/Users/davis/Library/R/arm64/4.4/library/testthat/include\"` for testthat headers related to Catch tests.
62+
63+
Note that this is specific to a path on your machine and the R version you are currently working with.
4264

4365
## Future directions
4466

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export(cpp_eval)
44
export(cpp_function)
55
export(cpp_register)
66
export(cpp_source)
7+
export(cpp_unvendor)
78
export(cpp_vendor)

0 commit comments

Comments
 (0)