private void createClasspathJar(String classPath, final List<String> cmd) { if (this.processArgs.useClasspathJar()) { try { cmd.add("-classpath"); cmd.add( ManifestUtils.createClasspathJarFile(classPath).getAbsolutePath()); } catch (Exception e) { throw new RuntimeException("Unable to create jar to contain classpath", e); } } }
/** * Because classpaths can become longer than the OS supports pitest creates temporary jar files and places the classpath * in the manifest where there is no size limit. * * We must therefore parse them out again here. * * @param elements existing elements */ private static void addEntriesFromClasspathManifest(final Set<File> elements) { Optional<File> maybeJar = elements.stream().filter( f -> f.getName().startsWith("classpath") && f.getName().endsWith(".jar")) .findFirst(); maybeJar.ifPresent(file -> elements.addAll(ManifestUtils.readClasspathManifest(file))); }
@Test public void shouldParseTheManifestsItCreates() throws IOException { File actual = ManifestUtils.createClasspathJarFile("/some/path/foo.jar:/some/path/"); assertThat(ManifestUtils.readClasspathManifest(actual)) .containsExactly(new File("/some/path/foo.jar"), new File("/some/path/")); }
/** * Because classpaths can become longer than the OS supports pitest creates temporary jar files and places the classpath * in the manifest where there is no size limit. * * We must therefore parse them out again here. * * @param elements existing elements */ private static void addEntriesFromClasspathManifest(final Set<File> elements) { Optional<File> maybeJar = elements.stream().filter( f -> f.getName().startsWith("classpath") && f.getName().endsWith(".jar")) .findFirst(); maybeJar.ifPresent(file -> elements.addAll(ManifestUtils.readClasspathManifest(file))); }