@VisibleForTesting
  static List<LayerEntryTemplate> toSortedJsonTemplates(List<FileEntry> layerEntries)
      throws IOException {
    List<LayerEntryTemplate> jsonTemplates = new ArrayList<>();
    for (FileEntry entry : layerEntries) {
      jsonTemplates.add(new LayerEntryTemplate(entry));
    }
    Collections.sort(jsonTemplates);
    return jsonTemplates;
  }
Converts a list of {@link FileEntry}s into a list of {@link LayerEntryTemplate}. The list is
sorted by source file first, then extraction path (see {@link LayerEntryTemplate#compareTo}).

@param layerEntries the list of {@link FileEntry} to convert
@return list of {@link LayerEntryTemplate} after sorting
@throws IOException if checking the file creation time of a layer entry fails
jib-core/src/main/java/com/google/cloud/tools/jib/cache/LayerEntriesSelector.java