Bug 226026 - Support p2 metadata generation on product export
Summary: Support p2 metadata generation on product export
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2008-04-07 14:35 EDT by Darin Wright CLA
Modified: 2008-04-28 09:34 EDT (History)
4 users (show)

See Also:


Attachments
Change to PDE UI to call second script (2.81 KB, patch)
2008-04-11 14:26 EDT, Curtis Windatt CLA
no flags Details | Diff
example changes (3.02 KB, patch)
2008-04-17 18:18 EDT, Andrew Niefer CLA
no flags Details | Diff
Fix for PDE Core (5.63 KB, patch)
2008-04-21 17:17 EDT, Curtis Windatt CLA
no flags Details | Diff
mylyn/context/zip (5.91 KB, application/octet-stream)
2008-04-28 09:34 EDT, Chris Aniszczyk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2008-04-07 14:35:58 EDT
I20080401-0851

When I export plug-ins I get a p2repo in the export with content.xml and artifacts.xml (and plugins). However, I cannot install any plug-ins from the "Software Updates..." UI. 

According to Pascal, the repo is created with the correct metadata, but the UI is only showing groups (features).

If we can't import from the repo we should not create it... however, I would rather see the repo created with the appropriate metadata such that we *could* install from it. This feels like a good story for the common scenario of running with the latest plug-ins.
Comment 1 Darin Wright CLA 2008-04-07 14:39:30 EDT
Andrew, currently we set the following properties during the plug-in export. Is there something else we have to set in order to create an appropriate feature/group to support the install?

fAntBuildProperties.put("generate.p2.metadata", "true");
fAntBuildProperties.put("p2.flavor", "tooling");
fAntBuildProperties.put("p2.publish.artifacts", "true");
try {
	fAntBuildProperties.put("p2.metadata.repo", new File(fInfo.destinationDirectory, "p2repo").toURL().toString());
	fAntBuildProperties.put("p2.artifact.repo", new File(fInfo.destinationDirectory, "p2repo").toURL().toString());
} catch (MalformedURLException e) {
	PDECore.log(e);
}
Comment 2 Susan McCourt CLA 2008-04-07 15:40:16 EDT
For the UI to present it as an available IU, it needs to have IInstallableUnit.PROP_TYPE_GROUP  ("org.eclipse.equinox.p2.type.group") set to true.
Comment 3 Andrew Niefer CLA 2008-04-07 16:21:48 EDT
PDE.Build generates 2 kinds of assemble/package scripts:
package.<feature>.all.xml
package.<feature>.<config>.xml

The integration with p2 occurs in both these script, the package.<feature>.<config>.xml will call p2 to generate IUs for bundles as well as configuration CUs.
The package.<feature>.all.xml contains a final call to p2 to generate a top level root or product IU containing everything that was built.

PDE.UI calls the assemble.<feature>.<config>.xml scripts directly and does not go through the .all.xml script so the final top level IU is missing.  UI will need to  make an additional runScript call to invoke the "generate.p2.metadata" target in the package.<feature>.all.xml script.
Comment 4 Curtis Windatt CLA 2008-04-11 12:18:27 EDT
After adding a call to the generate.p2.metadata target in the script, I still do not get a group/feature to import.  The call to the script completes successfully, no errors, all the needed properties are set.  However, none of the exported files get modified.

Any suggestions?
Comment 5 Curtis Windatt CLA 2008-04-11 14:26:59 EDT
Created attachment 95730 [details]
Change to PDE UI to call second script

Quick patch that adds the call to the second script.
Comment 6 Curtis Windatt CLA 2008-04-14 12:13:30 EDT
Simply calling the second script is not satisfactory.  The script does not have the necessary information (state).  PDE-Build/p2 is looking into it.
Comment 7 Andrew Niefer CLA 2008-04-14 12:33:19 EDT
Sorry, I thought I wrote a comment here on friday, but it looks like I neglected to hit the commit button.  Problem stems from how the AntRunner uses class loaders. 

As well, the way that separate platforms are built independently of each other means that the final p2 call to create the container really needs to happen after all the platforms are built.
Comment 8 Andrew Niefer CLA 2008-04-15 13:02:15 EDT
I have released changes to HEAD for pde.build and p2.metadata.generator.  

For feature and plugin exports for a single platform, PDE/UI needs to set "p2.root.name" and "p2.root.version" properties to give a name and version to the top level root IU for the export.  I'm not sure where you should get values for these, some new UI might be necessary.

For products, name and version come from the .product file, see bug 218672.  For multiplatform exports, this final call to p2 needs to happen after all platforms are done.
Comment 9 Andrew Niefer CLA 2008-04-15 16:24:11 EDT
We decided that export will only do p2 generation for products.

For p2 generation for product export, pde.build needs to generate a script UI can call to do the final IU generation (due to the independent builds for each platform).  This final call will be equivalent to the final p2 call in the package all script.

The root.name and version properties remain in place for use during a headless build.
Comment 10 Curtis Windatt CLA 2008-04-16 14:18:48 EDT
Renaming to reflect new priority.
Comment 11 Andrew Niefer CLA 2008-04-17 18:18:24 EDT
Created attachment 96524 [details]
example changes

PDE.Build changes are done.

See attached patch for beginnings of how to use these changes.
Comment 12 Curtis Windatt CLA 2008-04-21 17:17:13 EDT
Created attachment 96931 [details]
Fix for PDE Core

This patch adds support to PDE Core to generate p2 metadata.  Everything seems fine and well in my testing, but it would be awesome if others could test the patch before it gets committed.
Comment 13 Curtis Windatt CLA 2008-04-21 17:18:02 EDT
cc'ing Chris, as he knows more about testing product export.
Comment 14 Chris Aniszczyk CLA 2008-04-21 19:14:12 EDT
Will test after the 4/22 i-build.

Looks clean for now.
Comment 15 Chris Aniszczyk CLA 2008-04-21 19:14:49 EDT
btw, Thanks for your hard work on this Curtis
Comment 16 Chris Aniszczyk CLA 2008-04-24 05:23:35 EDT
I will review this on the plane more in depth before I feel comfortable. A long plane ride is enough time to test some scenarios ;)
Comment 17 Chris Aniszczyk CLA 2008-04-27 18:59:55 EDT
I don't like the user experience of this at all... I'm thinking a preference to "Include generated repository" as an option that is off by default.

The fact that we generate duplicates of everything is really confusing for users.

Will investigate tomorrow further.
Comment 18 Chris Aniszczyk CLA 2008-04-28 09:34:20 EDT
done.

> 20080428

Added a preference that is off by default for this option. We can revisit how to make this a smoother experience in 3.5... I would really prefer that metadata generation be done via the Update Site mechanism in Eclipse... versus this way.
Comment 19 Chris Aniszczyk CLA 2008-04-28 09:34:24 EDT
Created attachment 97761 [details]
mylyn/context/zip