Bug 251170 - PDE UI not honoring allowBinaryCycles attribute
Summary: PDE UI not honoring allowBinaryCycles attribute
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.5 M3   Edit
Assignee: Chris Aniszczyk CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2008-10-16 22:30 EDT by Jorge D. Rodriguez CLA
Modified: 2009-02-25 11:20 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorge D. Rodriguez CLA 2008-10-16 22:30:54 EDT
Build ID: Can be found on Eclipse 3.4

Steps To Reproduce:
1.Create a plugin project
2.Add a dependency on the manifest file and point to a binary plugin (a plugin that is already compiled) that has a circular dependency with another binary plugin.
3.  Try to export the plugin using the Export task (Export as Deployable plug-ins and Fragments)

Results: you will get an error message similar to this:
Problems during export
  A cycle was detected when generating the classpath com.ibm.director.wparmgt.common.core.services_1.0.0, com.ibm.usmi.kernel.USMIKernel_1.0.0, com.ibm.usmi.services.slp_1.0.0, com.tivoli.twg.legacylibs_1.0.0, com.ibm.usmi.kernel.USMIKernel_1.0.0.
  A cycle was detected when generating the classpath com.ibm.director.wparmgt.common.core.services_1.0.0, com.ibm.usmi.kernel.USMIKernel_1.0.0, com.ibm.usmi.services.slp_1.0.0, com.tivoli.twg.legacylibs_1.0.0, com.ibm.usmi.kernel.USMIKernel_1.0.0.


More information:
This problem is related with bug 208011. There is a fix that was introduced on Eclipse 3.4 to allow PDE build to export plugins with circular dependencies on binary plugins (see comment #13 from bug report).  This works for headless builds but it does not work when the plugin is exported from the UI.  The export task does not read the allowBinaryCycles  property from the build.properties that is part of the project.
Comment 1 Andrew Niefer CLA 2008-10-17 11:06:49 EDT
To clarify, the "allowBinaryCycles" property is set in the build configuration build.properties for a headless build.  (Even headless build does not read it from the bundle's build.properties file).

For UI to set this, in FeatureExportOperation#setupGenerator they would need to call generator.setImmutableAntProperties(properties), with a properties object containing allowBinaryCycles set to true.
Comment 2 Curtis Windatt CLA 2008-10-17 11:22:12 EDT
So this option can only be turned on/off for the whole build process?  It can't be done on a per bundle basis?  If we search the build.properties file for this option and it is turned on for one bundle, but turned off for another in the same export, what option should be the default?
Comment 3 Andrew Niefer CLA 2008-10-17 13:17:27 EDT
 Build does not support this on a per-bundle basis.
For UI to set it based on the contents of the bundle's build.properties would be misleading if headless build does not support the same.  And, if headless build did support it, then there would be nothing for UI to do.

So the options would be:
1) UI sets the option always for everyone (or perhaps based on a preference)
2) Send this back to build to support it on a per-bundle basis.

Comment 4 Chris Aniszczyk CLA 2008-10-17 13:19:48 EDT
Andrew, what is the negative of always setting this?

What trouble can we get into?
Comment 5 Andrew Niefer CLA 2008-10-17 13:36:21 EDT
Build's implementation of this is in cases where we would have failed with a "A cycle was detected..." message, for some cycles which we can identify as something we can compile, we instead allow the build to continue.

So worst case would be if we mis-identified the cycle as compileable you would get compile errors instead of the cycle message.
Comment 6 Chris Aniszczyk CLA 2008-10-17 14:28:13 EDT
I really hate cycles :)

However, I'm comfortable with always enabling this as I think this doesn't happen much in the wild. What do you think Andrew? I don't know if it's worth it on your end to implement this on a per-bundle basis.
Comment 7 Jorge D. Rodriguez CLA 2008-10-17 15:03:20 EDT
Hey guys,

As I see it there are several scenarios that need to be covered if you guys decide to make it configurable.

The scenarios are:
1. Exporting a single plugin selected by the user
2. Exporting multiple plugins selected by the user.
3. Exporting a feature.

If this is something that is not going to be read from the build.properties file in the project then it would be nice if it was an option that the user can select when using the Export wizard.  Currently there are some options that are exposed through the wizard (i.e. Package plug-ins as individual jars) so this would be an additional option that would have to be exposed.  I am not sure if there is a different implementation for exporting a feature but this option would also have to be exposed when exporting a feature. 
Comment 8 Andrew Niefer CLA 2008-10-24 16:45:01 EDT
The property to turn this on is
IBuildPropertiesConstants.PROPERTY_ALLOW_BINARY_CYCLES == "true"

This needs to be added to a Properties object and set on the generator with generator.setImmutableAntProperties().

I would have suggested adding the property in createAntBuildProperties and passing that to generator.setImmutableAntProperties(properties)  but setImmutableAntProperties takes a Properties object, and createAntBuildProperties creates a HashMap.


You could either change createAntBuildProperties to return a Properties, or make a new properties to pass to the generator.

Comment 9 Chris Aniszczyk CLA 2008-10-26 14:17:39 EDT
mine
Comment 10 Chris Aniszczyk CLA 2008-10-26 14:19:59 EDT
done.

> 20091026
Comment 11 Chris Aniszczyk CLA 2008-10-26 14:24:14 EDT
There's a new option when you export a feature, plug-in or product to allow for binary cycles in the target. This option is ON by default.

I hope this helps you Jorge.
Comment 12 Philip K. Warren CLA 2009-01-20 18:59:20 EST
Which files were changed to enable this option? What would it take to backport similar behavior to 3.4.x?
Comment 13 Curtis Windatt CLA 2009-01-21 09:11:31 EST
(In reply to comment #12)
> Which files were changed to enable this option? What would it take to backport
> similar behavior to 3.4.x?
> 

Since 3.4.2 is moving into release candidate builds today, there is no way we are going to be able to backport this new behaviour.

I do not have an exact list of files that were changed, but they include FeatureExportOperation and subclasses as well as ExportOptionTab/ProductExportWizardPage for the UI changes.
Comment 14 Chris Barlock CLA 2009-02-24 17:35:49 EST
I just tried this with the latest 3.5 integration build.  Works nicely.  However, you get the same "cycle detected" error if you right-click plugin.xml and select PDE Tools > Create Ant Build File.
Comment 15 Chris Barlock CLA 2009-02-25 11:20:11 EST
I opened bug 266139 for the Ant build problem.