Skip to content

Cache source bundle generation in local Maven repository#5813

Merged
laeubi merged 2 commits intomainfrom
copilot/fix-source-bundle-generation
Feb 5, 2026
Merged

Cache source bundle generation in local Maven repository#5813
laeubi merged 2 commits intomainfrom
copilot/fix-source-bundle-generation

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Source bundles were regenerated on every build using temp files, slowing builds and creating garbage. This adds caching similar to wrapped bundles.

Approach

Cache eclipse source bundles alongside the original maven source JARs:

  • xyz-source.jarxyz-eclipse-source.jar (same directory)
  • Timestamp-based invalidation: regenerate only when source file is newer

Changes

  • MavenBundleWrapper: Added getEclipseSourceBundle() that returns cached bundle or generates new one
  • MavenTargetDefinitionContent: Replaced temp file creation with cached bundle lookup
  • MavenBundleWrapperTest: Unit tests for cache creation, reuse, and invalidation
// Before: temp file created every build
File tempFile = File.createTempFile("tycho_wrapped_source", ".jar");
tempFile.deleteOnExit();

// After: cached in maven repo alongside source
File eclipseSourceFile = MavenBundleWrapper.getEclipseSourceBundle(
    sourceFile, manifest, symbolicName, bundleVersion);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • testng.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/working/files-to-index10366803578815674553.list --sourceArchiveDir=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Source bundles are generated over and over again</issue_title>
<issue_description>I noticed that source bundles are generated by Tycho on each build. This unnecessarily slow down the build and creates garbage. We should similar to how its down with wrapped bundles, cache the result in the local maven repository and only regenerate it if it actually changed. </issue_description>

<agent_instructions>Please implement a fix for this. The approach should be working by using the filename of the source bundle we wrap (e.g. xyz-source.jar) and then create a xyz-eclipse-source.jar at the same location. To check if the source bundle is outdated we want to use the last modifed time of both files.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix repeated generation of source bundles during build Cache source bundle generation in local Maven repository Feb 5, 2026
Copilot AI requested a review from laeubi February 5, 2026 08:32
Copy link
Member

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

This looks fine to me, as we share this code with m2e a similar change should be done here likely as well.

@laeubi laeubi marked this pull request as ready for review February 5, 2026 09:31
@laeubi laeubi enabled auto-merge (squash) February 5, 2026 09:32
@laeubi laeubi merged commit 9fff1d6 into main Feb 5, 2026
13 of 14 checks passed
@laeubi laeubi deleted the copilot/fix-source-bundle-generation branch February 5, 2026 11:02
eclipse-tycho-bot pushed a commit that referenced this pull request Feb 5, 2026
@eclipse-tycho-bot
Copy link

💚 All backports created successfully

Status Branch Result
tycho-5.0.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

eclipse-tycho-bot pushed a commit that referenced this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source bundles are generated over and over again

3 participants