Skip to content
Permalink
Browse files
[FIXED JENKINS-29226] improved command line parsing WRT environment a…
…nd build parameters
  • Loading branch information
lacostej committed Jul 4, 2015
1 parent ffa82b8 commit ca20631044592cda1cd2dc1895e76227bd1822fd
Showing with 25 additions and 5 deletions.
  1. +7 −5 src/main/java/org/jenkinsci/plugins/unity3d/Unity3dBuilder.java
  2. +18 −0 src/test/java/org/jenkinsci/plugins/unity3d/Unity3dBuilderTest.java
@@ -242,13 +242,15 @@ ArgumentListBuilder createCommandlineArgs(String exe, String moduleRootRemote, E
args.add(exe);

String theArgLine = getArgLineOrGlobalArgLine();
if (!theArgLine.contains("-projectPath")) {
args.add("-projectPath", moduleRootRemote);
}


String finalArgLine = Util.replaceMacro(theArgLine, buildVariables);
finalArgLine = Util.replaceMacro(finalArgLine, vars);

finalArgLine = Util.replaceMacro(finalArgLine, buildVariables);

if (!finalArgLine.contains("-projectPath")) {
args.add("-projectPath", moduleRootRemote);
}

args.add(QuotedStringTokenizer.tokenize(finalArgLine));
return args;
}
@@ -79,6 +79,24 @@ public void environmentAndBuildVariablesParsing() {
assertEquals("Serialized arg line not modified", argLine, builder.getArgLine());
}

@Test
public void environmentAndBuildVariablesParsingWithEnvVarsThatReferencesBuildParameters() {
EnvVars vars = new EnvVars();
vars.put("ARGS", "-projectPath $param");

Map<String,String> buildParameters = new Hashtable<String,String>();
buildParameters.put("param", "XXXX");

argLine = "-p1 v1 $ARGS";
expectedArgs = asList(exe, "-p1", "v1", "-projectPath", "XXXX");

Unity3dBuilder builder = new Unity3dBuilder("Unity 3.5", argLine, "");
ArgumentListBuilder commandlineArgs = builder.createCommandlineArgs(exe, moduleRootRemote, vars, buildParameters);
assertEquals(expectedArgs, commandlineArgs.toList());
assertEquals("Serialized arg line not modified", argLine, builder.getArgLine());
}


@Test
public void unstableErrorCodesParsing() throws Exception {
ensureUnstableReturnCodesParsingWorks(new Integer[]{}, "");

0 comments on commit ca20631

Please sign in to comment.