You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Nathan Franzen <Na...@mmodal.com> on 2010/04/30 22:34:41 UTC

ivy native code config example

I've been poring over the various posts from the list (searched over the last year or so) to try to get a good example of how I might arrange my ivy dependencies.   As with a few people on the list, I've got a heterogeneous set of projects and artifacts, c++ code compiled for 32 and 64 bit on both windows and linux, as static and dynamic libraries, with and without JNI and associated jar files.

I wonder if we can put together a simplistic example which still hits all the complicated parts?

Let's say I have a module, the XCal library and four build configurations of it: libXCal.so (32 bit), libXCal.so (64 bit),  XCal.dll (windows dll) and XCal.lib (windows static).   I've also got XCal.jar to go along with the dynamic libraries (but not the static one).   And, for completeness, XCal-headers.zip, a set of header files for downstream projects to compile against.   In theory, the configuration intersections make sense, in practice I don't quite see it.     Any suggestions for the how the ivy.xml <configurations/> should look?    Or if I were to use "extra" attributes, what would you suggest?


After that, the next step is publishing the artifacts to my shared repository.  Here, wiring it up to get the various artifacts to not collide with each other seems hacky.  I tried the ivysettings.xml:

    <macrodef name="artifactory-macro">
      <attribute name="os"/>
      <attribute name="platform"/>
      <url>
        <artifact pattern="http://jebediah:8080/artifactory/shared/[organization]/[module]/[revision]/@{os}/@{platform}/[type]/[artifact]-[revision].[ext]"/>
        <ivy  pattern="http://jebediah:8080/artifactory/shared/[organization]/[module]/[revision]/@{os}/@{platform}/[type]/ivy-[revision].xml" />
      </url>
    </macrodef>

    <resolvers>
       <artifactory-macro name="mmodal-artifactory" os="" platform="" />
       <artifactory-macro name="mmodal-artifactory-windows-32bit" os="windows" platform="32bit" />
       <artifactory-macro name="mmodal-artifactory-linux-32bit" os="linux" platform="32bit" />
       <artifactory-macro name="mmodal-artifactory-linux-64bit" os="linux" platform="64bit" />
    </resolvers>

And in build.xml:

        <ivy:publish artifactspattern="lib/${os}/${compilationtag}/[artifact].[ext]"
                                   resolver="mmodal-artifactory-${os}-${platform}" ....

And that works, I think, but embedding the module configuration into the resolver name seems wrong.   Is there another way?

Suggestions appreciated,
Nate