Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-30735] Expand environment variabes in file pattern.
  • Loading branch information
uhafner committed May 25, 2016
1 parent cadfb2a commit db62da8ba72d05c19564733e2bec6e702a566e97
Showing with 3 additions and 22 deletions.
  1. +1 −1 pom.xml
  2. +1 −20 src/main/java/hudson/plugins/warnings/WarningsPublisher.java
  3. +1 −1 warnings.iml
@@ -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>
@@ -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;
@@ -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;
@@ -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);
@@ -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()));
@@ -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" />

0 comments on commit db62da8

Please sign in to comment.