Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-30735] Expand environment variabes in file pattern.
  • Loading branch information
uhafner committed May 25, 2016
1 parent cadfb2a commit db62da8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-core</artifactId>
<version>1.75</version>
<version>1.77-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
21 changes: 1 addition & 20 deletions src/main/java/hudson/plugins/warnings/WarningsPublisher.java
Expand Up @@ -6,7 +6,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang.StringUtils;
Expand All @@ -20,7 +19,6 @@

import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
import hudson.matrix.MatrixAggregator;
import hudson.matrix.MatrixBuild;
import hudson.model.AbstractProject;
Expand Down Expand Up @@ -391,7 +389,7 @@ private List<ParserResult> parseFiles(final Run<?, ?> build, final FilePath work
throws IOException, InterruptedException {
List<ParserResult> results = Lists.newArrayList();
for (ParserConfiguration configuration : getParserConfigurations()) {
String filePattern = expandFilePattern(build, configuration.getPattern());
String filePattern = expandFilePattern(configuration.getPattern(), build.getEnvironment(TaskListener.NULL));
String parserName = configuration.getParserName();

logger.log("Parsing warnings in files '" + filePattern + "' with parser " + parserName);
Expand All @@ -408,23 +406,6 @@ private List<ParserResult> parseFiles(final Run<?, ?> build, final FilePath work
return results;
}

/**
* Resolve build parameters in the file pattern up to resolveDepth times.
*/
private String expandFilePattern(final Run<?, ?> build, final String filePattern) throws IOException, InterruptedException {
String expanded = filePattern;
int resolveDepth = 10;
Map<String, String> buildParameterMap = build.getEnvironment(TaskListener.NULL);
for (int i = 0; i < resolveDepth; i++) {
String old = expanded;
expanded = Util.replaceMacro(expanded, buildParameterMap);
if (old.equals(expanded)) {
break;
}
}
return expanded;
}

private ParserResult annotate(final Run<?, ?> build, final FilePath workspace, final ParserResult input, final String parserName)
throws IOException, InterruptedException {
ParserResult output = workspace.act(new AnnotationsClassifier(input, getDefaultEncoding()));
Expand Down
2 changes: 1 addition & 1 deletion warnings.iml
Expand Up @@ -21,7 +21,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.jvnet.hudson.plugins:analysis-core:1.75" level="project" />
<orderEntry type="module" module-name="analysis-core" />
<orderEntry type="library" name="Maven: de.java2html:java2html:5.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.3.2" level="project" />
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
Expand Down

0 comments on commit db62da8

Please sign in to comment.