public CachedModuleVersionResult(BuildableModuleComponentMetaDataResolveResult result) { this.state = result.getState(); if (state == Resolved) { this.metaData = result.getMetaData().copy(); } else { this.metaData = null; } }
public void supply(BuildableModuleComponentMetaDataResolveResult result) { assert isCacheable() : "Results are not cacheable, cannot supply the results."; if (state == Resolved) { MutableModuleComponentResolveMetaData metaData = this.metaData.copy(); result.resolved(metaData); } else if (state == Missing) { result.missing(); } else if (state == ProbablyMissing) { result.probablyMissing(); } }
private RepositoryChainModuleResolution findBestMatch( LinkedList<ComponentMetaDataResolveState> queue, Collection<Throwable> failures, Collection<ComponentMetaDataResolveState> missing) { RepositoryChainModuleResolution best = null; while (!queue.isEmpty()) { ComponentMetaDataResolveState request = queue.removeFirst(); BuildableModuleComponentMetaDataResolveResult metaDataResolveResult; try { metaDataResolveResult = request.resolve(); } catch (Throwable t) { failures.add(t); continue; } switch (metaDataResolveResult.getState()) { case Missing: // Queue this up for checking again later if (request.canMakeFurtherAttempts()) { missing.add(request); } break; case Resolved: RepositoryChainModuleResolution moduleResolution = new RepositoryChainModuleResolution( request.repository, metaDataResolveResult.getMetaData()); if (!metaDataResolveResult.getMetaData().isGenerated()) { return moduleResolution; } best = best != null ? best : moduleResolution; break; default: throw new IllegalStateException( "Unexpected state for resolution: " + metaDataResolveResult.getState()); } } return best; }