Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to get rules_pkl to pass for larger projects #31

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

shs96c
Copy link
Collaborator

@shs96c shs96c commented Dec 5, 2024

  • Correct cache directory for pkl_test and pkl_test_suite targets

These two targets appear to receive an incorrect (relative) path for the cache directory.

They're prefixed with the ctx.genfiles_dir.path and this leads to an error when providing a pkl_project repository alongside any number of pkl_library targets as dependencoes.

  • Copy files, don't symlink them so that Pkl can pick them up

We have lots of symlinks within the --working-dir that we pass to Pkl. This means that any code that's using globbed reads read*, or globbed imports import* can’t find the files that it requires.

This has been something that Pkl (and Pcl before it) haven’t supported, so I’m curious how we ended up with this regression or what we did. Here’s the bit of code in Pkl where symlinks are ignored: https://github.com/apple/pkl/blob/e81a47a03807739f8ab69eb8c595b53ec0afb434/pkl-core/src/main/java/org/pkl/core/module/FileResolver.java#L39-L42

Not having a solution for this will be a deal breaker for some projects as they will have a number of pkl_library targets that they progressively depend upon and expect to have present when we pkl_eval or pkl_test.

My understanding is that supporting this in Pkl is non-trivial right now, and requires work on cycle detection.

I’ve provided a patch to the Symlinks.java code which copies files over rather than symlinking them.

  • Allow up to 80% of RAM to be used

@shs96c shs96c changed the title [apple-only]: Fixes to get rules_pkl to pass for larger projects Fixes to get rules_pkl to pass for larger projects Dec 5, 2024
* Correct cache directory for `pkl_test` and `pkl_test_suite` targets

These two targets appear to receive an incorrect (relative) path for
the cache directory.

They're prefixed with the `ctx.genfiles_dir.path` and this leads to an
error when providing a `pkl_project` repository alongside any number
of `pkl_library` targets as dependencoes.

* Copy files, don't symlink them so that Pkl can pick them up

We have lots of symlinks within the `--working-dir` that we pass to
Pkl. This means that any code that's using globbed reads `read*`,
or globbed imports `import*` can’t find the files that it requires.

This has been something that Pkl (and Pcl before it) haven’t
supported, so I’m curious how we ended up with this regression or what
we did. Here’s the bit of code in Pkl where symlinks are ignored:
https://github.com/apple/pkl/blob/e81a47a03807739f8ab69eb8c595b53ec0afb434/pkl-core/src/main/java/org/pkl/core/module/FileResolver.java#L39-L42

Not having a solution for this will be a deal breaker for some
projects as they will have a number of `pkl_library` targets that
they progressively depend upon and expect to have present when we
`pkl_eval` or `pkl_test`.

My understanding is that supporting this in Pkl is non-trivial right
now, and requires work on cycle detection.

I’ve provided a patch to the `Symlinks.java` code which copies files
over rather than symlinking them.

* Allow up to 80% of RAM to be used
@shs96c shs96c merged commit c45eccb into apple:main Dec 5, 2024
4 checks passed
@shs96c shs96c deleted the chunky-projects branch December 5, 2024 15:43
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.

2 participants