LCOV - code coverage report
Current view: top level - pgm - Ls.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 0 19 0.0 %
Date: 2022-11-19 15:00:39 Functions: 0 3 0.0 %

          Line data    Source code
       1             : // Copyright (C) 2009 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.pgm;
      16             : 
      17             : import static com.google.common.collect.ImmutableList.toImmutableList;
      18             : 
      19             : import com.google.gerrit.launcher.GerritLauncher;
      20             : import com.google.gerrit.pgm.util.AbstractProgram;
      21             : import java.io.IOException;
      22             : import java.util.zip.ZipEntry;
      23             : import java.util.zip.ZipFile;
      24             : 
      25             : /** List the files available in our archive. */
      26           0 : public class Ls extends AbstractProgram {
      27             :   @Override
      28             :   public int run() throws IOException {
      29           0 :     try (ZipFile zf = new ZipFile(GerritLauncher.getDistributionArchive())) {
      30           0 :       for (ZipEntry ze : entriesOf(zf)) {
      31           0 :         String name = ze.getName();
      32           0 :         boolean show = false;
      33           0 :         show |= name.startsWith("WEB-INF/");
      34           0 :         show |= name.equals("LICENSES.txt");
      35             : 
      36           0 :         show &= !ze.isDirectory();
      37           0 :         show &= !name.startsWith("WEB-INF/classes/");
      38           0 :         show &= !name.startsWith("WEB-INF/lib/");
      39           0 :         show &= !name.startsWith("WEB-INF/pgm-lib/");
      40           0 :         show &= !name.equals("WEB-INF/web.xml");
      41           0 :         if (show) {
      42           0 :           if (name.startsWith("WEB-INF/")) {
      43           0 :             name = name.substring("WEB-INF/".length());
      44             :           }
      45           0 :           System.out.println(name);
      46             :         }
      47           0 :       }
      48             :     }
      49           0 :     return 0;
      50             :   }
      51             : 
      52             :   private static Iterable<? extends ZipEntry> entriesOf(ZipFile zipFile) {
      53           0 :     return zipFile.stream().collect(toImmutableList());
      54             :   }
      55             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750