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

Add js-options field to cabal file to allow passing custom preprocessing options for js (#10721) #10722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ buildInfoFieldGrammar =
<*> monoidalFieldAla "cc-options" (alaList' NoCommaFSep Token') L.ccOptions
<*> monoidalFieldAla "cxx-options" (alaList' NoCommaFSep Token') L.cxxOptions
^^^ availableSince CabalSpecV2_2 []
<*> monoidalFieldAla "js-options" (alaList' NoCommaFSep Token') L.jsOptions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above, needs to be guarded by availableSince.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it but got confused by a fact js-sources are not guarded. Is it an omission?

Which value should I put here?

<*> monoidalFieldAla "ld-options" (alaList' NoCommaFSep Token') L.ldOptions
<*> monoidalFieldAla "hsc2hs-options" (alaList' NoCommaFSep Token') L.hsc2hsOptions
^^^ availableSince CabalSpecV3_6 []
Expand Down
4 changes: 4 additions & 0 deletions Cabal-syntax/src/Distribution/Types/BuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ data BuildInfo = BuildInfo
-- ^ options for C compiler
, cxxOptions :: [String]
-- ^ options for C++ compiler
, jsOptions :: [String]
-- ^ options for pre-processing JavaScript code
, ldOptions :: [String]
-- ^ options for linker
, hsc2hsOptions :: [String]
Expand Down Expand Up @@ -161,6 +163,7 @@ instance Monoid BuildInfo where
, cmmOptions = []
, ccOptions = []
, cxxOptions = []
, jsOptions = []
, ldOptions = []
, hsc2hsOptions = []
, pkgconfigDepends = []
Expand Down Expand Up @@ -214,6 +217,7 @@ instance Semigroup BuildInfo where
, cmmOptions = combine cmmOptions
, ccOptions = combine ccOptions
, cxxOptions = combine cxxOptions
, jsOptions = combine jsOptions
, ldOptions = combine ldOptions
, hsc2hsOptions = combine hsc2hsOptions
, pkgconfigDepends = combine pkgconfigDepends
Expand Down
4 changes: 4 additions & 0 deletions Cabal-syntax/src/Distribution/Types/BuildInfo/Lens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class HasBuildInfo a where
cxxOptions = buildInfo . cxxOptions
{-# INLINE cxxOptions #-}

jsOptions :: Lens' a [String]
jsOptions = buildInfo . jsOptions
{-# INLINE jsOptions #-}

ldOptions :: Lens' a [String]
ldOptions = buildInfo . ldOptions
{-# INLINE ldOptions #-}
Expand Down
1 change: 1 addition & 0 deletions Cabal/src/Distribution/Simple/GHC/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ componentJsGhcOptions verbosity lbi bi clbi odir filename =
, ghcOptPackageDBs = withPackageDB lbi
, ghcOptPackages = toNubListR $ mkGhcOptPackages (promisedPkgs lbi) clbi
, ghcOptObjDir = toFlag odir
, ghcOptExtra = jsOptions bi
}

componentGhcOptions
Expand Down
Loading