Skip to content
Snippets Groups Projects
Commit 63e1c71c authored by Jack Nagel's avatar Jack Nagel
Browse files

Eagerly initialize formula specs

Declarations of dependencies, options, and resources in the DSL only
apply to specs that have already been initialized. For example, given
this snippet:

  url ...
  sha1 ...

  depends_on 'foo'

  devel do
    url ...
    sha1 ...
  end

The dependency 'foo' will be recorded for the stable spec, but not the
devel spec, since it was not initialized prior to the call to
depends_on.

While it is considered best practice to declare all specs (stable,
devel, head, and bottle) prior to other declarations, there is nothing
that enforces this ordering, so when it happens it can be confusing and
hard to debug.

To prevent this, we can initialize all specs up front. This comes with
a performance penalty for commands that load all formulae into memory,
but that is probably outweighed by what we gain in correctness.

Fixes Homebrew/homebrew#23425.
parent 98b28f5a
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment