Fix non-system specific path separator
This commit is contained in:
parent
9625db4b62
commit
0f7a7cf090
1 changed files with 32 additions and 9 deletions
|
@ -75,6 +75,19 @@ public class TestNgOperation extends TestOperation<TestNgOperation, List<String>
|
|||
return this;
|
||||
}
|
||||
|
||||
private String buildClassPath(String... path) {
|
||||
var classpath = new StringBuilder();
|
||||
for (var p : path) {
|
||||
if (!p.isBlank()) {
|
||||
if (!classpath.isEmpty()) {
|
||||
classpath.append(File.pathSeparator);
|
||||
}
|
||||
classpath.append(p);
|
||||
}
|
||||
}
|
||||
return classpath.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets the default maximum number of threads to use for data providers when running tests in parallel.
|
||||
* It will only take effect if the parallel mode has been selected (for example,with the
|
||||
|
@ -202,11 +215,13 @@ public class TestNgOperation extends TestOperation<TestNgOperation, List<String>
|
|||
|
||||
args.add("-cp");
|
||||
if (testClasspath_.isEmpty()) {
|
||||
args.add(String.format("%s:%s:%s:%s", new File(project_.libTestDirectory(), "*"),
|
||||
new File(project_.libCompileDirectory(), "*"), project_.buildMainDirectory(),
|
||||
project_.buildTestDirectory()));
|
||||
args.add(buildClassPath(joinClasspathJar(project_.testClasspathJars()),
|
||||
joinClasspathJar(project_.compileClasspathJars()),
|
||||
joinClasspathJar(project_.providedClasspathJars()),
|
||||
project_.buildMainDirectory().getAbsolutePath(),
|
||||
project_.buildTestDirectory().getAbsolutePath()));
|
||||
} else {
|
||||
args.add(String.join(":", testClasspath_));
|
||||
args.add(String.join(File.pathSeparator, testClasspath_));
|
||||
}
|
||||
|
||||
args.add("org.testng.TestNG");
|
||||
|
@ -372,6 +387,14 @@ public class TestNgOperation extends TestOperation<TestNgOperation, List<String>
|
|||
return this;
|
||||
}
|
||||
|
||||
private String joinClasspathJar(List<File> jars) {
|
||||
if (!jars.isEmpty()) {
|
||||
return String.join(File.pathSeparator, jars.stream().map(File::getAbsolutePath).toList());
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of {@code .class} files or list of class names implementing {@code ITestListener} or
|
||||
* {@code ISuiteListener}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue