Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336026

Summary: [tool] provide tool to validate presence of artifacts in a repo
Product: [Eclipse Project] Equinox Reporter: Dave Orme <djo>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: Ed.Merks, pascal
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dave Orme CLA 2011-02-01 18:39:50 EST
1. Normal dev IDE == Vanilla helios + subclipse. Not installed OB.
2. Brand new workspace
3. Use the PDE wizard to create a plugin with a View
4. .. for creating Feature: my.feature, then add View to my.feature
5. ... for creating update site / P2 repo
6. Added features to P2 repo, through the normal pointy-clicky UI:
a. my.feature
b. org.eclipse.rcp
7. Build all -> all good, both features and the org.eclipse.rcp bundles in P2 repo.

8. removed org.eclipse.rcp feature and bundles from P2 repo using package explorer

9. Build all -> _incomplete result_, only myproject feature and plugin; nothing from org.eclipse.rcp.

--

10. Now delete "features" and "plugins" directories.
11. Build all -> View, and my.feature rebuilt; still missing org.eclipse.rcp

--

12. Delete artifacts.jar, content.jar
13. Build all -> Everything rebuilt properly.

-------------------

Conclusion: 

It is inconsistent and thus surprising to the user for Features/Bundles in the workspace to always be rebuilt in the P2 repo, but for target platform artifacts to be included to require artifacts.jar and content.jar to be deleted.

By the principle of least surprise, either you should *always* have to remove artifacts.jar/content.jar to get a correct build or you should *never* have to remove them to get a correct build.

In any case, I would expect that clicking "build all" should build everything or it should display an error message if it fails to generate any of the desired artifacts.
Comment 1 Pascal Rapicault CLA 2011-02-01 20:12:25 EST
The first thing that comes to mind is that you are asking for troubles :)
What you get on disk is not just a bunch of files but a repository where elements are being referred to from the content.jar and artifacts.jar. This means that by altering the content on disk (e.g. deleting files in plugins or feature or changing their content), you are breaking the integrity of the repository and from there odd behaviour ensue.

The fundamental difference explaining the behaviour you observe comes from the fact that what is in the target platform is immutable whereas what you have in your workspace changes every time you build it (assuming your features and bundles end with .qualifier). 
Therefore when the build publishes the rcp artifacts, it sees that the artifacts.jar does contain the artifact (the artifacts.jar is the mighty truth) and just does not bother publishing them again. However for the jars being built, the artifacts have new version numbers and as such are not found in the artifacts repo and therefore published.

At this point, one way to address this would be to run a tool that validates the repo.
Comment 2 Dave Orme CLA 2011-02-01 20:27:49 EST
Hi Pascal,

What you're saying makes perfect sense to me from a P2 perspective.

Maybe what I'm saying is that from a UI perspective "Build all" feels like it
should be the equivalent of a Maven/Tycho:

mvn clean install

command.  Does that make sense?

I know, I know, we've never really had the equivalent of a "clean install"
command in Platform/Update either.  

What we've had is really the equivalent of build=="make <target>" and build
all=="make".  If you want "make clean ; make" or "mvn clean install" you've
always had to perform the "clean" operation by hand.  It's just--as you point
out--that the semantics of "clean" have changed.

I guess we can just say that it's a documentation thing.  But I have to admit
that doesn't quite feel right either.

Having a tool to validate a P2 repo is a step in the right direction as long as the tool is run whenever someone clicks one of the "build" buttons in the UI and complains if someone has corrupted their repo.  How would you feel about that option?
Comment 3 Pascal Rapicault CLA 2011-02-02 11:13:12 EST
Please file a bug report referring to this discussion against PDE Build.
Comment 4 Dave Orme CLA 2011-02-04 23:26:48 EST
OK; thanks Pascal
Comment 5 Lars Vogel CLA 2019-09-24 13:58:52 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.