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

Use per-component cabal_macros.h #1893

Closed
bennofs opened this issue May 22, 2014 · 4 comments
Closed

Use per-component cabal_macros.h #1893

bennofs opened this issue May 22, 2014 · 4 comments
Milestone

Comments

@bennofs
Copy link
Collaborator

bennofs commented May 22, 2014

I have a project that builds a library and has some benchmarks. Now, everytime I switch the benchmarks from disabled to enabled (I don't enable them all the time to make building faster when only working on the library), cabal_macros.h changes because it has different dependencies than the library. This causes parts of the library to be recompiled. Using a per-component cabal_macros.h would solve the issue.

@ttuegel ttuegel added this to the Cabal-1.24 milestone Apr 24, 2015
@ezyang ezyang self-assigned this Jan 11, 2016
@ezyang
Copy link
Contributor

ezyang commented Jan 11, 2016

I think in the course of #3022 I will fix this bug.

@ezyang ezyang removed their assignment Jan 11, 2016
@ezyang
Copy link
Contributor

ezyang commented Jan 11, 2016

OK, here's the problem: if we have separate cabal_macros.h per library, the preprocessors need to know about what component they are building. Currently, the Preprocessor interfaces does not get this information, so we'd need to extend this interface. Unfortunately, the preprocessor hooks are a very commonly used interface in Custom setup files, so we need to decide if we're going to break it for more recent Cabal, or try to support this in a backwards compatible way.

But actually, I think this is OK, because with custom-setup, people who depend on old Cabal won't pick up a breaking version of Cabal.

By the way, extension point is probably extending

type PPSuffixHandler
    = (String, BuildInfo -> LocalBuildInfo -> PreProcessor)

to also get a ComponentLocalBuildInfo.

@23Skidoo
Copy link
Member

But actually, I think this is OK, because with custom-setup, people who depend on old Cabal won't pick up a breaking version of Cabal.

You mean setup-depends? Yes, that's what it's for. We should start taking advantage of it!

ezyang added a commit to ezyang/cabal that referenced this issue Jan 12, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 12, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 12, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@ezyang ezyang added the ezyang label Jan 13, 2016
ezyang added a commit to ezyang/cabal that referenced this issue Jan 13, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 13, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 14, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 14, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 15, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 15, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 19, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 19, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 27, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 27, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 28, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Jan 28, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Feb 2, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Feb 2, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Feb 2, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Feb 2, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@23Skidoo 23Skidoo modified the milestones: Cabal 1.26, Cabal 1.24 Feb 21, 2016
ezyang added a commit to ezyang/cabal that referenced this issue Mar 5, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 5, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 16, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 16, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 16, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 16, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 18, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 18, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 28, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 28, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 28, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 28, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 29, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 29, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 29, 2016
This commit is a number of refactorings that I needed to do
while fixing bugs with internal libraries support.

- With internal libraries, it becomes especially clear that
  cabal_macros.h and Paths_foo.hs need to be done per-component.
  It is done!

  This change breaks BC in an important way: the preprocessor
  interface now takes a ComponentLocalBuildInfo along with the
  BuildInfo and LocalBuildInfo.  This means that if you implemented
  a custom preprocessor, or called 'preprocessComponent' in a custom
  Setup, you will have to make sure you pass the right
  ComponentLocalBuildInfo.  Some sub-notes:

    - While I was mucking about cabal_macros.h, I updated it to have
      two new macros: CURRENT_COMPONENT_ID (an alias for
      CURRENT_PACKAGE_KEY, but using modern terminology) and
      LOCAL_COMPONENT_ID (which refers to the public library; we use
      this in Cabal's test suite but it's unclear what the general
      utility of this is.  See the TODO.)

    - checkForeignDeps has a hack where we hardcode the
      cabal_macros.h of the main library.  If we did the foreign dep
      check for every component individually that would be better,
      but I didn't want to roll it into this patch.

- The other piece I needed for internal libraries was per-component
  install directories; otherwise, internal libraries clobber each
  other.  absoluteInstallDirs now takes a ComponentId, which is used
  to determine what '$libname' expands to.  Generally, InstallPaths
  must be computed per component, c.f. haskell#2836.  We're not TRULY
  per-component install paths, since some files are installed for
  the "per-package" InstallPaths (the one we computed for the
  library as a whole), but for libraries we have to compute
  InstallPaths for each one.

    - While doing this, ComponentLocalBuildInfo grew a new
      'componentId' field for non-library things.  This lets us
      treat InstallPaths expansion uniformly.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
ezyang added a commit to ezyang/cabal that referenced this issue Mar 29, 2016
haskell#1893)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@23Skidoo
Copy link
Member

#3022 has been merged, I believe that this is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants