On 03/01/2012 16:06, Oberlies, Tobias wrote:
Igor Fedorenko wrote:
In order to handle optional dependencies, we've introduced new
<optionalDependencies> configuration parameter. If the parameter set to
"require", the default, Tycho will treat optional dependencies as
required and will fail the build if any of the optional dependencies is
missing or cannot be resolved for some other reason. If set to "ignore",
Tycho will completely ignore the optional dependencies.
The behaviour described above controls project compile classpath and
contents of OSGi test runtime of eclipse-test-plugin project.
Currently, this doesn't work reliably [1].
IMHO the requirements for the test runtime are generally different to what is needed for compilation, so I think there should be separate parameters for each.
True (except that I met that more "sometimes" than "generally"), but
you have different poms and artifacts for your bundles and your
tests, So you already can configure your build and tests
independently - you can have bundle with optionalDepedencies=require
and bundle.test with optionalDependencies=ignore. The only case that
justifies the need for several flags for compile and test is if your
test has some optional depdendencies you don't want to have in the
platform when running this test... I am not sure it is so a valid
use-case.
Does ignoring optional-dependencies during compilation really make
sense? PDE Tooling automatically adds them to the build path, and I
don't think many people complained about that, so I am not sure
whether this should be necessary to make that a compile option.
However, I am still not sure on how OSGi optional dependencies are
actually used and should be used, it looks more like a hack to avoid
splitting a bundle into 2 parts...
Considering optional-dependencies is only relevent when installing
or preparing a runtime platform. So the flag only makes sense for
Tycho plugins that will perform a call to p2.
It is possible that some people want to have only _some of_ the
optionalDependencies available. In that case, using the
<dependency/> element in tycho-surefire-plugin, or putting an
explicit dependency in the bundle.test MANIFEST.MF (which is useless
at compilation, but often necessary for execution, see [1]) work
well.
Tycho already provides good ways to control the test runtime.
Do you have other use cases than the "tycho can't compile against
optional dependencies" one? If not, maybe just adding by default
optional dependencies just for tycho-compiler-plugin would be
enough.
My 2c ;)
[1]
http://mickaelistria.wordpress.com/2011/09/27/swtbot-tip-of-the-day-explicit-your-test-depends-on-ui-contributors/
--
|