9

There are already some questions about dependency managers here, but it seems to me that they are mostly about build systems, while I am looking for something targeted purely at making dependency tracking and resolution simpler (and I'm not necessarily interested in learning a new build system).

So, typically we have a project and some common code with another project. This common code is organized as a library, so when I want to get the latest code version for a project, I should also go get all the libraries from the source control. To do this, I need a list of dependencies. Then, to build the project I can reuse this list too.

I've looked at Maven and Ivy, but I'm not sure if they would be appropriate for C++, as they look quite heavily java-targeted (even though there might be plugins for C++, I haven't found people recommending them).

I see it as a GUI tool producing some standardized dependency list which can then be parsed by different scripts etc. It would be nice if it could integrate with source control (tag, get a tagged version with dependencies etc), but that's optional.

Would you have any suggestions? Maybe I'm just missing something, and usually it's done some other way with no need for such a tool? Thanks.

Roman L
  • 3,006
  • 25
  • 37
  • @7vies: I don't know any tool, the company I work for ended up rolling its own system (which now does so much it went far beyond the initial goal), I am really interested in existing free approaches, if only to perhaps glean ideas :) – Matthieu M. Jan 04 '11 at 16:27
  • @Matthieu: that's an option, but I would prefer to customize an existing tool for our needs – Roman L Jan 04 '11 at 16:30
  • You can use Maven with http://duns.github.com/maven-nar-plugin/ (C, C++, .so etc.). Based on that you can create dependency information which give you the list of component/module/lib which a module depends on for the build. If the components have been deployed independently by others you can use an other pluing (maven-versions-plugin http://mojo.codehaus.org/versions-maven-plugin/examples/display-dependency-updates.html) to see if a newer version of module etc. exists. So you can update your dependencies. – khmarbaise Jan 04 '11 at 17:13
  • @khmarbaise: I know about those plugins, but I'd like to have an opinion of someone who really used those things. I also heard bad things about Maven, and there are people stating that it is evil, so I have doubts – Roman L Jan 04 '11 at 17:29
  • @7vies: reading on your question I was wondering, do you wish to automatically depend on the newest version or do you want to be able to specify a specific version or a binary-compatibility version ? – Matthieu M. Jan 04 '11 at 19:14
  • @Matthieu: I'm not sure if I got your question right, but I would expect dependencies to have optional attributes such as version number etc – Roman L Jan 04 '11 at 19:31
  • @7vies: I'm using maven for now four years (large and small projects) and made a proof of concept for the maven-nar-plugin for C++ projects (comprising of 70 modules). On the other hand what kind of evilness did you heard about maven? – khmarbaise Jan 04 '11 at 19:32
  • @khmarbaise: Nothing specific, I just saw different opinions here and there. If you could post an answer describing a bit your experience with Maven and C++, what you use it for (only dependency management, or something more), that would be great and is probably the answer to my question! – Roman L Jan 04 '11 at 19:40

2 Answers2

2

You can use Maven in relationship with C++ in two ways. First you can use it for dependency management of components between each other. Second you can use Maven-nar-plugin for creating shared libraries and unit tests in relationship with boost library (my experience). In the end you can create RPM's (maven-rpm-plugin) out of it to have adequate installation medium. Furthermore i have created the installation for CI environment via Maven (RPM's for Hudson, Nexus installation in RPM's).

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • for me it's windows/MSVC, so it's somehow different. I'd like to know how successfully Maven's dependency management worked for you, have you noticed any limitations or felt that you need some other tool? – Roman L Jan 04 '11 at 20:04
  • If you only care about Windows, what about using msbuild? I imagine that Visual Studio has some support for such features. PLus if you happen to have the latest Visual Studio 2010, you might find this presentation interesting:http://blogs.msdn.com/b/vcblog/archive/2011/01/06/alm-for-c-in-visual-studio-2010.aspx – Paulo Pinto Jan 13 '11 at 12:35
  • I am interested in managing dependencies of multiple C++ repositories with maven. Where can I find a tutorial ? – dilig0 Sep 18 '13 at 12:51
1

I'm not sure if you would see an version control system (VCS) as build tool but Mercurial and Git support sub-repositories. In your case a sub-repository would be your dependencies:

Use your VCS to archive the build results -- needed anyway for maintenance -- and refer to the libs and header files in your build environment.

If you are looking for a reference take a look at https://android.googlesource.com/platform/manifest.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Raphael Bossek
  • 1,904
  • 14
  • 25
  • 1
    This is a very simplified model of dependencies, there are always limitations which I'm pretty sure will cause problems as `svn:externals` do – Roman L Jan 04 '11 at 18:16
  • I've experience with Debian's (the well known Linux distribution) and their build environment. It's very Debian and Linux centric and you have to follow lot of rules, e.g. you have to use the package management system including self maintained repositories. If you follow all that you get a great development and deployment environment -- version dependencies,conflicts,replacements,alternatives at development and deployment time. I never saw anything comparable but it's very Debian and Linux specific. You have constrains everywhere. You have to choose something where you can get control over it. – Raphael Bossek Jan 04 '11 at 18:37
  • in this case the package management system is the dependency manager. And of course it is not based on sub-repositories and not in-built into some VCS... – Roman L Jan 04 '11 at 19:02
  • @7vies: Yes, the package management tools do the job. The developers have to use them as part of the production process but on the other hand you get all these neat features -- otherwise you have to implement them yourself. Choose a tool where you feel comfortable to make extensions e.g. by a existing plug-in system. You will find anytime something that need your modifications or extensions. Nothing is perfect because everybody have it's own challenges -- different products, different 3rd party libraries and tools, different development philosophy! – Raphael Bossek Jan 04 '11 at 19:18