Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Fwd: Splitting source and test artifacts

Just to state the obvious, this setup does not provide any safeguards
against (accidental) use of test dependencies in main code. The test
dependencies will also get wired to the bundle at runtime if they happen
to be available. Also, I am not sure how p2 handles optional
dependencies, so there is a chance the test dependencies will actually
be installed.

I think proper separation between main and test dependencies is required
before this can be accepted in Tycho as general purpose feature.

--
Regards,
Igor

On 2014-09-10, 10:18, Flemming Harms wrote:
I'm far from sure what is the right solution is, but I can tell you
how we handle it with tycho 0.8, and they you can decide if you think
this is a good solution

Because we have both source and test in the same plug-in we also
maintained dependencies for both in the same MANIFEST file (of
course). So for any test specific dependencies we marked it optional.
When the EclipsePluginProjectImpl is instantiated we split the source
and test into two jars files based on the build.properties. Because
the source and test is placed in the same plug-in we assume the
dependencies is the same for both the main and test artifact.

When the ClasspathComputer.computeClasspath is invoked from the
AbstractOsgiCompilerMojo it also add all the test bundles for the
specific plug-in. The PackagePluginMojo will create two JAR files, one
with sources and one with the tests.

There is of course bit more to it then I just listed, but I hope you
get the general idea.

Regards,
Flemming

2014-09-04 14:11 GMT+02:00 Igor Fedorenko <igor@xxxxxxxxxxxxxx>:
How do you propose to manage different classpaths for main and test code?

--
Regards,
Igor


On 2014-09-04, 5:05, Flemming Harms wrote:

Hi All

I need a bit of advice regarding splitting source and test artifacts.
I know it's best practices to have a Eclipse plug-in and a test
plug-in when working with Eclipse RCP etc. And in maven it's not a
problem having source and test code in the same project and still
produce a source and test artifacts, and control dependencies with
scoping.

Long time ago we took a decision to merge our test-plugin with the
source-plugin to reduce the number of plug-ins to 200+ because of
various reasons. We have been using Eclipse RCP  and tycho(0.8) from
it's early days.

In tycho 0.8 we did a little hacking so it actual was able to build
source and test artifacts and when the reactor kicked in we automatic
added the test artifact so dependencies could be resolved and unit
test could run. It was not pretty, but it did worked and was a fairly
small change for us to do.

We are now upgrading Tycho to the latest version and of course we
would prefer to use it as it is :). But it's not possible for us to
split plug-ins into a source and test plug-in at the moment, and we
still need to produce a source and test artifacts

With all this in mind, is it possible to achieve this with the newest
version of Tycho?

Otherwise would accept a patch that add support for this type of
setup? we would happy to contribute it

Thanks!

br
Flemming
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user



Back to the top