full support for composable libraries/archives
This will require some reworking of dependency management, including changes to providers.
cc_library currently can include other libraries in its manifest, archived or not. But a problem arises when lib deps are required by an executable with archive_deps set to True. That flag tells OBazl to archive the lib deps; the default is no archiving. The problem then is that under the current design the archiving extends to indirect deps. So if the executable depends on lib Colors that embeds a library RGB, then both Colors.cma and RGB.cma will be listed as deps on the link command line. But since Colors.cma contains everything in RGB.cma, this leads to "Files Color.cma and RGB.cma both define a module named Red".
To fix this, the library and binary rules must take more responsibility for constructing deps. In this case, Colors must ensure that RGB.cma is not propagated as a dependency. Currently we use a depset, cli_link_deps to propagate dependencies that need to be put on the link cmd line. The shortcoming of this strategy is that we cannot switch from unarchived to archived libs.
The fix is to use a new depset, link_archives_deps, to contain archives (as well as any freestanding modules required), which complements cli_link_deps, which contains only modules (libs not archives).
This requires a new provider, OCamlLibraryProvider, that contains a manifest fld of the libraries it contains, as well as an archive field for the cma/cmxa files. Then any consumer of a lib must construct the link depsets appropriately.
This also requires a new OCamlModuleProvider so we can do the same for freestanding modules. An executable may require both libs and freestanding modules; in both cases, indirect deps must also be listed. The binary rule obtains the list from the link depsets. But deps must also be merged, since there may be duplicates etc.
etc.