Suggestion: Platform References in Shared Code Projects

For your consideration. :slight_smile:

It could be useful to be able to specify required references in a Shared Code project. Within the Shared Code project there would need to be some way to determine the platform specific references involved. When a Shared Code Project is added to the References of some hosting project, the Shared Code References applicable to the host project platform would be merged with/added to the References of that host project.

e.g. I have a Shared Code Project which encapsulates sqlite. For Java this requires a Reference in the host project to the JDBC sqlite drive. For OS X the libsqlite3 library. For .NET there are no references required:

 SQLiteShared
    References
        java
            sqlite-jdbc-3.8.11.2
        .NET
        OSX
           libsqlite3
    SQLiteConnection.pas
    SQLiteParameter.pas
    etc.pas

If the references in the Shared Code project were changed, the host project references would need to be updated. This would be done on project load and an “Update References” context menu on the Shared Project in the host References list could initiate this at any time.

Updating the references in the host project would merge any references in the Shared Project not included in the host project references but I imagine it would be a step too far to try to determine when host project references could be removed due to them no longer being required by the Shared Project (unless the project system can keep track of references which have been explicitly added vs those “imported” from Shared Code).

I like this idea, this is actually part of the ideas we had for the “Gotham” target.

You could probably hack this yourself by editing the project file for the shared project now. Simply add tags, with an appropriate condition. But of course that’s (a) not very clean and (b) will only work for compiling, the IDE won’t see those references).