Skip to content

Track lib .ts as typescript task inputs #12087#12088

Open
rymsha wants to merge 1 commit into
masterfrom
lib-ts-inputs-12087
Open

Track lib .ts as typescript task inputs #12087#12088
rymsha wants to merge 1 commit into
masterfrom
lib-ts-inputs-12087

Conversation

@rymsha
Copy link
Copy Markdown
Contributor

@rymsha rymsha commented May 29, 2026

Summary

The :lib:typescript NpmTask in modules/lib/build.gradle runs npm run build to compile each lib-*'s src/main/resources/lib/xp/**/*.ts into the generated .js/.d.ts under lib-*/build/typescript/. Those JS files are then copied by processResources into build/resources/main for the OSGi bundle and tests.

The task only declared global.d.ts, core/index.d.ts, tsconfig.build.json and tsconfig.json as inputs — the actual TS sources were missing. Editing a subproject .ts therefore left :lib:typescript UP-TO-DATE, processResources copied the stale generated JS, and tests ran against old code until a clean.

Fix: declare the subproject TS (+ .js/.json siblings) as inputs of :lib:typescript, mirroring exactly the pattern the sibling lint task in the same file already uses. Outputs and other inputs untouched.

Test plan

Verified in claude-dev against xp at HEAD of this branch:

  • ./gradlew :lib:lib-portal:processResources — seeds outputs (clean run).
  • ./gradlew :lib:typescriptUP-TO-DATE immediately after (caching still works with the new inputs declaration).
  • Throwaway edit appended to modules/lib/lib-portal/src/main/resources/lib/xp/portal.ts, re-ran ./gradlew :lib:typescript --console=plain — task now executed (> Task :lib:typescript + tsc --declaration --project tsconfig.build.json), proving the subproject .ts is now a tracked input. Before this fix the same scenario reported UP-TO-DATE.
  • Reverted throwaway edit, ran ./gradlew :lib:lib-portal:test — green.

Closes #12087

🤖 Generated with Claude Code

The :lib:typescript NpmTask compiles each lib-*'s
src/main/resources/lib/xp/**/*.ts into JS/DTS via `npm run build`, but
only declared global.d.ts, core/index.d.ts and the tsconfigs as inputs.
Editing a subproject .ts left the task UP-TO-DATE, so processResources
copied stale generated JS and tests ran against old code until `clean`.

Add the subproject TS (+ js/json siblings) as task inputs, mirroring
the sibling lint task in the same file.

Closes #12087
@codacy-production
Copy link
Copy Markdown

Codacy's Analysis Summary

0 new issue (≤ 0 issue)
0 new security issue
More details

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes. Give us feedback

@rymsha
Copy link
Copy Markdown
Contributor Author

rymsha commented May 29, 2026

Pushed

Before/after evidence (verified locally in claude-dev)

Seed outputs once: ./gradlew :lib:lib-portal:processResources → success.

No-op re-run with the new inputs in place:

> Task :lib:typescript UP-TO-DATE
BUILD SUCCESSFUL in 2s

(Caching still works — new inputs declaration doesn't break incrementality.)

Throwaway edit to modules/lib/lib-portal/src/main/resources/lib/xp/portal.ts (appended a trailing comment), then ./gradlew :lib:typescript --console=plain:

> Task :lib:typescript

> lib@1.0.0 build
> tsc --declaration --project tsconfig.build.json

BUILD SUCCESSFUL in 4s
32 actionable tasks: 2 executed, 30 up-to-date

The task executed instead of reporting `UP-TO-DATE` — exactly the change #12087 asks for. Pre-fix the same scenario reported `UP-TO-DATE`.

Reverted the throwaway edit, then `./gradlew :lib:lib-portal:test` → green.

CI

All checks pass on `142befc`: https://github.com/enonic/xp/pull/12088/checks

  • Gradle Build: `build` ✅, `publish_vars` ✅, `dispatch` skipped
  • CodeQL (java-kotlin, javascript-typescript, actions): ✅
  • Codacy Static Code Analysis: ✅

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.05%. Comparing base (529a046) to head (142befc).

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #12088   +/-   ##
=========================================
  Coverage     86.05%   86.05%           
  Complexity    19379    19379           
=========================================
  Files          2544     2544           
  Lines         65932    65932           
  Branches       5289     5289           
=========================================
  Hits          56740    56740           
  Misses         6630     6630           
  Partials       2562     2562           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

lib typescript task ignores .ts source changes (no incremental recompile)

1 participant