private List patchAppSpecYml()

in aws-codedeploy-agent/src/main/java/jetbrains/buildServer/runner/codedeploy/ApplicationRevision.java [68:90]


  private List<File> patchAppSpecYml(@NotNull List<File> files) throws CodeDeployRunner.CodeDeployRunnerException {
    final File appSpecYml = CollectionsUtil.<File>findFirst(files, new Filter<File>() {
      @Override
      public boolean accept(@NotNull File data) {
        return CodeDeployConstants.APPSPEC_YML.equals(data.getName()) && CodeDeployConstants.APPSPEC_YML.equals(myPathMappings.mapPath(data));
      }
    });

    final File customAppSpecYml = getCustomAppSpecYmlFile();
    if (customAppSpecYml != null) {
      if (null == appSpecYml) {
        log("Will use custom AppSpec file " + customAppSpecYml);
      } else {
        log("Will replace existing AppSpec file " + appSpecYml + " with custom " + customAppSpecYml);
        files.remove(appSpecYml);
      }
      files.add(customAppSpecYml);

    } else if (null == appSpecYml && myMustContainAppSpecYml) {
      throw new CodeDeployRunner.CodeDeployRunnerException("No " + CodeDeployConstants.APPSPEC_YML + " file found among " + CodeDeployConstants.REVISION_PATHS_LABEL.toLowerCase() + " files and no custom AppSpec file provided", null);
    }
    return files;
  }