Skip to content

Invoke inferred prerequisites of explicit file tasks - #790

Open
akzarma wants to merge 1 commit into
ruby:masterfrom
akzarma:akzarma/rake-626-rule-prerequisites
Open

akzarma wants to merge 1 commit into
ruby:masterfrom
akzarma:akzarma/rake-626-rule-prerequisites

Conversation

@akzarma

@akzarma akzarma commented Nov 30, 2026

Copy link
Copy Markdown

Fixes #626.

An explicitly declared file task with no action can take its action from a matching rule. Previously Rake attached that rule in execute: too late to build a missing rule source or even to notice that the source was newer than an existing target.

Run the explicitly declared prerequisites first (they may create a source that selects the rule), then invoke only the prerequisites introduced by the rule before checking whether the target is up to date. This uses the same serial or parallel prerequisite invocation path as normal tasks.

Regression coverage includes building a missing source via another rule, rebuilding when only the rule source changes, and selecting a rule whose source is created by an explicit prerequisite. The first two tests fail on upstream master before the fix.

Tested on macOS with Ruby 4.0.1: full Rake suite (609 tests, 1,476 assertions); RuboCop (97 files, no offenses).

AI assistance: OpenAI Codex was used to diagnose the issue, implement the change and run the tests.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule dependencies' behaviour is strange, possibly broken or poorly documented

1 participant