Open aly76 opened 2 years ago
@rody Can you weigh in your thoughts here
something like:
SELECT Package2.Name, MajorVersion, MinorVersion, PatchVersion, max(BuildNumber)
FROM Package2Version
WHERE (Package2.Name = 'logging' AND MajorVersion=0 AND MinorVersion=1 AND PatchVersion=0)
OR (Package2.Name = 'async-framework' AND MajorVersion=0 AND MinorVersion=1 AND PacthVersion=0)
GROUP BY Package2Id, Package2.Name, MajorVersion, MinorVersion, PatchVersion
with a dynamic WHERE
section (note that you are limited in the size of that section)
I'm assuming that we are trying to find the latest build of a declared dependency, not the absolute latest package version (i.e. MajorVersion and MinorVersion are given in sfdx-project.json)
edit: adding PatchVersion field
During Build, a single Tooling API query is made for the first occurrence of each package dependency version, to resolve the
LATEST
keyword. This could be further optimised by sending only a single query with all the Package2 Id's aggregated and then sorting the response by package and descending semantic version.Pro's:
Cons:
MajorVersion
,MinorVersion
,PatchVersion
orBuildNumber
in SOQL query, causing more records to be returned and additional sorting computation