Skip to content

Commit

Permalink
Merge pull request #35 from fcojfernandez/JENKINS-48194
Browse files Browse the repository at this point in the history
[JENKINS-48194] Binary compatibility broken in MsBuildBuilder
  • Loading branch information
marshall777 authored Jan 7, 2018
2 parents a830f38 + f566e24 commit 29e8603
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ public class MsBuildBuilder extends Builder {
private final boolean unstableIfWarnings;
private final boolean doNotUseChcpCommand;

/**
* When this builder is created in the project configuration step,
* the builder object will be created from the strings below.
*
* @param msBuildName The Visual Studio logical name
* @param msBuildFile The name/location of the MSBuild file
* @param cmdLineArgs Whitespace separated list of command line arguments
* @param buildVariablesAsProperties If true, pass build variables as properties to MSBuild
* @param continueOnBuildFailure If true, job will continue dispite of MSBuild build failure
* @param unstableIfWarnings If true, job will be unstable if there are warnings
*/
@Deprecated
@SuppressWarnings("unused")
public MsBuildBuilder(String msBuildName, String msBuildFile, String cmdLineArgs, boolean buildVariablesAsProperties, boolean continueOnBuildFailure, boolean unstableIfWarnings) {
// By default, doNotUseChcpCommand=false
this(msBuildName, msBuildFile, cmdLineArgs, buildVariablesAsProperties, continueOnBuildFailure, unstableIfWarnings, false);
}

/**
* When this builder is created in the project configuration step,
* the builder object will be created from the strings below.
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/hudson/plugins/msbuild/MsBuildBuilderTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package hudson.plugins.msbuild;

import hudson.model.FreeStyleProject;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.recipes.LocalData;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
Expand All @@ -10,6 +14,9 @@
*/
public class MsBuildBuilderTest {

@Rule
public JenkinsRule r = new JenkinsRule();

@Test
public void shouldStripQuotedArguments() {
final String quotedPlatform = "/p:Platform=\"Any CPU\"";
Expand Down Expand Up @@ -40,4 +47,15 @@ public void endEscapedCharacter() {
assertEquals(oneArgumentsWithEndBackslash, tokenizedArgs[0]);
}

@Test
@LocalData
public void configRoundtrip() {
try {
FreeStyleProject project = (FreeStyleProject)r.jenkins.getAllItems().get(0);
r.configRoundtrip(project);
} catch (Exception e) {
throw new AssertionError("Not valid configuration for MsBuild");
}
}

}
Binary file not shown.

0 comments on commit 29e8603

Please sign in to comment.