chore: remove orphaned vendor-crates.R from cross-package fixtures (#198)#207
Open
chore: remove orphaned vendor-crates.R from cross-package fixtures (#198)#207
Conversation
…mplates (#198) Closes #198. Closes #36. The cross-package test fixtures (`tests/cross-package/producer.pkg` and `tests/cross-package/consumer.pkg`) carried an out-of-date build plumbing layout that predated cargo-revendor: custom `configure.ac`, minimal `Makevars.in` without cdylib wrapper generation, hand-written `tools/vendor-crates.R`. This made them a misleading reference for anyone browsing the repo to see what a miniextendr package looks like today. Replace the scaffolding by running the relevant `minirextendr::use_miniextendr_*` functions on each fixture, which regenerates files from the canonical rpkg templates: - `configure.ac`, `configure.win`, `configure.ucrt` - `Makevars.in` (adds cdylib wrapper-generation target) - `bootstrap.R`, `cleanup`, `cleanup.win`, `cleanup.ucrt` - `inst/include/mx_abi.h` - `src/rust/cargo-config.toml.in`, `src/rust/build.rs` - `tools/config.guess`, `tools/config.sub` - `src/cdylib-exports.def`, `src/stub.c`, `src/<pkg>-win.def` Also removes the now-orphaned `tools/vendor-crates.R` from both fixtures (it was never invoked — configure.ac had no reference to it) and the matching fallback branch in `minirextendr/R/vendor.R` that tried to invoke the script in scaffolded packages. No template generates `vendor-crates.R` anymore. R wrappers are now generated at build time by the Makevars rule (consistent with rpkg). Old dash-variant filenames (`producer-pkg-wrappers.R`, `consumer-pkg-wrappers.R`) are renamed to dot-variant (`producer.pkg-wrappers.R`, `consumer.pkg-wrappers.R`) to match the template's `@PACKAGE_NAME@-wrappers.R` substitution. Man pages regenerated via `roxygen2::roxygenise()` to point at the new filenames. `tests/cross-package/justfile` updated accordingly. `shared-traits/Cargo.toml` picks up a stray `version = "*"` on its `miniextendr-api` path dep — this is a `cargo vendor` normalization side effect (required when a local path dep has no version spec), committed as-is since it's semantically equivalent. Verified: - `just cross-install` clean - `just cross-test` → 249 pass / 0 fail (baseline preserved) - `just minirextendr-test` → 402 pass / 0 fail - `just fmt`, `just clippy`, CI clippy_default + clippy_all clean #36 was the original bug report about parse_tree_packages mishandling git-URL lines in the orphan script; closing since the buggy code is gone. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f71c0e2 to
bc64973
Compare
…s generic not method
The S3 codegen in `miniextendr_impl/s3_class.rs` emitted a bare `#' @export`
above the generic's `if (!exists("foo", mode = "function")) { ... }` block.
roxygen2 can't introspect conditionally-declared functions, so the `@export`
floated down to the next parseable function — the S3 method — producing
`export(foo.Bar)` in NAMESPACE instead of `export(foo)`. The method block
already carries `@method foo Bar` which correctly produces `S3method(foo,
Bar)`, so the misattached export is redundant and, worse, wrong.
This surfaced in the cross-package CI job: `s3point_x(returned_s3)` failed
with "could not find function" because the generic was never exported.
rpkg's own tests never call these generics externally, so the bug hid
until the rescaffolded cross-package fixtures regenerated wrappers from
the current cdylib.
Fix: emit `#' @export <generic_name>` with an explicit target on the
generic block. Regenerates NAMESPACEs accordingly.
Also adds two minirextendr fixes that surfaced while testing
`upgrade_miniextendr_package()` on real projects:
- `use_template()` now deletes the existing target before rewriting.
`usethis::use_template()` silently skips when the target exists in
non-interactive mode, which made `upgrade_miniextendr_package()`
effectively a no-op for most scaffolded files.
- `use_miniextendr_configure_win()` now chmods `configure.win` /
`configure.ucrt` to 755 after writing. Template files aren't marked
executable, and R expects these scripts to run.
Also fixes a pre-existing double-cd bug in
`tests/cross-package/justfile` document-producer/consumer recipes where
two sequential `cd <pkg>` lines within a bash shebang recipe tried to
cd into `<pkg>/<pkg>`. And passes `keep_source=TRUE` to
`devtools::install()` so `roxygen2::roxygenise(load_code=load_installed)`
can extract R6 method source references.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #198. Closes #36.
Summary
tests/cross-package/producer.pkgandtests/cross-package/consumer.pkgfrom current minirextendr templates:configure.ac,configure.win,configure.ucrt,Makevars.in(now auto-generates R wrappers via cdylib),bootstrap.R,cleanup*,inst/include/mx_abi.h,src/rust/cargo-config.toml.in,src/rust/build.rs,tools/config.{guess,sub},src/cdylib-exports.def,src/stub.c,src/<pkg>-win.def.tools/vendor-crates.Rfrom both fixtures and the matching fallback branch inminirextendr/R/vendor.R. No template generates that script anymore.producer-pkg-wrappers.R) to dot-variant (producer.pkg-wrappers.R) to match the template's@PACKAGE_NAME@-wrappers.Rsubstitution. Updated the cross-package justfile and regenerated man pages.miniextendr-macros/src/miniextendr_impl/s3_class.rs). The generic block's@exportlost its target because roxygen2 can't introspectif (!exists(...)), so the export drifted to the method and producedexport(foo.Bar)instead ofexport(foo). This is what broke the cross-package CI run —s3point_x(returned_s3)couldn't be found because the generic was never exported. Added explicit@export <generic_name>. rpkg's own tests didn't catch this because they never call the bare generic.upgrade_miniextendr_package()to actually overwrite:usethis::use_template()silently skips when targets exist in non-interactive mode, so upgrade was a no-op.minirextendr::use_template()now deletes first. Also chmod 755 onconfigure.win/configure.ucrtafter write (template files aren't marked executable).tests/cross-package/justfiledocument-* recipes (two sequentialcd <pkg>lines in a single bash shebang script tried to cd into<pkg>/<pkg>). Also addedkeep_source=TRUEso R6 methods have the source refs roxygen2 needs.Test plan
just cross-installcleanjust cross-test→ 249 pass / 0 failjust minirextendr-test→ 402 pass / 0 failjust devtools-test(rpkg) → 4512 pass / 0 fail / 15 skipjust fmt,just clippy, CIclippy_default+clippy_allcleanjust vendor(regeneratesrpkg/inst/vendor.tar.xz)upgrade_miniextendr_package()exercised against a dvs-rpkg clone and applied clean scaffolding diffs (build snag against its pre-frozen vendor/ state is pre-existing, unrelated to this PR)Generated with Claude Code