GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Optimize Temurin tool-cache fast path with lazy loading by brunoborges · Pull Request #1179 · actions/setup-java

Conversation

@brunoborges

@brunoborges brunoborges commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description:
This change optimizes the high-volume Temurin tool-cache-hit path by reducing eager startup work and overlapping dependency cache restore with local setup work. It does this by lazy-loading only the selected distribution installer, loading cache dependencies only when cache is configured, and starting restore early while still awaiting completion before action exit.

To preserve behavior and failure semantics, the setup flow now keeps Java/setup failures deterministic while still awaiting any in-flight cache restore to avoid unhandled promise rejections. Tests were updated to cover async distribution resolution, conditional module loading, and true concurrency in orchestration.

The setup bundle was regenerated after introducing dynamic imports. Because the setup output is now chunked, the release staging script was updated to include dist/setup/*.js.

Related issue:
Fixes: #1177

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@brunoborges
Optimize Temurin tool-cache fast path
7bfb38e
- Lazy-load distribution installers so only the selected distro module is initialized
- Defer cache feature/cache module loading until cache input is provided
- Start cache restore early and await it safely alongside Java setup flow
- Update orchestration and lazy-loading tests; regenerate dist artifacts

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cc2c0256-c55e-4a35-a584-5bed7e8b11ad
Copilot AI review requested due to automatic review settings July 29, 2026 19:58
@brunoborges
brunoborges requested a review from a team as a code owner July 29, 2026 19:58
Copilot started reviewing on behalf of brunoborges July 29, 2026 19:58
View session
Copilot AI reviewed Jul 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 optimizes the common Temurin tool-cache-hit path by reducing eager module initialization and introducing concurrency between dependency cache restoration and local Java setup, while preserving deterministic failure behavior. It also regenerates the bundled dist/ output to support dynamic imports/code-splitting and updates tests to validate lazy loading and true overlap.

Changes:

  • Make distribution selection lazy by converting the distribution factory to async and dynamically importing only the selected installer.
  • Start dependency cache restoration earlier (only when cache is configured) and await it before exit while keeping Java/setup errors deterministic.
  • Add/update unit tests for async distribution resolution, conditional module loading, and concurrent orchestration; regenerate dist/ and update the release staging script.
Show a summary per file
File Description
src/util.ts Removes cache feature detection from the shared util module to avoid eager cache dependency loading.
src/setup-java.ts Orchestrates async distribution resolution and overlaps cache restore with setup; awaits in-flight cache work before exit.
src/distributions/distribution-factory.ts Converts factory to async with per-distribution dynamic imports (lazy loading).
src/cache-feature.ts New module encapsulating cache availability checks (lazy-load target).
package.json Updates release script to stage chunked dist/setup/*.js artifacts.
dist/setup/index.js Rebuilt setup entry bundle to support dynamic imports/code splitting.
dist/setup/978.index.js Generated setup bundle chunk (Zulu installer).
dist/setup/968.index.js Generated setup bundle chunk (GraalVM installers).
dist/setup/939.index.js Generated setup bundle chunk (Semeru installer).
dist/setup/874.index.js Generated setup bundle chunk (Adopt + Temurin installers).
dist/setup/735.index.js Generated setup bundle chunk (OpenJDK installer).
dist/setup/675.index.js Generated setup bundle chunk (Dragonwell installer).
dist/setup/63.index.js Generated setup bundle chunk (Liberica installer).
dist/setup/557.index.js Generated setup bundle chunk (SapMachine installer).
dist/setup/524.index.js Generated setup bundle chunk (Liberica NIK installer).
dist/setup/463.index.js Generated setup bundle chunk (Temurin installer).
dist/setup/394.index.js Generated setup bundle chunk (cache feature detection).
dist/setup/377.index.js Generated setup bundle chunk (cache restore/save implementation).
dist/setup/282.index.js Generated setup bundle chunk (JetBrains installer).
dist/setup/220.index.js Generated setup bundle chunk (Microsoft installer).
dist/setup/182.index.js Generated setup bundle chunk (Oracle installer).
dist/setup/151.index.js Generated setup bundle chunk (Kona installer).
dist/setup/126.index.js Generated setup bundle chunk (Corretto installer).
dist/setup/19.index.js Generated setup bundle chunk (Local/jdkfile installer).
dist/cleanup/index.js Rebuilt cleanup bundle to match new build output.
tests/util.test.ts Removes cache feature tests/mocks from util tests (logic moved).
tests/setup-java.test.ts Updates orchestration tests for async factory + concurrent cache restore and deterministic failure handling.
tests/setup-java.module-loading.test.ts New test ensuring cache modules are not imported when cache input is absent.
tests/distributors/openjdk-installer.test.ts Updates factory registration test to await async factory.
tests/distributors/graalvm-installer.test.ts Updates factory mapping test(s) to await async factory.
tests/distributors/distribution-factory.test.ts Updates all factory tests to async/await and rejects assertions.
tests/distributors/distribution-factory.lazy-loading.test.ts New test to ensure non-selected installers aren’t imported on Temurin path.
tests/cache-feature.test.ts New dedicated tests for cache feature detection behavior.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 13/35 changed files
  • Comments generated: 2
  • Review effort level: Low

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/setup-java.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread package.json Resolved

Uh oh!

There was an error while loading. Please reload this page.

brunoborges and others added 3 commits July 29, 2026 16:06
@brunoborges
Address PR review comments
5b685bc
- Lazy-load cache save in cleanup path so no-cache runs avoid cache module init in post action
- Stage dist/setup/package.json in release script for chunked setup bundle completeness

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cc2c0256-c55e-4a35-a584-5bed7e8b11ad
@brunoborges
Fix CodeQL comment tag filter finding
32f5a4d
Patch is-unsafe's XML comment-close detector during builds so generated bundles recognize both HTML comment end forms and satisfy CodeQL until the dependency publishes a fix.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 277302b1-aa95-4012-817b-9752cdaee14e
@brunoborges
Rebuild generated dist bundles
94f7af9
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cc2c0256-c55e-4a35-a584-5bed7e8b11ad
@brunoborges
brunoborges merged commit 3cc3643 into main Jul 29, 2026
88 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@brunoborges
brunoborges deleted the brunoborges-optimize-temurin-tool-cache-fast-path branch July 29, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Optimize the Temurin tool-cache fast path

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@brunoborges
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.