A customer of mine accidentally added a Sales Cloud dependency to his managed packages. He started using an open source library referencing Pricebook.SObjectType
and didn't see this was added during upload. Now his subscribers were unable to upgrade the package in some cases.
Is there a way to test this early in the process. Ideas I had were an XPath PMD rule that detect the use of UNWANTED.SObjectType
in code, but realized this is easy to bypass.
Could this be checked using an Apex test and some APIs like the Dependency or Metadata API?