Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dep on matrix-project optional #287

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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
Loading