Skip to content

Commit

Permalink
use classpath jar when classpath file provided
Browse files Browse the repository at this point in the history
The gradle plugin uses a classpath file to communicate with pitest when
the user classpath is too large to pass on the commandline line. In this
scenario the same issue is highly likely to be encountered when pitest
launches processes.

This change auto sets the classpath jar flag when a classpath file is
supplied to avoid the user having to set two parameters.
  • Loading branch information
hcoles committed Apr 13, 2023
1 parent b56a86c commit 4c36688
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ private void setClassPath(final OptionSet userArgs, final ReportOptions data) {
LOG.warning("Unable to read class path file:" + userArgs.valueOf(this.classPathFile).getAbsolutePath() + " - "
+ ioe.getMessage());
}
data.setUseClasspathJar(true);
}
elements.addAll(userArgs.valuesOf(this.additionalClassPathSpec));
data.setClassPathElements(elements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ public void shouldAcceptFileWithListOfAdditionalClassPathElements() {
assertTrue(actual.contains("/etc/bar"));
}

@Test
public void alsoSetsUseClasspathJarWhenClasspathFileProvided() {
final ClassLoader classLoader = getClass().getClassLoader();
final File classPathFile = new File(classLoader.getResource("testClassPathFile.txt").getFile());
final ReportOptions ro = parseAddingRequiredArgs("--classPathFile",
classPathFile.getAbsolutePath());
assertThat(ro.useClasspathJar()).isTrue();
}

@Test
public void shouldDetermineIfFailWhenNoMutationsFlagIsSet() {
assertTrue(parseAddingRequiredArgs("--failWhenNoMutations", "true")
Expand Down

0 comments on commit 4c36688

Please sign in to comment.