@@ -0,0 +1,2489 @@
+/*%0A * Copyright 2019-present Facebook, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A * not use this file except in compliance with the License. You may obtain%0A * a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A * License for the specific language governing permissions and limitations%0A * under the License.%0A */%0A%0Apackage com.facebook.buck.support.build.report;%0A%0Aimport com.facebook.buck.core.config.BuckConfig;%0Aimport com.facebook.buck.core.config.ConfigView;%0Aimport com.facebook.buck.core.exceptions.HumanReadableException;%0Aimport com.facebook.buck.core.util.immutables.BuckStyleTuple;%0Aimport java.net.MalformedURLException;%0Aimport java.net.URI;%0Aimport java.net.URL;%0Aimport java.util.Optional;%0Aimport org.immutables.value.Value;%0A%0A/** %7B@link ConfigView%7D for BuildReport Configuration */%0A@BuckStyleTuple%0A@Value.Immutable(builder = false, copy = false)%0Apublic abstract class AbstractBuildReportConfig implements ConfigView%3CBuckConfig%3E %7B%0A%0A  private static final String BUILD_REPORT_SECTION = %22build_report%22;%0A%0A  private static final String ENABLED_FIELD = %22enable_build_report%22;%0A  private static final String ENDPOINT_URL_FIELD = %22endpoint_url%22;%0A%0A  private static final String ENDPOINT_TIMEOUT_MS_FIELD = %22endpoint_timeout_ms%22;%0A%0A  private static final long DEFAULT_ENDPOINT_TIMEOUT_MS = 30 * 1000;%0A%0A  private static final boolean ENABLED_DEFAULT = false;%0A%0A  @Override%0A  public abstract BuckConfig getDelegate();%0A%0A  @Value.Lazy%0A  public boolean getEnabled() %7B%0A    return getDelegate().getBooleanValue(BUILD_REPORT_SECTION, ENABLED_FIELD, ENABLED_DEFAULT);%0A  %7D%0A%0A  @Value.Lazy%0A  public Optional%3CURL%3E getEndpointUrl() throws HumanReadableException %7B%0A    Optional%3CURI%3E uri = getDelegate().getUrl(BUILD_REPORT_SECTION, ENDPOINT_URL_FIELD);%0A    if (uri.isPresent()) %7B%0A      try %7B%0A        return Optional.of(uri.get().toURL());%0A      %7D catch (MalformedURLException e) %7B%0A        throw new HumanReadableException(e, %22Build Report Endpoint URL is not a valid URL%22);%0A      %7D%0A    %7D%0A    return Optional.empty();%0A  %7D%0A%0A  @Value.Lazy%0A  public long getEndpointTimeoutMs() %7B%0A    return getDelegate()%0A        .getLong(BUILD_REPORT_SECTION, ENDPOINT_TIMEOUT_MS_FIELD)%0A        .orElse(DEFAULT_ENDPOINT_TIMEOUT_MS);%0A  %7D%0A%7D%0A

Add Build Report Configuration