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

WIP - Dynamic dependencies for Haskell (discussion) #19

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

avdv
Copy link
Contributor

@avdv avdv commented Sep 17, 2024

  • Pass correct rpath origin setting to linker on Darwin
  • Add cxx_merge_cpreprocessors_actions function with AnalysisActions parameter
  • Add script to generate target metadata for Haskell
  • Add ghc wrapper script which writes ABI hash and a deps file
  • Add is_haskell_boot helper function
  • Add HaskellToolchainLibrary provider
  • Add haskell_toolchain_library rule
  • Add generate_target_metadata and ghc_wrapper tool targets
  • make compiler_flags be of arg type (#34)
  • Add scripts to haskell rules
  • Allow to declare dependencies for haskell sources manually
  • Add get_source_prefixes helper function
  • Make ghci_lib_path optional in template processor script
  • Add attributes to haskell rules
  • Support HaskellToolchainLibs for ide BXL
  • Make cc toolchain tools optional
  • Determine haskell dependencies and compile modules according to the dependency graph

IMPORTANT: Please don't raise pull requests here, but at
facebook/buck2.

NOTE: this is a PR to get the discussion started on how to incorporate our changes into upstream.

I'll raise a PR at the buck2 repo soonish.


These changes requires a few GHC patches:

avdv and others added 17 commits September 17, 2024 11:07
…` parameter

This is going to be useful with new dynamic action rules.
This is used to track libraries that are provided by the haskell toolchain (e.g. by Nix) in the `deps`
attribute of Haskell rules.
compiler_flags often needs macro like $(location :target).
- `external_tools`: pass executables called from Haskell compiler during preprocessing or compilation
- `srcs_envs`: pass individual run-time env for each source compilation
- `use_argsfile_at_link`: use response file at linking
…ependency graph

This commit comprises all of the changes needed to use meta data from the Haskell compiler (a JSON file gathered with `ghc -M`) and use that inside
of dynamic actions to create module compilation actions, including tracking cross-package dependencies and handling template haskell usage accordingly.

This also allows us to put sources into different sub-directories.

Co-authored-by: Ian-Woo Kim <ianwookim@gmail.com>
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 17, 2024
@avdv avdv changed the title WIP - Pass correct rpath origin setting to linker on Darwin (discussion) WIP - Dynamic dependencies for Haskell (discussion) Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants