Skip to content

chore: remove orphaned vendor-crates.R from cross-package fixtures (#198)#207

Open
CGMossa wants to merge 2 commits intomainfrom
fix/issue-198-rescaffold-cross-package
Open

chore: remove orphaned vendor-crates.R from cross-package fixtures (#198)#207
CGMossa wants to merge 2 commits intomainfrom
fix/issue-198-rescaffold-cross-package

Conversation

@CGMossa
Copy link
Copy Markdown
Collaborator

@CGMossa CGMossa commented Apr 17, 2026

Closes #198. Closes #36.

Summary

  • Rescaffolded build plumbing in both tests/cross-package/producer.pkg and tests/cross-package/consumer.pkg from 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.
  • Removed orphaned tools/vendor-crates.R from both fixtures and the matching fallback branch in minirextendr/R/vendor.R. No template generates that script anymore.
  • Renamed wrappers from dash-variant (producer-pkg-wrappers.R) to dot-variant (producer.pkg-wrappers.R) to match the template's @PACKAGE_NAME@-wrappers.R substitution. Updated the cross-package justfile and regenerated man pages.
  • Fixed S3 generic export bug (miniextendr-macros/src/miniextendr_impl/s3_class.rs). The generic block's @export lost its target because roxygen2 can't introspect if (!exists(...)), so the export drifted to the method and produced export(foo.Bar) instead of export(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.
  • Fixed 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 on configure.win / configure.ucrt after write (template files aren't marked executable).
  • Fixed pre-existing double-cd bug in tests/cross-package/justfile document-* recipes (two sequential cd <pkg> lines in a single bash shebang script tried to cd into <pkg>/<pkg>). Also added keep_source=TRUE so R6 methods have the source refs roxygen2 needs.

Test plan

  • just cross-install clean
  • just cross-test → 249 pass / 0 fail
  • just minirextendr-test → 402 pass / 0 fail
  • just devtools-test (rpkg) → 4512 pass / 0 fail / 15 skip
  • just fmt, just clippy, CI clippy_default + clippy_all clean
  • just vendor (regenerates rpkg/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

…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>
@CGMossa CGMossa force-pushed the fix/issue-198-rescaffold-cross-package branch from f71c0e2 to bc64973 Compare April 17, 2026 11:48
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant