File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
buildSrc/src/main/java/org/opensearch/gradle/precommit Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -309,6 +309,25 @@ private void extractJars(Set<File> jars) {
309
309
jars .forEach (jar -> {
310
310
FileTree jarFiles = getProject ().zipTree (jar );
311
311
getProject ().copy (spec -> {
312
+ spec .eachFile (details -> {
313
+ File targetFile = new File (jarExpandDir , details .getPath ());
314
+ if (targetFile .exists ()) {
315
+ if ((targetFile .isDirectory () && !details .isDirectory ()) || (details .isDirectory () && targetFile .isFile ())) {
316
+
317
+ // Windows duplicate handling. dup.txt-1, dup.txt-2, ...
318
+ int counter = 1 ;
319
+ String basePath = details .getPath ();
320
+ String newPath ;
321
+ do {
322
+ newPath = basePath + "-" + counter ++;
323
+ targetFile = new File (jarExpandDir , newPath );
324
+ } while (targetFile .exists ());
325
+
326
+ details .setPath (newPath );
327
+ }
328
+ }
329
+ });
330
+
312
331
spec .from (jarFiles );
313
332
spec .into (jarExpandDir );
314
333
// exclude classes from multi release jars
You can’t perform that action at this time.
0 commit comments