@VisibleForTesting
  static PathMatcher toPathMatcher(String glob) {
    return FileSystems.getDefault()
        .getPathMatcher(
            "glob:" + ((glob.endsWith("/") || glob.endsWith("\\")) ? glob + "**" : glob));
  }
Convert a layer spec to a list of layer objects.

<p>Does not handle missing directories for files added via this method. We can either prefill
directories here, or allow passing of the file entry information directly to the reproducible
layer builder

@param buildRoot the directory to resolve relative paths, usually the directory where the build
    config file is located
@param layersSpec a layersSpec containing configuration for all layers
@return a {@link List} of {@link FileEntriesLayer} to use as part of a jib container build
@throws IOException if traversing a directory fails
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/buildfile/Layers.java