Class BuckConfig


  • public class BuckConfig
    extends Object
    Structured representation of data read from a .buckconfig file.
    • Method Detail

      • withBuildTargetParser

        public BuckConfig withBuildTargetParser​(java.util.function.Function<String,​UnconfiguredBuildTarget> buildTargetParser)
        Returns a clone of the current config with a the argument CellPathResolver.
      • getView

        public <T extends ConfigView<BuckConfig>> T getView​(Class<T> cls)
        Get a ConfigView of this config.
        Type Parameters:
        T - Type of the config view.
        Parameters:
        cls - Class of the config view.
      • getEntriesForSection

        public com.google.common.collect.ImmutableMap<String,​String> getEntriesForSection​(String section)
      • getListWithoutComments

        public com.google.common.collect.ImmutableList<String> getListWithoutComments​(String section,
                                                                                      String field)
      • getListWithoutComments

        public com.google.common.collect.ImmutableList<String> getListWithoutComments​(String section,
                                                                                      String field,
                                                                                      char splitChar)
      • getOptionalListWithoutComments

        public Optional<com.google.common.collect.ImmutableList<String>> getOptionalListWithoutComments​(String section,
                                                                                                        String field)
      • getOptionalListWithoutComments

        public Optional<com.google.common.collect.ImmutableList<String>> getOptionalListWithoutComments​(String section,
                                                                                                        String field,
                                                                                                        char splitChar)
      • getOptionalPathList

        public Optional<com.google.common.collect.ImmutableList<Path>> getOptionalPathList​(String section,
                                                                                           String field,
                                                                                           boolean resolve)
      • getUnconfiguredBuildTargetForFullyQualifiedTarget

        public UnconfiguredBuildTarget getUnconfiguredBuildTargetForFullyQualifiedTarget​(String target)
      • getMaybeBuildTarget

        public Optional<BuildTarget> getMaybeBuildTarget​(String section,
                                                         String field,
                                                         TargetConfiguration targetConfiguration)
        Returns:
        the parsed BuildTarget in the given section and field, if set and a valid build target.

        This is useful if you use getTool to get the target, if any, but allow filesystem references.

      • getMaybeUnconfiguredBuildTarget

        public Optional<UnconfiguredBuildTarget> getMaybeUnconfiguredBuildTarget​(String section,
                                                                                 String field)
        Returns:
        the parsed UnconfiguredBuildTarget in the given section and field, if set and a valid build target.

        This is useful if you use getTool to get the target, if any, but allow filesystem references.

      • getPathSourcePath

        public PathSourcePath getPathSourcePath​(Path path,
                                                String errorMessage)
        Parameters:
        errorMessage - the error message to throw if path is not found
        Returns:
        a SourcePath identified by a Path.
      • resolvePathThatMayBeOutsideTheProjectFilesystem

        public Path resolvePathThatMayBeOutsideTheProjectFilesystem​(Path path)
      • resolveNonNullPathOutsideTheProjectFilesystem

        public Path resolveNonNullPathOutsideTheProjectFilesystem​(Path path)
      • getLocalhost

        public String getLocalhost()
      • getPlatform

        public Platform getPlatform()
      • hasUserDefinedValue

        public boolean hasUserDefinedValue​(String sectionName,
                                           String propertyName)
      • getValue

        public Optional<String> getValue​(String sectionName,
                                         String propertyName)
        Returns:
        the string value for the config settings, where present empty values are Optional.empty().
      • getRawValue

        public Optional<String> getRawValue​(String sectionName,
                                            String propertyName)
        Returns:
        the string value for the config settings, where present empty values are Optional[].
      • getBooleanValue

        public boolean getBooleanValue​(String sectionName,
                                       String propertyName,
                                       boolean defaultValue)
      • getExperimentGroups

        public <T extends Enum<T>> Map<T,​Double> getExperimentGroups​(String section,
                                                                           String field,
                                                                           Class<T> enumClass)
        Returns the probabilities for each group in an experiment.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getEnvironment

        public com.google.common.collect.ImmutableMap<String,​String> getEnvironment()
      • getPath

        public Optional<Path> getPath​(String sectionName,
                                      String name)
        Returns:
        the path for the given section and property.
      • getRequiredPath

        public Path getRequiredPath​(String section,
                                    String field)
      • checkPathExistsAndResolve

        public Path checkPathExistsAndResolve​(String pathString,
                                              String errorMsg)
      • getSections

        public com.google.common.collect.ImmutableSet<String> getSections()
      • getConfig

        public Config getConfig()