Skip to content

Commit

Permalink
Make dep on matrix-project optional (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Jul 16, 2024
1 parent 807f0ff commit f828e76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down
23 changes: 14 additions & 9 deletions src/main/java/htmlpublisher/HtmlPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,21 +390,26 @@ public Collection<? extends Action> getProjectActions(AbstractProject<?, ?> proj
List<Action> actions = new ArrayList<>();
for (HtmlPublisherTarget target : this.reportTargets) {
actions.add(target.getProjectAction(project));
if (project instanceof MatrixProject && ((MatrixProject) project).getActiveConfigurations() != null){
for (MatrixConfiguration mc : ((MatrixProject) project).getActiveConfigurations()){
try {
mc.onLoad(mc.getParent(), mc.getName());
}
catch (IOException e){
//Could not reload the configuration.
}
}
if (project.getClass().getName().equals("hudson.matrix.MatrixProject")) {

Check warning on line 393 in src/main/java/htmlpublisher/HtmlPublisher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 393 is only partially covered, one branch is missing
adjustMatrixProject(project);
}
}
return actions;
}
}

private static void adjustMatrixProject(AbstractProject<?, ?> project) {
MatrixProject mp = (MatrixProject) project;
if (mp.getActiveConfigurations() != null) {
for (MatrixConfiguration mc : mp.getActiveConfigurations()) {
try {
mc.onLoad(mc.getParent(), mc.getName());
} catch (IOException e) {
//Could not reload the configuration.
}
}
}
}

Check warning on line 412 in src/main/java/htmlpublisher/HtmlPublisher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 394-412 are not covered by tests

@SuppressRestrictedWarnings(NoExternalUse.class)
public static DirScanner dirScannerGlob(String includes, String excludes, boolean useDefaultExcludes, OpenOption... openOptions) throws Exception {
Expand Down

0 comments on commit f828e76

Please sign in to comment.