diff --git a/Library/Homebrew/cli/args.rbi b/Library/Homebrew/cli/args.rbi index c7746169fe..3dbdf28fb8 100644 --- a/Library/Homebrew/cli/args.rbi +++ b/Library/Homebrew/cli/args.rbi @@ -168,7 +168,7 @@ module Homebrew sig { returns(T.nilable(String)) } def tap; end - sig { returns(T.nilable(String)) } + sig { returns(T.nilable(T::Array[String])) } def macos; end sig { returns(T.nilable(T::Array[String])) } diff --git a/Library/Homebrew/dev-cmd/dispatch-build-bottle.rb b/Library/Homebrew/dev-cmd/dispatch-build-bottle.rb index 5c1a19bf00..8ef5c43ad4 100644 --- a/Library/Homebrew/dev-cmd/dispatch-build-bottle.rb +++ b/Library/Homebrew/dev-cmd/dispatch-build-bottle.rb @@ -21,8 +21,8 @@ module Homebrew description: "Build timeout (in minutes, default: 60)." flag "--issue=", description: "If specified, post a comment to this issue number if the job fails." - flag "--macos=", - description: "Version of macOS the bottle should be built for." + comma_array "--macos=", + description: "Version(s) of macOS the bottle should be built for." flag "--workflow=", description: "Dispatch specified workflow (default: `dispatch-build-bottle.yml`)." switch "--upload", @@ -51,25 +51,27 @@ module Homebrew # TODO: remove when core taps are merged repo.gsub!("linux", "home") unless args.tap - runner = if (macos = args.macos) - # We accept runner name syntax (11-arm64) or bottle syntax (arm64_big_sur) - os, arch = macos.yield_self do |s| - tag = Utils::Bottles::Tag.from_symbol(s.to_sym) - [tag.to_macos_version, tag.arch] - rescue ArgumentError, MacOSVersionError - os, arch = s.split("-", 2) - [MacOS::Version.new(os), arch&.to_sym] - end + runners = if (macos = args.macos&.compact_blank) && macos.present? + macos.map do |element| + # We accept runner name syntax (11-arm64) or bottle syntax (arm64_big_sur) + os, arch = element.yield_self do |s| + tag = Utils::Bottles::Tag.from_symbol(s.to_sym) + [tag.to_macos_version, tag.arch] + rescue ArgumentError, MacOSVersionError + os, arch = s.split("-", 2) + [MacOS::Version.new(os), arch&.to_sym] + end - if arch.present? && arch != :x86_64 - "#{os}-#{arch}" - else - os.to_s + if arch.present? && arch != :x86_64 + "#{os}-#{arch}" + else + os.to_s + end end elsif args.linux? - "ubuntu-latest" + ["ubuntu-latest"] elsif args.linux_self_hosted? - "linux-self-hosted-1" + ["linux-self-hosted-1"] else raise UsageError, "Must specify --macos or --linux or --linux-self-hosted option" end @@ -77,7 +79,7 @@ module Homebrew args.named.to_resolved_formulae.each do |formula| # Required inputs inputs = { - runner: runner, + runner: runners.join(","), formula: formula.name, } @@ -88,7 +90,7 @@ module Homebrew inputs[:upload] = args.upload?.to_s if args.upload? inputs[:wheezy] = args.linux_wheezy?.to_s if args.linux_wheezy? - ohai "Dispatching #{tap} bottling request of formula \"#{formula.name}\" for #{runner}" + ohai "Dispatching #{tap} bottling request of formula \"#{formula.name}\" for #{runners.join(", ")}" GitHub.workflow_dispatch_event(user, repo, workflow, ref, inputs) end end