Allow :test dependencies.
These specify that they are needed by the test block. This can be combined with `:build` to ensure that this formula isn't uninstalled by `brew test-bot` when running `test do` blocks on our CI.
This commit is contained in:
parent
e362aae422
commit
fea9bc1e42
@ -17,7 +17,8 @@
|
|||||||
#:
|
#:
|
||||||
#: By default, `deps` shows required and recommended dependencies for
|
#: By default, `deps` shows required and recommended dependencies for
|
||||||
#: <formulae>. To include the `:build` type dependencies, pass `--include-build`.
|
#: <formulae>. To include the `:build` type dependencies, pass `--include-build`.
|
||||||
#: Similarly, pass `--include-optional` to include `:optional` dependencies.
|
#: Similarly, pass `--include-optional` to include `:optional` dependencies or
|
||||||
|
#: `--include-test` to include `:test` dependencies.
|
||||||
#: To skip `:recommended` type dependencies, pass `--skip-recommended`.
|
#: To skip `:recommended` type dependencies, pass `--skip-recommended`.
|
||||||
#: To include requirements in addition to dependencies, pass `--include-requirements`.
|
#: To include requirements in addition to dependencies, pass `--include-requirements`.
|
||||||
#:
|
#:
|
||||||
@ -30,8 +31,8 @@
|
|||||||
#: If `--installed` is passed, output a tree for every installed formula.
|
#: If `--installed` is passed, output a tree for every installed formula.
|
||||||
#:
|
#:
|
||||||
#: The <filters> placeholder is any combination of options `--include-build`,
|
#: The <filters> placeholder is any combination of options `--include-build`,
|
||||||
#: `--include-optional`, `--skip-recommended`, and `--include-requirements` as
|
#: `--include-optional`, `--include-test`, `--skip-recommended`, and
|
||||||
#: documented above.
|
#: `--include-requirements` as documented above.
|
||||||
#:
|
#:
|
||||||
#: If `--annotate` is passed, the build, optional, and recommended dependencies
|
#: If `--annotate` is passed, the build, optional, and recommended dependencies
|
||||||
#: are marked as such in the output.
|
#: are marked as such in the output.
|
||||||
@ -42,7 +43,8 @@
|
|||||||
#: dependencies of that formula.
|
#: dependencies of that formula.
|
||||||
#:
|
#:
|
||||||
#: The <filters> placeholder is any combination of options `--include-build`,
|
#: The <filters> placeholder is any combination of options `--include-build`,
|
||||||
#: `--include-optional`, and `--skip-recommended` as documented above.
|
#: `--include-optional`, `--include-test`, and `--skip-recommended` as
|
||||||
|
#: documented above.
|
||||||
|
|
||||||
# The undocumented `--for-each` option will switch into the mode used by `deps --all`,
|
# The undocumented `--for-each` option will switch into the mode used by `deps --all`,
|
||||||
# but only list dependencies for specified formula, one specified formula per line.
|
# but only list dependencies for specified formula, one specified formula per line.
|
||||||
@ -111,6 +113,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
if ARGV.include?("--annotate")
|
if ARGV.include?("--annotate")
|
||||||
str = "#{str} [build]" if dep.build?
|
str = "#{str} [build]" if dep.build?
|
||||||
|
str = "#{str} [test]" if dep.test?
|
||||||
str = "#{str} [optional" if dep.optional?
|
str = "#{str} [optional" if dep.optional?
|
||||||
str = "#{str} [recommended]" if dep.recommended?
|
str = "#{str} [recommended]" if dep.recommended?
|
||||||
end
|
end
|
||||||
@ -125,6 +128,11 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
ignores << "build?"
|
ignores << "build?"
|
||||||
end
|
end
|
||||||
|
if ARGV.include?("--include-test")
|
||||||
|
includes << "test?"
|
||||||
|
else
|
||||||
|
ignores << "test?"
|
||||||
|
end
|
||||||
if ARGV.include?("--include-optional")
|
if ARGV.include?("--include-optional")
|
||||||
includes << "optional?"
|
includes << "optional?"
|
||||||
else
|
else
|
||||||
@ -140,6 +148,8 @@ module Homebrew
|
|||||||
Dependency.prune if !includes.include?("optional?") && !dependent.build.with?(dep)
|
Dependency.prune if !includes.include?("optional?") && !dependent.build.with?(dep)
|
||||||
elsif dep.build?
|
elsif dep.build?
|
||||||
Dependency.prune unless includes.include?("build?")
|
Dependency.prune unless includes.include?("build?")
|
||||||
|
elsif dep.test?
|
||||||
|
Dependency.prune unless includes.include?("test?")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
reqs = f.recursive_requirements do |dependent, req|
|
reqs = f.recursive_requirements do |dependent, req|
|
||||||
@ -149,6 +159,8 @@ module Homebrew
|
|||||||
Requirement.prune if !includes.include?("optional?") && !dependent.build.with?(req)
|
Requirement.prune if !includes.include?("optional?") && !dependent.build.with?(req)
|
||||||
elsif req.build?
|
elsif req.build?
|
||||||
Requirement.prune unless includes.include?("build?")
|
Requirement.prune unless includes.include?("build?")
|
||||||
|
elsif req.test?
|
||||||
|
Requirement.prune unless includes.include?("test?")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -191,6 +203,7 @@ module Homebrew
|
|||||||
dependables = reqs + deps
|
dependables = reqs + deps
|
||||||
dependables = dependables.reject(&:optional?) unless ARGV.include?("--include-optional")
|
dependables = dependables.reject(&:optional?) unless ARGV.include?("--include-optional")
|
||||||
dependables = dependables.reject(&:build?) unless ARGV.include?("--include-build")
|
dependables = dependables.reject(&:build?) unless ARGV.include?("--include-build")
|
||||||
|
dependables = dependables.reject(&:test) unless ARGV.include?("--include-test")
|
||||||
dependables = dependables.reject(&:recommended?) if ARGV.include?("--skip-recommended")
|
dependables = dependables.reject(&:recommended?) if ARGV.include?("--skip-recommended")
|
||||||
max = dependables.length - 1
|
max = dependables.length - 1
|
||||||
@dep_stack.push f.name
|
@dep_stack.push f.name
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "options"
|
require "options"
|
||||||
|
|
||||||
module Dependable
|
module Dependable
|
||||||
RESERVED_TAGS = [:build, :optional, :recommended, :run, :linked].freeze
|
RESERVED_TAGS = [:build, :optional, :recommended, :run, :test, :linked].freeze
|
||||||
|
|
||||||
def build?
|
def build?
|
||||||
tags.include? :build
|
tags.include? :build
|
||||||
@ -19,8 +19,12 @@ module Dependable
|
|||||||
tags.include? :run
|
tags.include? :run
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test?
|
||||||
|
tags.include? :test
|
||||||
|
end
|
||||||
|
|
||||||
def required?
|
def required?
|
||||||
!build? && !optional? && !recommended?
|
!build? && !test? && !optional? && !recommended?
|
||||||
end
|
end
|
||||||
|
|
||||||
def option_tags
|
def option_tags
|
||||||
|
@ -45,6 +45,15 @@ module Homebrew
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Don't test formulae missing test dependencies
|
||||||
|
missing_test_deps = f.recursive_dependencies do |_, dependency|
|
||||||
|
Dependency.prune if !dependency.required? && !dependency.test?
|
||||||
|
end.map(&:to_s)
|
||||||
|
unless missing_test_deps.empty?
|
||||||
|
ofail "#{f.full_name} is missing test dependencies: #{missing_test_deps.join(" ")}"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
puts "Testing #{f.full_name}"
|
puts "Testing #{f.full_name}"
|
||||||
|
|
||||||
env = ENV.to_hash
|
env = ENV.to_hash
|
||||||
|
@ -96,7 +96,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
|
|
||||||
By default, `deps` shows required and recommended dependencies for
|
By default, `deps` shows required and recommended dependencies for
|
||||||
`formulae`. To include the `:build` type dependencies, pass `--include-build`.
|
`formulae`. To include the `:build` type dependencies, pass `--include-build`.
|
||||||
Similarly, pass `--include-optional` to include `:optional` dependencies.
|
Similarly, pass `--include-optional` to include `:optional` dependencies or
|
||||||
|
`--include-test` to include `:test` dependencies.
|
||||||
To skip `:recommended` type dependencies, pass `--skip-recommended`.
|
To skip `:recommended` type dependencies, pass `--skip-recommended`.
|
||||||
To include requirements in addition to dependencies, pass `--include-requirements`.
|
To include requirements in addition to dependencies, pass `--include-requirements`.
|
||||||
|
|
||||||
@ -109,8 +110,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
If `--installed` is passed, output a tree for every installed formula.
|
If `--installed` is passed, output a tree for every installed formula.
|
||||||
|
|
||||||
The `filters` placeholder is any combination of options `--include-build`,
|
The `filters` placeholder is any combination of options `--include-build`,
|
||||||
`--include-optional`, `--skip-recommended`, and `--include-requirements` as
|
`--include-optional`, `--include-test`, `--skip-recommended`, and
|
||||||
documented above.
|
`--include-requirements` as documented above.
|
||||||
|
|
||||||
If `--annotate` is passed, the build, optional, and recommended dependencies
|
If `--annotate` is passed, the build, optional, and recommended dependencies
|
||||||
are marked as such in the output.
|
are marked as such in the output.
|
||||||
@ -121,7 +122,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
dependencies of that formula.
|
dependencies of that formula.
|
||||||
|
|
||||||
The `filters` placeholder is any combination of options `--include-build`,
|
The `filters` placeholder is any combination of options `--include-build`,
|
||||||
`--include-optional`, and `--skip-recommended` as documented above.
|
`--include-optional`, `--include-test`, and `--skip-recommended` as
|
||||||
|
documented above.
|
||||||
|
|
||||||
* `desc` `formula`:
|
* `desc` `formula`:
|
||||||
Display `formula`'s name and one-line description.
|
Display `formula`'s name and one-line description.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "BREW\-CASK" "1" "February 2018" "Homebrew" "brew-cask"
|
.TH "BREW\-CASK" "1" "March 2018" "Homebrew" "brew-cask"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbrew\-cask\fR \- a friendly binary installer for macOS
|
\fBbrew\-cask\fR \- a friendly binary installer for macOS
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "BREW" "1" "February 2018" "Homebrew" "brew"
|
.TH "BREW" "1" "March 2018" "Homebrew" "brew"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbrew\fR \- The missing package manager for macOS
|
\fBbrew\fR \- The missing package manager for macOS
|
||||||
@ -107,7 +107,7 @@ If \fB\-\-full\-name\fR is passed, list dependencies by their full name\.
|
|||||||
If \fB\-\-installed\fR is passed, only list those dependencies that are currently installed\.
|
If \fB\-\-installed\fR is passed, only list those dependencies that are currently installed\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
By default, \fBdeps\fR shows required and recommended dependencies for \fIformulae\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\.
|
By default, \fBdeps\fR shows required and recommended dependencies for \fIformulae\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies or \fB\-\-include\-test\fR to include \fB:test\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformulae\fR|\fB\-\-installed\fR)
|
\fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformulae\fR|\fB\-\-installed\fR)
|
||||||
@ -120,7 +120,7 @@ If \fB\-\-1\fR is passed, only one level of children is displayed\.
|
|||||||
If \fB\-\-installed\fR is passed, output a tree for every installed formula\.
|
If \fB\-\-installed\fR is passed, output a tree for every installed formula\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-skip\-recommended\fR, and \fB\-\-include\-requirements\fR as documented above\.
|
The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, \fB\-\-skip\-recommended\fR, and \fB\-\-include\-requirements\fR as documented above\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
If \fB\-\-annotate\fR is passed, the build, optional, and recommended dependencies are marked as such in the output\.
|
If \fB\-\-annotate\fR is passed, the build, optional, and recommended dependencies are marked as such in the output\.
|
||||||
@ -130,7 +130,7 @@ If \fB\-\-annotate\fR is passed, the build, optional, and recommended dependenci
|
|||||||
Show dependencies for installed or all available formulae\. Every line of output starts with the formula name, followed by a colon and all direct dependencies of that formula\.
|
Show dependencies for installed or all available formulae\. Every line of output starts with the formula name, followed by a colon and all direct dependencies of that formula\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, and \fB\-\-skip\-recommended\fR as documented above\.
|
The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, and \fB\-\-skip\-recommended\fR as documented above\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBdesc\fR \fIformula\fR
|
\fBdesc\fR \fIformula\fR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user