Bug 20119 - Run-time libraries exported through more than 2 plugins not in classpath
Summary: Run-time libraries exported through more than 2 plugins not in classpath
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: Build (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Rodrigo Peretti CLA
QA Contact:
URL:
Whiteboard:
Keywords: readme
: 21405 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-06-13 03:32 EDT by Antonin Pokorny CLA
Modified: 2002-07-10 10:50 EDT (History)
1 user (show)

See Also:


Attachments
example (23.22 KB, application/zip)
2002-06-13 03:33 EDT, Antonin Pokorny CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antonin Pokorny CLA 2002-06-13 03:32:13 EDT
The operation "Create feature JAR" generates build.xml's
in plugins directories with missing runtime libraries
which are reexported through more than 2 plugins.

EXAMPLE:
   samplePluginA 
	lib/a.jar (exported)


   samplePluginB (depends on samplePluginA, dep. reexported)
	lib/b.jar (exported)


   samplePluginC (depends on samplePluginB, dep. reexported)

   samplePluginD (depends on samplePluginC, dep. reexported)

   sampleFeature (contains plugins A,B,C,D)

The action "Create Feature JAR" generates build.xml in pluginD
with the following contents:

	<target name="samplePluginD.jar" depends="init" 
unless="samplePluginD.jar">
		<property name="destdir" 
value="${temp.folder}/samplePluginD.jar.bin"/>
		<delete dir="${temp.folder}/samplePluginD.jar.bin"/>
		<mkdir dir="${temp.folder}/samplePluginD.jar.bin"/>
		<!-- compile the source code -->
		<javac destdir="${temp.folder}/samplePluginD.jar.bin" 
failonerror="false" verbose="true" debug="on" includeAntRuntime="no" 
bootclasspath="${bootclasspath}" 
classpath="../samplePluginC/samplePluginC.jar;../samplePluginB/lib/b.jar;../../p
lugins/org.eclipse.core.runtime_2.0.0/bin;../samplePluginB/bin;../samplePluginC/
bin;../../plugins/org.eclipse.core.boot_2.0.0/bin;../../plugins/org.eclipse.core
.runtime_2.0.0/runtime.jar;../../plugins/org.eclipse.core.boot_2.0.0/boot.jar;..
/samplePluginB/samplePluginB.jar">
			<src path="src/"/>
		</javac>
		<!-- copy necessary resources -->
		<copy todir="${temp.folder}/samplePluginD.jar.bin">
			<fileset dir="src/" excludes="**/*.java"/>
		</copy>
		<mkdir dir="${build.result.folder}"/>
		<jar jarfile="${build.result.folder}/samplePluginD.jar" 
basedir="${temp.folder}/samplePluginD.jar.bin"/>
		<delete dir="${temp.folder}/samplePluginD.jar.bin"/>
	</target>
	
I can find "../samplePluginB/lib/b.jar" in classpath, which is good, 
but "../samplePluginA/lib/a.jar"
which I would expect to be there is missing.

The whole example is attached.
Comment 1 Antonin Pokorny CLA 2002-06-13 03:33:10 EDT
Created attachment 1387 [details]
example
Comment 2 Rodrigo Peretti CLA 2002-06-13 11:19:27 EDT
Seems like a bug. Needs further investigation.
Comment 3 Rodrigo Peretti CLA 2002-06-14 14:54:46 EDT
Yes, it is a bug in AbstractBuildScriptGenerator.addPrerequisiteLibraries(). 
When a plug-in exports a pre-requisite, instead of calling the same method ( 
AbstractBuildScriptGenerator.addPrerequisiteLibraries() ) for its pre-
requisite, we only add its libraries (calling addLibraries()). So, if the pre-
requisite plug-in also exports another plug-in, it won't be added to the 
compile path.

The fix is trivial. We only need to call addPrerequisiteLibraries() instead of 
addLibraries(). Since addPrerequisiteLibraries() calls addLibraries() there is 
no major change in the algorithm.

Recommend fixing.
Comment 4 Nick Edgar CLA 2002-06-16 22:11:20 EDT
Is there any risk of encountering a project cycle in the proposed fix?
If so this could hang Eclipse.

Comment 5 Rodrigo Peretti CLA 2002-06-17 14:06:37 EDT
Yes, it could happen. Just tried and got a StackOverflowError (runtime-
workbench).
Comment 6 Rodrigo Peretti CLA 2002-06-17 14:26:44 EDT
Handling the project cycle would be a major change. Since the workaround is 
simple (writing a custom build.xml) we will defer the fix to after 2.0.

Workaround:

1) Generate a build.xml using PDE Build (Create Plug-in JARs)
2) Edit the build.properties with the following line:
   custom = true
3) Add the missing JARs to the build.xml (javac task)
4) Release the new build.properties and build.xml to the repository
Comment 7 DJ Houghton CLA 2002-06-17 14:44:55 EDT
Add to readme.
Comment 8 Rodrigo Peretti CLA 2002-07-09 14:42:33 EDT
Reopening.
Comment 9 Rodrigo Peretti CLA 2002-07-09 14:43:24 EDT
*** Bug 21405 has been marked as a duplicate of this bug. ***
Comment 10 Rodrigo Peretti CLA 2002-07-10 10:50:37 EDT
Fixed and released to HEAD. The cycle issue has also been handled. If a cycle 
is found a CoreException will be thrown.