Skip to content

Commit 49af5e8

Browse files
authored
Merge pull request #6 from stackb/pcj/remove-debug-loggin
Remove debug logging
2 parents b6cb41b + ea5eb46 commit 49af5e8

File tree

3 files changed

+0
-59
lines changed

3 files changed

+0
-59
lines changed

java/com/google/devtools/coverageoutputgenerator/Main.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public static void main(String... args) {
6161
}
6262

6363
static int runWithArgs(String... args) throws ExecutionException, InterruptedException {
64-
System.out.format("coveragereportgenerator args: %s\n", (Object[]) args);
6564
LcovMergerFlags flags = null;
6665
try {
6766
flags = LcovMergerFlags.parseFlags(args);
@@ -75,7 +74,6 @@ static int runWithArgs(String... args) throws ExecutionException, InterruptedExc
7574
List<File> filesInCoverageDir = flags.coverageDir() != null
7675
? getCoverageFilesInDir(flags.coverageDir())
7776
: ImmutableList.of();
78-
System.out.format("filesInCoverageDir: %s\n", filesInCoverageDir);
7977

8078
Coverage lcovCoverage = parseFiles(
8179
getTracefiles(flags, filesInCoverageDir),
@@ -95,11 +93,7 @@ static int runWithArgs(String... args) throws ExecutionException, InterruptedExc
9593
gcovCoverage,
9694
gcovJsonCoverage);
9795

98-
System.out.format("lcovCoverage: %s\n", lcovCoverage);
99-
System.out.format("gcovCoverage: %s\n", gcovCoverage);
100-
System.out.format("gcovJsonCoverage: %s\n", gcovJsonCoverage);
10196

102-
System.out.format("Coverage <initial merge>: %s\n", coverage);
10397
if (flags.sourcesToReplaceFile() != null) {
10498
coverage.maybeReplaceSourceFileNames(getMapFromFile(flags.sourcesToReplaceFile()));
10599
}
@@ -145,7 +139,6 @@ static int runWithArgs(String... args) throws ExecutionException, InterruptedExc
145139
exitStatus = 1;
146140
}
147141
}
148-
System.out.format("coverage: %s\n", coverage);
149142
// System.exit(3);
150143

151144
return exitStatus;
@@ -165,18 +158,14 @@ static int runWithArgs(String... args) throws ExecutionException, InterruptedExc
165158
if (!flags.filterSources().isEmpty()) {
166159
coverage = Coverage.filterOutMatchingSources(coverage, flags.filterSources());
167160
}
168-
System.out.format("Coverage <filtered out matching sources>: %s\n", coverage);
169161

170162
if (flags.hasSourceFileManifest()) {
171-
System.out.format("flags.hasSourceFileManifest: %s\n", flags.sourceFileManifest());
172163

173164
coverage = Coverage.getOnlyTheseSources(
174165
coverage, getSourcesFromSourceFileManifest(flags.sourceFileManifest()));
175166
}
176167

177-
System.out.format("after source file manifest>: %s\n", coverage);
178168

179-
System.out.format("final coverage: %s\n", coverage.getAllSourceFiles());
180169

181170
if (coverage.isEmpty()) {
182171
try {

java/com/google/testing/coverage/JacocoCoverageRunner.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ public JacocoCoverageRunner(
106106
executionData = jacocoExec;
107107
reportFile = new File(reportPath);
108108
this.classesJars = getFilesFromFileList(wrapperFile, javaRunfilesRoot);
109-
System.err.format("JacocoCoverageRunner.classesJars: %s\n", this.classesJars);
110109
}
111110

112111
public JacocoCoverageRunner(InputStream jacocoExec, String reportPath, File... metadataJars) {
@@ -203,7 +202,6 @@ IBundleCoverage analyzeStructure() throws IOException {
203202
}
204203
} else {
205204
for (Map.Entry<String, byte[]> entry : uninstrumentedClasses.entrySet()) {
206-
System.out.format("💩 analyzing class %s: %s\n", entry.getValue(), entry.getKey());
207205
analyzer.analyzeClass(entry.getValue(), entry.getKey());
208206
}
209207
}
@@ -272,7 +270,6 @@ private void analyzeUninstrumentedClassesFromJar(
272270
@VisibleForTesting
273271
ImmutableSet<String> createPathsSet() throws IOException {
274272
if (!pathsForCoverage.isEmpty()) {
275-
System.out.format("👋 createPathsSet, using pathsForCoverage: %s\n", pathsForCoverage);
276273

277274
return pathsForCoverage;
278275
}
@@ -314,7 +311,6 @@ static void addEntriesToExecPathsSet(File jar, ImmutableSet.Builder<String> exec
314311
new InputStreamReader(jarFile.getInputStream(jarEntry), UTF_8));
315312
String line;
316313
while ((line = bufferedReader.readLine()) != null) {
317-
System.out.format("👋 adding line to addEntriesToExecPathsSet: %s\n", line);
318314
execPathsSetBuilder.add(line);
319315
}
320316
}
@@ -468,13 +464,8 @@ private static URL[] getClassLoaderUrls(ClassLoader classLoader) {
468464
}
469465

470466
public static void main(String[] args) throws Exception {
471-
// Object[] mainArgs = args;
472-
// System.out.format("main args!: %s\n", mainArgs);
473-
474467
String metadataFile = System.getenv("JACOCO_METADATA_JAR");
475-
System.out.println("JACOCO_METADATA_JAR: " + metadataFile);
476468
String jarWrappedValue = System.getenv("JACOCO_IS_JAR_WRAPPED");
477-
System.out.println("JACOCO_IS_JAR_WRAPPED: " + jarWrappedValue);
478469

479470
boolean wasWrappedJar = jarWrappedValue != null ? !jarWrappedValue.equals("0") : false;
480471

@@ -488,7 +479,6 @@ public static void main(String[] args) throws Exception {
488479
metadataFiles = new File[urls.length];
489480
for (int i = 0; i < urls.length; i++) {
490481
String file = URLDecoder.decode(urls[i].getFile(), "UTF-8");
491-
System.out.format("inspecting classloader url %d: %s\n", i, file);
492482

493483
metadataFiles[i] = new File(file);
494484
// Special case for when there is only one deploy jar on the classpath.
@@ -510,18 +500,15 @@ public static void main(String[] args) throws Exception {
510500

511501
if (jarEntryName.endsWith(".class.uninstrumented")
512502
&& !uninstrumentedClasses.containsKey(jarEntryName)) {
513-
System.out.format("😀 uninstrumentedClasses jarEntryName: %s\n", jarEntryName);
514503
uninstrumentedClasses.put(
515504
jarEntryName, ByteStreams.toByteArray(jarFile.getInputStream(jarEntry)));
516505
} else if (jarEntryName.endsWith("-paths-for-coverage.txt")) {
517-
System.out.format("🚀 paths-for-coverage jarEntryName: %s\n", jarEntryName);
518506

519507
BufferedReader bufferedReader = new BufferedReader(
520508
new InputStreamReader(jarFile.getInputStream(jarEntry), UTF_8));
521509
String line;
522510
while ((line = bufferedReader.readLine()) != null) {
523511
pathsForCoverageBuilder.add(line);
524-
System.out.format("🚀 paths-for-coverage line: %s\n", line);
525512
}
526513
}
527514
}
@@ -530,12 +517,9 @@ public static void main(String[] args) throws Exception {
530517
}
531518

532519
final ImmutableSet<String> pathsForCoverage = pathsForCoverageBuilder.build();
533-
System.out.format("pathsForCoverage: %s\n", pathsForCoverage);
534520
final String metadataFileFinal = metadataFile;
535-
System.out.format("metadataFileFinal: %s\n", metadataFileFinal);
536521

537522
final File[] metadataFilesFinal = metadataFiles;
538-
System.out.format("metadataFilesFinal: %s\n", (Object[]) metadataFilesFinal);
539523

540524
final String javaRunfilesRoot = System.getenv("JACOCO_JAVA_RUNFILES_ROOT");
541525

@@ -549,7 +533,6 @@ public static void main(String[] args) throws Exception {
549533
final boolean hasOneFileFinal = hasOneFile;
550534

551535
final String coverageReportBase = System.getenv("JAVA_COVERAGE_FILE");
552-
System.out.format("coverageReportBase: %s\n", coverageReportBase);
553536
// Disable Jacoco's default output mechanism, which runs as a shutdown hook. We
554537
// generate the
555538
// report in our own shutdown hook below, and we want to avoid the data race
@@ -633,15 +616,11 @@ public void run() {
633616
.toArray(new File[0]);
634617
}
635618
if (uninstrumentedClasses.isEmpty()) {
636-
System.err.format("JacocoCoverageRunner.reportPath: %s\n", coverageReportDat);
637-
System.err.format("JacocoCoverageRunner.metadataJars: %s\n", (Object[]) metadataJars);
638619

639620
new JacocoCoverageRunner(dataInputStream, coverageReportDat, metadataJars)
640621
.create();
641622
// throw new IOException("uninstrumentedClasses is empty!");
642623
} else {
643-
System.err.format("not empty JacocoCoverageRunner.reportPath: %s\n", coverageReportDat);
644-
System.err.format("not empty JacocoCoverageRunner.metadataJars: %s\n", (Object[]) metadataJars);
645624
new JacocoCoverageRunner(
646625
dataInputStream,
647626
coverageReportDat,
@@ -666,7 +645,6 @@ public void run() {
666645
// accordingly.
667646
boolean insideDeployJar = (deployJars == 1) && (metadataFilesFinal == null || metadataFilesFinal.length == 1);
668647
Class<?> mainClass = getMainClass(insideDeployJar);
669-
System.out.format("mainClass: %s\n", mainClass);
670648

671649
Method main = mainClass.getMethod("main", String[].class);
672650
main.setAccessible(true);
@@ -685,10 +663,6 @@ public void run() {
685663
main.invoke(null, new Object[] { args });
686664
}
687665

688-
// private static void printf(final String format, ...Object args) {
689-
// System.out.printf(format, args);
690-
// }
691-
692666
static class MyCoverageBuilder implements ICoverageVisitor {
693667
private final CoverageBuilder delegate;
694668

@@ -698,8 +672,6 @@ static class MyCoverageBuilder implements ICoverageVisitor {
698672

699673
@Override
700674
public void visitCoverage(IClassCoverage coverage) {
701-
System.out.format("visitCoverage id=%d, packageName=%s, isNoMatch=%s\n", coverage.getId(),
702-
coverage.getPackageName(), coverage.isNoMatch());
703675
this.delegate.visitCoverage(coverage);
704676
}
705677
}

java/com/google/testing/coverage/JacocoLCOVFormatter.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ public class JacocoLCOVFormatter {
6464

6565
public JacocoLCOVFormatter(ImmutableSet<String> execPathsOfUninstrumentedFiles) {
6666
this.execPathsOfUninstrumentedFiles = Optional.of(execPathsOfUninstrumentedFiles);
67-
System.out.format("🧰 JacocoLCOVFormatter.execPathsOfUninstrumentedFiles: %s\n",
68-
this.execPathsOfUninstrumentedFiles);
6967
}
7068

7169
public JacocoLCOVFormatter() {
@@ -82,14 +80,11 @@ public IReportVisitor createVisitor(
8280
private String getExecPathForEntryName(String pkgName, String fileName) {
8381
final String classPath = pkgName + "/" + fileName;
8482
if (execPathsOfUninstrumentedFiles.isEmpty()) {
85-
System.out.format("🧰 JacocoLCOVFormatter.getExecPathForEntryName: %s -(failfast self)!\n",
86-
classPath);
8783
return classPath;
8884
}
8985

9086
String matchingFileName = classPath.startsWith("/") ? classPath : "/" + classPath;
9187
for (String execPath : execPathsOfUninstrumentedFiles.get()) {
92-
System.out.format(" 📚 JacocoLCOVFormatter considering execPath: %s\n", execPath);
9388
final String baseName = Path.of(execPath).getFileName().toString();
9489

9590
if (execPath.contains(EXEC_PATH_DELIMITER)) {
@@ -98,33 +93,18 @@ private String getExecPathForEntryName(String pkgName, String fileName) {
9893
continue;
9994
}
10095
if (parts[1].equals(matchingFileName)) {
101-
System.out.format("🧰 JacocoLCOVFormatter.getExecPathForEntryName: %s -(matched parts[0])-> %s!\n",
102-
classPath,
103-
parts[0]);
10496
return parts[0];
10597
}
10698
} else if (execPath.endsWith(matchingFileName)) {
107-
System.out.format("🧰 JacocoLCOVFormatter.getExecPathForEntryName: %s -(matched endswith)-> %s!\n",
108-
classPath,
109-
matchingFileName);
11099
return execPath;
111100
} else if (matchingFileName.equals("/" + execPath)) {
112-
System.out.format("🧰 JacocoLCOVFormatter.getExecPathForEntryName: %s -(matched root+equals)-> %s!\n",
113-
classPath,
114-
matchingFileName);
115101
return execPath;
116102
} else {
117103
if (baseName.equals(fileName) && execPath.contains(pkgName)) {
118-
System.out.format(
119-
"🧰 JacocoLCOVFormatter.getExecPathForEntryName: %s -(matched pkg(%s)+basename)-> %s!\n",
120-
classPath,
121-
pkgName,
122-
matchingFileName);
123104
return execPath;
124105
}
125106
}
126107
}
127-
System.out.format("🧰 JacocoLCOVFormatter.getExecPathForEntryName: %s --> null!\n", classPath);
128108
return null;
129109
}
130110

0 commit comments

Comments
 (0)