Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Packaging (test) plug-ins as directories (not jar files)

Hi,

now that all my tests are up and running for a couple of days, I thought
that I quickly share the lessons learned (although they might be quite
specific to my own setup).

The scenario is that I had an Eclipse workspace from which I could run
my stuff within a Runtime Workbench, and I could execute my tests with
"Execute as/JUnit plug-in". However, I never bothered to come up with a
build, since I didn't have any users (I'm doing academic research).
Since that started to change, I tried to come up with a build using tycho.

And my tests didn't run for 3 reasons:
1. When starting an Eclipse runtime workbench, the plug-ins in your
workspace do not get packed as a jar. Therefore, files within the
plug-ins could be accessed by the tests without problems. For, the
build, however, I had to add the "Eclipse-BundleShape: dir" manifest
attribute to avoid that, as pointed out by Igor.
2. I also needed to add all resources needed to run my tests to the
build section of the manifest - otherwise, they will not end up in the
packaged plug-ins.
3. Finally, the runtime workbench has access to all plug-ins in my
development workspace. However, When tycho runs a test, it only makes
the plug-ins available which are in the dependencies of that test. Since
my tests needed to access some files within other plug-ins, I had to
explicitly add these plug-ins to the test's dependencies.

I'm well aware that these "hints" are only workaround for my tests being
a collection of anti-patterns :-) - however, they might still be useful
for some folks (or not).

Cheers,
Christian


Am 25.08.2011 13:55, schrieb Igor Fedorenko:
> Tycho honours "Eclipse-BundleShape: dir" bundle manifest attribute
> 
> -- 
> Regards,
> Igor
> 
> On 11-08-25 6:32 AM, Christian Soltenborn wrote:
>> Hey Alex,
>>
>> thanks for your fast hint! However, this would also result in huge
>> changes to my code base, since my code is relying on java.io.File
>> objects being passed around... stupidly, I must now say :-) :-(
>>
>> Cheers,
>> Christian
>>
>>
>> Am 25.08.2011 11:50, schrieb Alex Blewitt:
>>> If you move the files onto the classpath you can then read them with
>>> class.getResourceAsStream() in both workbench and jars. Note that
>>> bundle.getEntry doesn't work the same however.
>>>
>>> Alex
>>>
>>> Sent from my (old) iPhone
>>>
>>> On 25 Aug 2011, at 10:17, Christian Soltenborn<csoltenborn@xxxxxx> 
>>> wrote:
>>>
>>>> Hi there,
>>>>
>>>> first of all: thanks to the tycho team for this great build tool!
>>>> However, I'm facing a couple of little problems, with which I might be
>>>> annoying you in the next couple of days.
>>>>
>>>> Here's the first one: Up to now, I did not have an automated build (in
>>>> fact, two students of mine failed to set one up with pre-tycho
>>>> technology). As such, I have executed my tools within a runtime
>>>> workbench, which worked fine. I also executed my tests from within my
>>>> development workbench as Junit Plug-in Tests.
>>>>
>>>> Now, the problem is that some of my tests are failing when run by
>>>> tycho.
>>>> It seems that the cause is that the test plug-ins contain files to be
>>>> read by the tests. When I execute them from within the development
>>>> workbench, this is not an issue, since the files are read from the
>>>> plug-in's project directories. Tycho, however, packs my test plug-ins
>>>> into jars (which is perfectly fine as far as I know), causing my tests
>>>> to fail reading those files.
>>>>
>>>> I'm aware that I should rewrite my tests and some parts of my tool's
>>>> code, but this would result in a huge effort I'm not currently willing
>>>> to take. So, my question is whether I can make tycho not packaging my
>>>> tests as jars, but as simple directories, such that the files can still
>>>> be accessed.
>>>>
>>>> Any other suggestion to cope with this problem is of course more than
>>>> welcome, too.
>>>>
>>>> Thanks in advance,
>>>> Christian
>>>> _______________________________________________
>>>> tycho-user mailing list
>>>> tycho-user@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/tycho-user
>>> _______________________________________________
>>> tycho-user mailing list
>>> tycho-user@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/tycho-user
>>>
>>
>>
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/tycho-user
> 


-- 
Antoine de Saint-Exupery: "Language is the source of misunderstandings."


Back to the top