2010/5/25 Adam Murdoch <[email protected]>

>
>
> On 21/05/10 12:50 AM, jerome moliere wrote:
>
>> Hi all,
>> I'm facing a design question regarding how to layout my project which is a
>> set of demo bundles for an OSGi book coming soon..
>> Saying I've got an OSGi servicecontained in a  com.foo.osgi.service.api
>> Java package, 2 implementation bundles:
>> both providing (export-package directive in MANIFEST.MF bundle descriptor)
>> and giving implementation for this service in com.foo.osgi.service.impl
>>
>> A client bundle would import-package (to use the directive) and may fetch
>> the currently available implementation...
>> From OSGi guru Peter Kriens point of view, it's a  good inhabit to repeat
>> the api classes in each of the implementation bundles
>>
>> That 's where my problem starts...
>> i'd like to know a good Gradle wayhe api  to build such project saying
>> I've got:
>> OSGI-service-sample/
>>            + service-api
>>                   + src/main/java/com/foo ...
>>                   + build/com/foo/...
>>
>>             + impl1
>>                    +src/main/java/com/foo/osgi/service/impl
>>                    + build/com/foo...
>>
>>            + impl2
>>                    +src/main/java/com/foo/osgi/service/impl
>>                    + build/com/foo...
>>            + client-test
>>                    + src/main/java/com/.osgi/client
>>                    + build/com/foo/osgi/client/...
>>
>> Compiling impl1 & impl2 require an access to api classes
>> Jar to be generated would contain  classes from:
>> com/foo/osg/iservice/.api
>> com/foo/osg/iservice/impl
>>
>> Compiling client require access to the same  api classes
>>
>> I don't know to translate this into a proper gradle build....
>> Multi project? Yes it seems trivial
>>
>
> I think multi-project is the simplest way to go, though there are some
> other options. You'd have a project for the API, and a project for each of
> the implementation bundles.
>
>
>  How to customize the artefact generation to include required classes  in
>> the 2 client bundles?
>>
>
> For each of the implementation projects, you can do something like:
>
> evaluationDependsOn(':service-api')
>
> jar {
>    // add in classes from the service-api project
>    from project(':service-api').sourceSets.main.classes
> }
>
>
Thanks for this wise addvice Adam..
i'll try it soon ...


Jerome

-- 
Jerome Moliere - Mentor/J
http://romjethoughts.blogspot.com/
auteur Eyrolles

Reply via email to