Hi, I want to create a plugin that will allow using Gradle to build C/C++ artifacts. The issue I want to tackle is dependency management.
Basically, a project can create 4 types of artifacts: a library (static / shared) or an executable and header files. To compile, one needs the headers, to link, one needs the library. So, in Ivy, if I have the configuraitons 'executable', 'shared', 'static', 'devel', then dependencies map to 'devel->devel' and 'static'->'static' and executable/shared are mapped to 'shared' or 'static' according to the type of library that is used. The different artifacts map to different configurations (via publications). In Gradle, I want to have 'shared' and 'static' dependencies of the 'compile' configuration and create from them the above Ivy dependency. So if i have 'compile-shared "some.org:amodule:1.0:shared"', it will create an Ivy module descriptor with a 'devel' configuration (for compiling) and 'shared' configuration (for linking) mapped to 'shared' configuration of 'amodule'. So far, sounds ok? My problem is then how to change the way Gradle maps the dependencies in the gradle file to Ivy modules. My digging shows this (for 0.1.4): 1. Ivy module descriptors are created by ModuleDescriptorConverter. DefaultDependencyManger has an instance of it passed through its ctor. 2. The DependencyDescriptor is created by the Dependency instances, created by a DependencyFactory instance, also a member of DefaultDependencyManger, through its ctor 3. DefaultDependencyManager is created by DefaultDependencyManagerFactory, the instance of which is used by DefaultSettings and ProjectFactory, both are created statically through Build.newInstanceFactory (through SettingsProcessor). 4. newInstanceFactory is called by Main and returns a closure, so it is not easily manipulated. 5. 'dependencies' used in the project file is a method in DefaultProject which calls DependencyManager methods. DependencyManager is an interface, I think all this means that I can't do what I want (extend the module converter to create a special kind of Ivy module and create a new Dependency class so it create the right Ivy dependency construct). I think this can be solved by using IOC conventions so that every object has 'set' methods to set the services it uses. Then, even if Main/Build create default instances, a plugin can redefine them. What do you think? Ittay -- View this message in context: http://www.nabble.com/design-question-tp17848015p17848015.html Sent from the gradle-dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
