Skip to content

Teach cpp_source() how to source multiple files - #492

Merged
DavisVaughan merged 3 commits into
mainfrom
feature/source-multiple
May 5, 2026
Merged

DavisVaughan merged 3 commits into
mainfrom
feature/source-multiple

Conversation

@DavisVaughan

@DavisVaughan DavisVaughan commented May 5, 2026

Copy link
Copy Markdown
Member

Needed for a particular upcoming test, not necessarily as an endorsed feature, because generally you should just create a package if you need >1 files

@DavisVaughan
DavisVaughan merged commit 4a133ee into main May 5, 2026
@DavisVaughan
DavisVaughan deleted the feature/source-multiple branch May 5, 2026 14:19
krlmlr added a commit to krlmlr/cpp11 that referenced this pull request Sep 12, 2026
Upstream implemented the feature itself in r-lib#493's sibling
r-lib#492, so the conflict resolves to removing this patch.

This branch vectorized `cpp_source()`'s `file` argument:
`all(file.exists(file))` instead of `file.exists(file)`,
`vapply(file, generate_cpp_name, ...)` instead of one name,
and a shared-library name derived from the first file
rather than the last.

r-lib#492 teaches `cpp_source()` to source multiple files
outright, and covers each of those points:
it checks `all(file.exists(file))` and reports the first missing path,
maps `generate_cpp_name()` over `file` with `vcapply()`,
and derives the library name from `generate_package_name()`,
which sidesteps the naming problem this patch worked around.
It also adds fixtures and a test, which this patch never had.

Davis Vaughan closed the upstream pull request carrying this patch,
r-lib#337, with "Closed via r-lib#492 for a similar debugging use case".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K8MneV8KqHYUuC8fWV3X5Q
krlmlr added a commit to krlmlr/cpp11 that referenced this pull request Sep 12, 2026
Three files conflicted,
and only one of them belongs to this branch.

`R/source.R` and `inst/include/cpp11/protect.hpp` conflicted because
this branch was cut from an older integration branch
and carries five squash commits belonging to other patches.
Those are resolved to upstream's version:
they are not this patch's to carry,
and both of the patches behind them are themselves superseded
(r-lib#492 and r-lib#493).

`R/vendor.R` is the real conflict.
Upstream reformatted `cpp_vendor()` with Air,
so the `date` and `overwrite` arguments are re-applied
on top of that new shape rather than reverting it.

`man/cpp_vendor.Rd` and the roxygen block gain the two `@param`
entries the original patch never wrote.
Without them `R CMD check` reports undocumented arguments,
so the branch could not have passed a check as it stood.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K8MneV8KqHYUuC8fWV3X5Q
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.

1 participant