diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 49d802dde3..aa1a62516a 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -440,7 +440,9 @@ module Cask MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch| bottle_tag = ::Utils::Bottles::Tag.new(system: os, arch:) next unless bottle_tag.valid_combination? - next if depends_on.macos && !depends_on.macos.allows?(bottle_tag.to_macos_version) + next if depends_on.macos && + !@dsl.depends_on_set_in_block? && + !depends_on.macos.allows?(bottle_tag.to_macos_version) Homebrew::SimulateSystem.with(os:, arch:) do refresh diff --git a/Library/Homebrew/cask/dsl.rb b/Library/Homebrew/cask/dsl.rb index d9ae0f529b..ab05176bd1 100644 --- a/Library/Homebrew/cask/dsl.rb +++ b/Library/Homebrew/cask/dsl.rb @@ -95,6 +95,7 @@ module Cask :livecheck, :livecheckable?, :on_system_blocks_exist?, + :depends_on_set_in_block?, *ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key), *ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key), *ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] }, @@ -105,7 +106,7 @@ module Cask attr_reader :cask, :token, :deprecation_date, :deprecation_reason, :disable_date, :disable_reason - attr_predicate :on_system_blocks_exist?, :deprecated?, :disabled?, :livecheckable? + attr_predicate :deprecated?, :disabled?, :livecheckable?, :on_system_blocks_exist?, :depends_on_set_in_block? def initialize(cask) @cask = cask @@ -353,6 +354,7 @@ module Cask # @api public def depends_on(**kwargs) @depends_on ||= DSL::DependsOn.new + @depends_on_set_in_block = true if @called_in_on_system_block return @depends_on if kwargs.empty? begin