(Sources-3) oak_scan::set_package_sources()#1288
Open
DavisVaughan wants to merge 1 commit into
Open
Conversation
lionel-
approved these changes
Jun 24, 2026
Comment on lines
+218
to
+219
| /// The `directory` is not walked recursively. We expect that this is a flat directory of | ||
| /// `.R` files. |
Contributor
There was a problem hiding this comment.
Not important to support right now or ever, but in principle a package might install .R files in inst and source them at run time?
aee7077 to
251a097
Compare
f4da925 to
fa6959a
Compare
41e96ce to
8c166c5
Compare
fa6959a to
c7590de
Compare
As a way to ingest a directory of R files provided by an external source generation tool and set them as the `files` (or `scripts`) of a `Package`
a1a4bce to
8fb644d
Compare
c7590de to
135018f
Compare
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.
Progress towards #1234
Branched from #1287
This PR teaches
oak_scanhow to update an installedPackage'sfilesandscriptsfrom an external on disk directory.The idea is that some external source provider will return a flat
directoryof R files that correspond to the source files for aPackage. The newoak_scan::set_package_sources()helper iterates over thatdirectory, collecting the R files (but not reading them!), sorting and splitting them in accordance withcollate, and stashes them infilesandscriptsof thePackage.Caution
This PR has an important side effect. Since
package.files()now live in a totally separate directory outside anyLiveRoot, theFile::packagebackpointer is now a load bearing feature.Consider
File::root(). It switches onself.package(). If there is no package backpointer, it would go through either:root_by_file(), which looks insideLiveRoot::WorkspaceandLiveRoot::Libraryroot paths for the file'spath, neither of which would hold itroot_by_path(), which is for orphaned files, and also uses paths contained withinWorkspaceRootsSo we need to instead detect
self.package()and go throughroot_by_package(), which doesn't do apathcheck, it just detects that thePackagebackpointer is contained within aLiveRoot(by equality, not bypathcontainment). We already do all this, it is just important to point it out now.File::imports()is similar