Skip to content

Save the unnecessary rebuild of libraries with profiling #4308

@konn

Description

@konn

Suppose we had configured with library-profiling: true and executable-profiling: false, and had built executables without --executable-profiling option.

Then, if we wanted to take an executable profiling and passed --executable-profiling option to stack, then it unregisters all the library consisting stack-project (not all the dependencies) and rebuild them from scratch, due to the change of compiler flags.

I think this behaviour is not optimal; we have built libraries with profiling features (and have p_o files already) and only we had to rebuild is executables.

For example, suppose we have the following stack.yaml:

packages:
- core-libs-and-exe   # package with library and executables
- util-lib -and-exe   # another one
- super-lib-and-exe   # yet another

extra-deps:
- extra-dependent-package-0.1.0.0

build:
  library-profiling: true
  executable-profiling: false

If we have once successfully executed stack build, p_o objects are built.
But if we enter stack build --executable-profiling again, Stack will rebuild all libraries and executables of core-libs-and-exe, util-lib -and-exe and super-lib-and-exe, although extra-dependent-package will not be rebuilt since they have profiling object files.

My propose is just to avoid rebuild libraries if the library profiling had been already enabled but executable was not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions