Skip to content

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

Merged
xiongemi merged 1 commit intomasterfrom
fix/gradle-cache-run
May 23, 2025
Merged

fix(gradle): change run and bootRun to cacheable false#31287
xiongemi merged 1 commit intomasterfrom
fix/gradle-cache-run

Conversation

@xiongemi
Copy link
Copy Markdown
Contributor

@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 #

@vercel
Copy link
Copy Markdown

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

@nx-cloud
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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 {

Comment thread packages/gradle/project-graph/src/main/kotlin/dev/nx/gradle/utils/TaskUtils.kt Outdated
Comment thread packages/gradle/project-graph/src/main/kotlin/dev/nx/gradle/utils/TaskUtils.kt Outdated
@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
@github-actions
Copy link
Copy Markdown
Contributor

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.

3 participants