Skip to content

Commit 14c3bbd

Browse files
authored
Rename ClasspathChecker -> LinkageChecker (GoogleCloudPlatform#467)
* intellij renaming * Fixed maven exec plugin for upper-bounds-check pom * import order * remvoe STATIC
1 parent 5a42780 commit 14c3bbd

23 files changed

Lines changed: 217 additions & 199 deletions

File tree

‎boms/pom.xml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,20 @@
3333
<module>upper-bounds-check</module>
3434
</modules>
3535

36+
<build>
37+
<pluginManagement>
38+
<plugins>
39+
<plugin>
40+
<groupId>org.codehaus.mojo</groupId>
41+
<artifactId>exec-maven-plugin</artifactId>
42+
<version>1.6.0</version>
43+
<configuration>
44+
<skip>true</skip>
45+
<mainClass>none</mainClass>
46+
</configuration>
47+
</plugin>
48+
</plugins>
49+
</pluginManagement>
50+
</build>
51+
3652
</project>

‎boms/upper-bounds-check/pom.xml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
http://maven.apache.org/xsd/maven-4.0.0.xsd">
66
<modelVersion>4.0.0</modelVersion>
77

8-
<groupId>com.google.cloud</groupId>
8+
9+
<parent>
10+
<groupId>com.google.cloud.tools.opensource</groupId>
11+
<artifactId>cloud-tools-opensource-boms</artifactId>
12+
<version>1.0-SNAPSHOT</version>
13+
</parent>
14+
915
<artifactId>upper-bounds-check</artifactId>
1016
<version>0.0.1-SNAPSHOT</version>
1117
<packaging>pom</packaging>

‎dashboard/src/main/java/com/google/cloud/tools/opensource/dashboard/DashboardMain.java‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
import org.eclipse.aether.artifact.DefaultArtifact;
5252

5353
import com.google.cloud.tools.opensource.classpath.ClassPathBuilder;
54-
import com.google.cloud.tools.opensource.classpath.ClasspathCheckReport;
55-
import com.google.cloud.tools.opensource.classpath.ClasspathChecker;
5654
import com.google.cloud.tools.opensource.classpath.JarLinkageReport;
55+
import com.google.cloud.tools.opensource.classpath.LinkageCheckReport;
56+
import com.google.cloud.tools.opensource.classpath.LinkageChecker;
5757
import com.google.cloud.tools.opensource.dependencies.Artifacts;
5858
import com.google.cloud.tools.opensource.dependencies.DependencyGraph;
5959
import com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder;
@@ -76,7 +76,7 @@
7676
import com.google.common.collect.Sets;
7777

7878
public class DashboardMain {
79-
public static final String TEST_NAME_STATIC_LINKAGE_CHECK = "Static Linkage Errors";
79+
public static final String TEST_NAME_LINKAGE_CHECK = "Linkage Errors";
8080
public static final String TEST_NAME_UPPER_BOUND = "Upper Bounds";
8181
public static final String TEST_NAME_GLOBAL_UPPER_BOUND = "Global Upper Bounds";
8282
public static final String TEST_NAME_DEPENDENCY_CONVERGENCE = "Dependency Convergence";
@@ -107,9 +107,9 @@ public static Path generate()
107107
List<Path> artifactJarsInBom = classpath.subList(0, managedDependencies.size());
108108
ImmutableSet<Path> entryPoints = ImmutableSet.copyOf(artifactJarsInBom);
109109

110-
ClasspathChecker classpathChecker = ClasspathChecker.create(classpath, entryPoints);
110+
LinkageChecker linkageChecker = LinkageChecker.create(classpath, entryPoints);
111111

112-
ClasspathCheckReport linkageReport = classpathChecker.findLinkageErrors();
112+
LinkageCheckReport linkageReport = linkageChecker.findLinkageErrors();
113113

114114
Path output = generateHtml(cache, jarToDependencyPaths, linkageReport);
115115

@@ -118,7 +118,7 @@ public static Path generate()
118118

119119
private static Path generateHtml(ArtifactCache cache,
120120
LinkedListMultimap<Path, DependencyPath> jarToDependencyPaths,
121-
ClasspathCheckReport linkageReport) throws IOException, TemplateException {
121+
LinkageCheckReport linkageReport) throws IOException, TemplateException {
122122

123123
Path relativePath = Paths.get("target", "dashboard");
124124
Path output = Files.createDirectories(relativePath);
@@ -163,10 +163,10 @@ static List<ArtifactResults> generateReports(
163163
Configuration configuration,
164164
Path output,
165165
ArtifactCache cache,
166-
ClasspathCheckReport classpathCheckReport,
166+
LinkageCheckReport linkageCheckReport,
167167
ListMultimap<Path, DependencyPath> jarToDependencyPaths) {
168168
ImmutableMap<Path, JarLinkageReport> jarToLinkageReport =
169-
classpathCheckReport.getJarLinkageReports().stream()
169+
linkageCheckReport.getJarLinkageReports().stream()
170170
.collect(
171171
toImmutableMap(JarLinkageReport::getJarPath, jarLinkageReport -> jarLinkageReport));
172172

@@ -314,7 +314,7 @@ private static ArtifactResults generateArtifactReport(
314314
results.addResult(TEST_NAME_UPPER_BOUND, upperBoundFailures.size());
315315
results.addResult(TEST_NAME_GLOBAL_UPPER_BOUND, globalUpperBoundFailures.size());
316316
results.addResult(TEST_NAME_DEPENDENCY_CONVERGENCE, convergenceIssues.size());
317-
results.addResult(TEST_NAME_STATIC_LINKAGE_CHECK, totalLinkageErrorCount);
317+
results.addResult(TEST_NAME_LINKAGE_CHECK, totalLinkageErrorCount);
318318

319319
return results;
320320
}
@@ -353,7 +353,7 @@ static void generateDashboard(
353353
Path output,
354354
List<ArtifactResults> table,
355355
List<DependencyGraph> globalDependencies,
356-
ClasspathCheckReport classpathCheckReport,
356+
LinkageCheckReport linkageCheckReport,
357357
ListMultimap<Path, DependencyPath> jarToDependencyPaths)
358358
throws IOException, TemplateException {
359359
File dashboardFile = output.resolve("dashboard.html").toFile();
@@ -367,7 +367,7 @@ static void generateDashboard(
367367
templateData.put("table", table);
368368
templateData.put("lastUpdated", LocalDateTime.now());
369369
templateData.put("latestArtifacts", latestArtifacts);
370-
templateData.put("jarLinkageReports", classpathCheckReport.getJarLinkageReports());
370+
templateData.put("jarLinkageReports", linkageCheckReport.getJarLinkageReports());
371371
templateData.put("jarToDependencyPaths", jarToDependencyPaths);
372372
templateData.put("dependencyPathRootCauses", findRootCauses(jarToDependencyPaths));
373373

‎dashboard/src/main/resources/css/dashboard.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ p.dependency-tree-node {
5656
margin-bottom: 0;
5757
}
5858

59-
.static-linkage-check-dependency-paths, .jar-linkage-report {
59+
.linkage-check-dependency-paths, .jar-linkage-report {
6060
margin-left: 1em;
6161
}
6262

‎dashboard/src/main/resources/templates/component.ftl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@
114114
</#if>
115115

116116

117-
<h2 id="static-linkage-errors">Classpath Check</h2>
117+
<h2 id="linkage-errors">Linkage Check</h2>
118118

119-
<p id="static-linkage-errors-total">${totalLinkageErrorCount} static linkage error(s)</p>
119+
<p id="linkage-errors-total">${totalLinkageErrorCount} linkage error(s)</p>
120120
<#list jarLinkageReports as jarLinkageReport>
121121
<@formatJarLinkageReport jarLinkageReport jarToDependencyPaths {} />
122122
</#list>

‎dashboard/src/main/resources/templates/dashboard.ftl‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<span class="desc">Total Artifacts Checked</span>
1919
</div>
2020
<div class="statistic-item statistic-item-red">
21-
<h2>${dashboardMain.countFailures(table, "Static Linkage Errors")}</h2>
22-
<span class="desc">Have Static Linkage Errors</span>
21+
<h2>${dashboardMain.countFailures(table, "Linkage Errors")}</h2>
22+
<span class="desc">Have Linkage Errors</span>
2323
</div>
2424
<div class="statistic-item statistic-item-yellow">
2525
<h2>${dashboardMain.countFailures(table, "Upper Bounds")}</h2>
@@ -42,8 +42,8 @@
4242
<tr>
4343
<th>Artifact</th>
4444
<th title=
45-
"Classpath check result for the artifact and transitive dependencies. PASS means all symbol references have valid referents.">
46-
Classpath Check</th>
45+
"Linkage check result for the artifact and transitive dependencies. PASS means all symbol references have valid referents.">
46+
Linkage Check</th>
4747
<th title=
4848
"For each transitive dependency the library pulls in, the highest version found anywhere in the dependency tree is picked.">
4949
Upper Bounds</th>
@@ -59,7 +59,7 @@
5959
<tr>
6060
<td class="artifact-name"><a href='${report_url}'>${row.getCoordinates()}</a></td>
6161
<#-- The name key should match TEST_NAME_XXXX variables -->
62-
<@testResult row=row name="Static Linkage Errors"/>
62+
<@testResult row=row name="Linkage Errors"/>
6363
<@testResult row=row name="Upper Bounds"/>
6464
<@testResult row=row name="Global Upper Bounds"/>
6565
<@testResult row=row name="Dependency Convergence"/>
@@ -69,7 +69,7 @@
6969

7070
<hr />
7171

72-
<h2>Static Linkage Errors</h2>
72+
<h2>Linkage Errors</h2>
7373

7474
<#list jarLinkageReports as jarLinkageReport>
7575
<@formatJarLinkageReport jarLinkageReport jarToDependencyPaths dependencyPathRootCauses/>

‎dashboard/src/main/resources/templates/macros.ftl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
</#list>
3333
</ul>
3434
</#list>
35-
<p class="static-linkage-check-dependency-paths">
35+
<p class="linkage-check-dependency-paths">
3636
The following paths to the jar file from BOM are found in the dependency tree.
3737
</p>
3838
<#if dependencyPathRootCauses[jarPath]?? >
39-
<p class="static-linkage-check-dependency-paths">${dependencyPathRootCauses[jarPath]?html}
39+
<p class="linkage-check-dependency-paths">${dependencyPathRootCauses[jarPath]?html}
4040
</p>
4141
<#else>
42-
<ul class="static-linkage-check-dependency-paths">
42+
<ul class="linkage-check-dependency-paths">
4343
<#list jarToDependencyPaths.get(jarPath) as dependencyPath >
4444
<li>${dependencyPath}</li>
4545
</#list>

‎dashboard/src/test/java/com/google/cloud/tools/opensource/dashboard/DashboardTest.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ public void testDashboard_linkageReports() {
187187
"3 target classes causing linkage errors referenced from 3 source classes.");
188188

189189
ImmutableList<Node> dependencyPaths =
190-
toList(dashboard.query("//p[@class='static-linkage-check-dependency-paths']"));
190+
toList(dashboard.query("//p[@class='linkage-check-dependency-paths']"));
191191
Node log4jDependencyPathMessage = dependencyPaths.get(dependencyPaths.size() - 1);
192192
// There are 994 paths to log4j. These should be summarized.
193193
Truth.assertThat(log4jDependencyPathMessage.getValue())
194194
.startsWith(
195195
"Artifacts 'com.google.http-client:google-http-client >"
196196
+ " commons-logging:commons-logging > log4j:log4j' exist in all");
197197
int dependencyPathListSize =
198-
dashboard.query("//ul[@class='static-linkage-check-dependency-paths']/li").size();
198+
dashboard.query("//ul[@class='linkage-check-dependency-paths']/li").size();
199199
Truth.assertWithMessage("The dashboard should not show repetitive dependency paths")
200200
.that(dependencyPathListSize)
201201
.isLessThan(100);
@@ -319,10 +319,10 @@ public void testLinkageErrorsUnderProvidedDependency() throws IOException, Parsi
319319
public void testZeroLinkageErrorShowsZero() throws IOException, ParsingException {
320320
// grpc-auth does not have a linkage error, and it should show zero in the section
321321
Document document = parseOutputFile("io.grpc_grpc-auth_1.18.0.html");
322-
Nodes linkageErrorsTotal = document.query("//p[@id='static-linkage-errors-total']");
322+
Nodes linkageErrorsTotal = document.query("//p[@id='linkage-errors-total']");
323323
Truth.assertThat(linkageErrorsTotal.size()).isEqualTo(1);
324324
Truth.assertThat(linkageErrorsTotal.get(0).getValue())
325-
.contains("0 static linkage error(s)");
325+
.contains("0 linkage error(s)");
326326
}
327327

328328
private static ImmutableList<Node> toList(Nodes nodes) {

‎dashboard/src/test/java/com/google/cloud/tools/opensource/dashboard/DashboardUnavailableArtifactTest.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.tools.opensource.dashboard;
1818

19+
import com.google.cloud.tools.opensource.classpath.LinkageCheckReport;
1920
import java.io.IOException;
2021
import java.nio.file.Files;
2122
import java.nio.file.Path;
@@ -42,13 +43,11 @@
4243
import org.junit.Test;
4344

4445
import com.google.cloud.tools.opensource.classpath.JarLinkageReport;
45-
import com.google.cloud.tools.opensource.classpath.ClasspathCheckReport;
4646
import com.google.cloud.tools.opensource.dependencies.Artifacts;
4747
import com.google.cloud.tools.opensource.dependencies.DependencyGraph;
4848
import com.google.common.collect.ImmutableList;
4949
import com.google.common.collect.LinkedListMultimap;
5050
import com.google.common.io.MoreFiles;
51-
import com.google.common.io.RecursiveDeleteOption;
5251
import com.google.common.truth.Truth;
5352

5453

@@ -81,11 +80,11 @@ public void testDashboardForRepositoryException() {
8180

8281
ArtifactCache cache = new ArtifactCache();
8382
cache.setInfoMap(map);
84-
ClasspathCheckReport classpathCheckReport =
85-
ClasspathCheckReport.create(ImmutableList.of());
83+
LinkageCheckReport linkageCheckReport =
84+
LinkageCheckReport.create(ImmutableList.of());
8685
List<ArtifactResults> artifactResults =
8786
DashboardMain.generateReports(
88-
configuration, outputDirectory, cache, classpathCheckReport,
87+
configuration, outputDirectory, cache, linkageCheckReport,
8988
LinkedListMultimap.create());
9089

9190
Assert.assertEquals(
@@ -126,7 +125,7 @@ public void testDashboardWithRepositoryException()
126125
table.add(errorArtifactResult);
127126

128127
Iterable<JarLinkageReport> list = new ArrayList<>();
129-
ClasspathCheckReport report = ClasspathCheckReport.create(list);
128+
LinkageCheckReport report = LinkageCheckReport.create(list);
130129
DashboardMain.generateDashboard(
131130
configuration, outputDirectory, table, null, report, LinkedListMultimap.create());
132131

‎dashboard/src/test/java/com/google/cloud/tools/opensource/dashboard/FreemarkerTest.java‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@
2929
import org.junit.BeforeClass;
3030
import org.junit.Test;
3131

32-
import com.google.cloud.tools.opensource.classpath.ClasspathCheckReport;
32+
import com.google.cloud.tools.opensource.classpath.LinkageCheckReport;
3333
import com.google.cloud.tools.opensource.dependencies.DependencyGraph;
3434
import com.google.cloud.tools.opensource.dependencies.DependencyPath;
3535
import com.google.common.collect.ImmutableList;
3636
import com.google.common.collect.LinkedListMultimap;
3737
import com.google.common.collect.ListMultimap;
3838
import com.google.common.io.MoreFiles;
39-
import com.google.common.io.RecursiveDeleteOption;
4039
import com.google.common.truth.Truth;
4140

4241
import freemarker.template.Configuration;
@@ -70,22 +69,22 @@ public static void cleanUp() throws IOException {
7069
public void testCountFailures() throws IOException, TemplateException, ValidityException, ParsingException {
7170
Configuration configuration = DashboardMain.configureFreemarker();
7271

73-
ClasspathCheckReport classpathCheckReport =
74-
ClasspathCheckReport.create(ImmutableList.of());
72+
LinkageCheckReport linkageCheckReport =
73+
LinkageCheckReport.create(ImmutableList.of());
7574

7675
Artifact artifact1 = new DefaultArtifact("io.grpc:grpc-context:1.15.0");
7776
ArtifactResults results1 = new ArtifactResults(artifact1);
78-
results1.addResult("Static Linkage Errors", 56);
77+
results1.addResult("Linkage Errors", 56);
7978

8079
Artifact artifact2 = new DefaultArtifact("grpc:grpc:1.15.0");
8180
ArtifactResults results2 = new ArtifactResults(artifact2);
82-
results2.addResult("Static Linkage Errors", 0);
81+
results2.addResult("Linkage Errors", 0);
8382

8483
List<ArtifactResults> table = ImmutableList.of(results1, results2);
8584
List<DependencyGraph> globalDependencies = ImmutableList.of();
8685
ListMultimap<Path, DependencyPath> jarToDependencyPaths = LinkedListMultimap.create();
8786
DashboardMain.generateDashboard(configuration, outputDirectory, table, globalDependencies,
88-
classpathCheckReport, jarToDependencyPaths);
87+
linkageCheckReport, jarToDependencyPaths);
8988

9089
Path dashboardHtml = outputDirectory.resolve("dashboard.html");
9190
Assert.assertTrue(Files.isRegularFile(dashboardHtml));
@@ -97,7 +96,7 @@ public void testCountFailures() throws IOException, TemplateException, ValidityE
9796
for (int i = 0; i < counts.size(); i++) {
9897
Integer.parseInt(counts.get(i).getValue().trim());
9998
}
100-
// Static Linkage Errors
99+
// Linkage Errors
101100
Truth.assertThat(counts.get(1).getValue().trim()).isEqualTo("1");
102101
}
103102
}

0 commit comments

Comments
 (0)