diff --git a/src/main/java/au/com/rayh/XCodeBuilder.java b/src/main/java/au/com/rayh/XCodeBuilder.java index 282971f9..48dfe5ea 100644 --- a/src/main/java/au/com/rayh/XCodeBuilder.java +++ b/src/main/java/au/com/rayh/XCodeBuilder.java @@ -534,7 +534,12 @@ else if (StringUtils.isEmpty(cfBundleVersion)) } static List splitXcodeBuildArguments(String xcodebuildArguments) { - return Arrays.asList(xcodebuildArguments.split("[ ]")); + String[] parts = xcodebuildArguments.split("(? result = new ArrayList(parts.length); + for(String arg : parts) { + result.add(arg.replaceAll("\\\\ ", " ")); + } + return result; } @Override diff --git a/src/test/java/au/com/rayh/XCodeBuilderTest.java b/src/test/java/au/com/rayh/XCodeBuilderTest.java index fbaae3e0..23eaadaa 100644 --- a/src/test/java/au/com/rayh/XCodeBuilderTest.java +++ b/src/test/java/au/com/rayh/XCodeBuilderTest.java @@ -52,4 +52,12 @@ public void shouldSplitXcodeBuildArgumentsWithoutEscapedSpaces() throws Exceptio assertEquals(asList("GCC_SYMBOLS_PRIVATE_EXTERN=NO", "COPY_PHASE_STRIP=NO"), XCodeBuilder.splitXcodeBuildArguments("GCC_SYMBOLS_PRIVATE_EXTERN=NO COPY_PHASE_STRIP=NO")); } + + @Test + public void shouldSplitXcodeBuildArgumentsWithEscapedSpaces() throws Exception { + assertEquals(asList("CODE_SIGN_IDENTITY=iPhone Developer: Todd Kirby"), + XCodeBuilder.splitXcodeBuildArguments("CODE_SIGN_IDENTITY=iPhone\\ Developer:\\ Todd\\ Kirby")); + assertEquals(asList("A=B", "CODE_SIGN_IDENTITY=iPhone Developer: Todd Kirby"), + XCodeBuilder.splitXcodeBuildArguments("A=B CODE_SIGN_IDENTITY=iPhone\\ Developer:\\ Todd\\ Kirby")); + } } \ No newline at end of file