internal PackageRepo FindPackageAndRepository(DependencyDefinition packageDefinition) { PackageRepo blankResult = new PackageRepo(); PackageRepo[] candidates = FindCandidatesForDefinition(packageDefinition); var strategies = new CandidateSelectionStrategy[] { new OnlyMatchingUnityVersionStrategy(Application.unityVersion), new FindBestPackageForUnityVersion(Application.unityVersion), new LatestSelectionStrategy() }; candidates = SelectCandidates(candidates, strategies); if (candidates.Length > 0) { return(candidates[0]); } else { Debug.LogWarning("No package " + packageDefinition.Name + " matching requirements was found"); return(blankResult); } }
public PackageRepo[] SelectCandidates(PackageRepo[] candidates, CandidateSelectionStrategy strategy) { return(strategy.Filter(candidates)); }