Skip to content

fix(gradle): change run and bootRun to cacheable false #31287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025

Conversation

xiongemi
Copy link
Collaborator

@xiongemi xiongemi commented May 20, 2025

Current Behavior

currently, all tasks are cacheable

Expected Behavior

run and bootRun should not be cacheable

Related Issue(s)

Fixes #

Copy link

vercel bot commented May 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview May 23, 2025 3:32am

Copy link

nx-cloud bot commented May 20, 2025

View your CI Pipeline Execution ↗ for commit cb8f791.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 43s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 12s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 4s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 4s View ↗
nx documentation ✅ Succeeded 34s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-23 03:44:01 UTC

@xiongemi xiongemi force-pushed the fix/gradle-cache-run branch from bc657f0 to fe0d975 Compare May 20, 2025 19:37
@FrozenPandaz FrozenPandaz requested a review from Copilot May 22, 2025 20:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR makes the Gradle run and bootRun tasks non-cacheable by replacing the hardcoded true cache flag with a conditional check.

  • Changed target["cache"] to use isCacheable(task) instead of always true
  • Added isCacheable helper to exclude run and bootRun tasks from caching
Comments suppressed due to low confidence (1)

packages/gradle/project-graph/src/main/kotlin/dev/nx/gradle/utils/TaskUtils.kt:314

  • [nitpick] Consider adding unit tests for isCacheable to verify it returns false for 'run' and 'bootRun' tasks and true for other task names.
fun isCacheable(task: Task): Boolean {

@xiongemi xiongemi force-pushed the fix/gradle-cache-run branch from fe0d975 to cb8f791 Compare May 23, 2025 03:30
@xiongemi xiongemi merged commit e01a18d into master May 23, 2025
6 checks passed
@xiongemi xiongemi deleted the fix/gradle-cache-run branch May 23, 2025 21:25
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants