Exemplo n.º 1
0
 @Nullable
 private static Label maybeGetConfiguredTargetCycleCulprit(
     Label labelToLoad, Iterable<CycleInfo> cycleInfos) {
   for (CycleInfo cycleInfo : cycleInfos) {
     SkyKey culprit = Iterables.getFirst(cycleInfo.getCycle(), null);
     if (culprit == null) {
       continue;
     }
     if (culprit.functionName().equals(SkyFunctions.CONFIGURED_TARGET)) {
       return ((ConfiguredTargetKey) culprit.argument()).getLabel();
     } else {
       // For other types of cycles (e.g. file symlink cycles), the root cause is the furthest
       // target dependency that itself depended on the cycle.
       Label furthestTarget = labelToLoad;
       for (SkyKey skyKey : cycleInfo.getPathToCycle()) {
         if (skyKey.functionName().equals(SkyFunctions.CONFIGURED_TARGET)) {
           furthestTarget = (Label) skyKey.argument();
         } else {
           break;
         }
       }
       return furthestTarget;
     }
   }
   return null;
 }
Exemplo n.º 2
0
 @Nullable
 Label maybeGetConfiguredTargetCycleCulprit(Iterable<CycleInfo> cycleInfos) {
   for (CycleInfo cycleInfo : cycleInfos) {
     SkyKey culprit = Iterables.getFirst(cycleInfo.getCycle(), null);
     if (culprit == null) {
       continue;
     }
     if (culprit.functionName().equals(SkyFunctions.CONFIGURED_TARGET)) {
       return ((LabelAndConfiguration) culprit.argument()).getLabel();
     }
   }
   return null;
 }
 @Override
 protected boolean canReportCycle(SkyKey topLevelKey, CycleInfo cycleInfo) {
   return IS_ARTIFACT_OR_ACTION_SKY_KEY.apply(topLevelKey)
       && Iterables.all(cycleInfo.getCycle(), IS_ARTIFACT_OR_ACTION_SKY_KEY);
 }