private static Object tryUnpackPresentProvider(Object object, Project project) {
    if (!GradleReflectionUtil.isInstance(object, "org.gradle.api.provider.Provider")) {
      return object;
    }
    try {
      Class<?> providerClass = object.getClass();
      Method isPresentMethod = providerClass.getMethod("isPresent");
      Method getterMethod = providerClass.getMethod("get");
      if ((Boolean)isPresentMethod.invoke(object)) {
        return getterMethod.invoke(object);
      }
      return object;
    }
    catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException exception) {
      Throwable cause = exception.getCause();
      boolean isCodeException = GradleReflectionUtil.isInstance(cause, "org.gradle.api.InvalidUserCodeException");
      boolean isDataException = GradleReflectionUtil.isInstance(cause, "org.gradle.api.InvalidUserDataException");
      if (isCodeException || isDataException) {
        return object;
      }
      String msg = cause.getMessage();
      String className = cause.getClass().getCanonicalName();
      project.getLogger().info("Unable to resolve task source path: {} ({})", msg, className);
      return object;
    }
  }
private static Object tryUnpackPresentProvider(Object object, Project project)