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

[JENKINS-48194] Binary compatibility broken in MsBuildBuilder #35

Merged
merged 3 commits into from
Jan 7, 2018
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
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.