getHigestVersionNo function

Version getHigestVersionNo(
  1. String pathToPrimaryPackage
)

In a multi-package release (where we have a multi settings file) This method will return the highest version no. used by any of the packages listed in the multi settings file. pathToPrimaryPackage so contain the path to the main package of the multi package project that contains the pub_release.multi.yaml file in its tool directory. In reallity it can be the path to any of the project roots.

Implementation

Version getHigestVersionNo(String pathToPrimaryPackage) {
  final pathTo = join(pathToPrimaryPackage, 'tool', MultiSettings.filename);

  if (!exists(pathTo)) {
    throw PubReleaseException(
        'The ${MultiSettings.filename} was not found at ${dirname(pathTo)}.');
  }

  final settings = MultiSettings.load(pathTo: pathToPrimaryPackage);
  return settings.getHighestVersion();
}