Surf will happily support multiple versions of Aikau JARs from a widget/service perspective because each JAR contains an extension module that is auto-indexed such that the latest version of Aikau updates the AMD configuration last so that the Aikau package is configured to use that version.
However, we've started to introduce library files (e.g. service-filtering.lib.js and doclib.lib.js) and these are used in WebScript controllers as import statements.
This means that where there are multiple versions of Aikau in a Surf application the library file that is used will simply be the first version found on the classpath. We need to find a way of resolving this.
Options that I've considered so far are:
- Make each version of Aikau add a new path to the classpath such that latest version is first on the classpath - however, I'm not even sure that this is possible especially since we've encountered lots of bugs in the area already
- Have versions managed on the path of the lib files, so that when a change is made a new path is added - this seems a bit crazy, but would at least ensure that right version of the library file was being picked up - but it would mean that if developers wanted to take advantage of library file updates they would need to manually update their import statements. This actually could be a benefit though, where a specific version was written used it would be that application of AMPs containing new versions, etc would not introduce unexpected behaviour.
- Remove the library files altogether and host them in their own project and therefore delegate all maintenance to the developer. The problem with this is that library files already exist in released versions of Aikau so going forwards we'd need to ensure different names are used and not make any changes to the existing files.
There may be other options that I've not considered... e.g. more extreme measures like updating Surf to programmatically tackle the imports and select the correct version, or allow for property values to be set (e.g. where a property might be an Aikau version)