Skip to content

Commit

Permalink
[MARTIFACT-81] add dependency scope
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Nov 22, 2024
1 parent 8fd7223 commit 9fdded8
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;

Expand Down Expand Up @@ -64,7 +65,7 @@ protected void executeReport(Locale locale) throws MavenReportException {
sink.text("this project:");
sink.paragraph_();
sink.paragraph();
renderReproducibleCentralArtifact(sink, project.getGroupId(), project.getArtifactId(), project.getVersion());
renderReproducibleCentralArtifact(sink, project);
sink.paragraph_();

sink.paragraph();
Expand All @@ -74,7 +75,7 @@ protected void executeReport(Locale locale) throws MavenReportException {
sink.list();
new TreeMap<String, Artifact>(project.getArtifactMap()).forEach((key, a) -> {
sink.listItem();
renderReproducibleCentralArtifact(sink, a.getGroupId(), a.getArtifactId(), a.getVersion());
renderReproducibleCentralArtifact(sink, a);
sink.listItem_();
});
sink.list_();
Expand All @@ -95,7 +96,17 @@ protected void executeReport(Locale locale) throws MavenReportException {
sink.body_();
}

private void renderReproducibleCentralArtifact(Sink sink, String groupId, String artifactId, String version) {
private void renderReproducibleCentralArtifact(Sink sink, MavenProject project) {
renderReproducibleCentralArtifact(
sink, project.getGroupId(), project.getArtifactId(), project.getVersion(), null);
}

private void renderReproducibleCentralArtifact(Sink sink, Artifact a) {
renderReproducibleCentralArtifact(sink, a.getGroupId(), a.getArtifactId(), a.getVersion(), a.getScope());
}

private void renderReproducibleCentralArtifact(
Sink sink, String groupId, String artifactId, String version, String scope) {
String url = "https://jvm-repo-rebuild.github.io/reproducible-central/badge/artifact/"
+ groupId.replace('.', '/') + '/' + artifactId + "/index.html";
String badge =
Expand All @@ -106,6 +117,9 @@ private void renderReproducibleCentralArtifact(Sink sink, String groupId, String
sink.figureGraphics(badge);
sink.link_();
sink.text(' ' + groupId + ':' + artifactId + ':' + version);
if (scope != null) {
sink.text(" (" + scope + ")");
}
}

@Override
Expand Down

0 comments on commit 9fdded8

Please sign in to comment.