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

We setup the build.properties to split the target main and test
directory and control the build order, by compiling the main source
first and second the test code. If main code referrers to test code
the compile will fail because it don't know about the test class path.

If you are referring to a binary dependency that include both main and
test code, then here is no safeguard to prevent the main code to
access the test code in the dependency. But that will be the case also
for eclipse AFIK

It might be missing something how tycho set-up it's class path, but I
would be happy to share the diff from our 0.8 patch if that could help
to understand what we try to achieve?

regards,
Flemming


2014-09-10 18:39 GMT+02:00 Igor Fedorenko <igor@xxxxxxxxxxxxxx>:
> Can you explain how main classpath is setup during command line build?
> If there is only one manifest and the manifest includes both main and
> test dependencies, I don't see how main classes won't be able to use
> test dependencies.
>
> --
> Regards,
> Igor
>
>
> On 2014-09-10, 12:27, Flemming Harms wrote:
>>
>> Yes, inside Eclipse IDE you don't have any safeguards against uses of
>> test dependencies, but when you build it with maven it will fail
>> because the test dependencies is not available on class path for the
>> main code.
>>
>> This is also the case when working with maven projects only in
>> Eclipse. Inside the IDE there is no safeguard, but when you build with
>> maven it will fail.
>>
>> I'm not saying this should be on by default, but it could be nice if
>> Tycho did support this type of setup by enabling a special property.
>>
>> regards,
>> Flemming
>>
>>
>> 2014-09-10 16:32 GMT+02:00 Igor Fedorenko <igor@xxxxxxxxxxxxxx>:
>>>
>>> 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
>>>>
>>> _______________________________________________
>>> 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