Skip to content

Commit 84a2291

Browse files
committed
Clarify
1 parent e8cb957 commit 84a2291

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 2.2.0
2-
* Added an explicit option for enabling the Windows NTFS junction fix: ``withUseWinNTFSJunctionFix`` #155
2+
* Added an explicit option for enabling the Windows NTFS junction fix: ``useWinNTFSJunctionFixIfApplicable`` #155
33
* Enabling it also requires adding ``--add-exports java.base/sun.nio.fs=ALL-UNNAMED`` or performance will be impacted by 100x due to non-accessible file attributes cache
44
* This option is temporary and will be removed once the underlying JDK bug was fixed
55
* The default logger of ``AdvancedImageFromDockerFile`` now also includes ``dockerImageName`` to make it easier to distinguish between parallel builds

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/AdvancedImageFromDockerFile.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public class AdvancedImageFromDockerFile
121121
protected Optional<String> target = Optional.empty();
122122
protected final Set<Consumer<BuildImageCmd>> buildImageCmdModifiers = new LinkedHashSet<>();
123123
protected Set<String> externalDependencyImageNames = Collections.emptySet();
124-
protected boolean useWinNTFSJunctionFix;
124+
protected boolean useWinNTFSJunctionFixIfApplicable;
125125

126126
@SuppressWarnings("checkstyle:MagicNumber")
127127
public AdvancedImageFromDockerFile()
@@ -366,7 +366,7 @@ protected void configure(final BuildImageCmd buildImageCmd)
366366
this.ignoreFileLineFilter,
367367
this.postGitIgnoreLines,
368368
alwaysIncludePaths,
369-
this.useWinNTFSJunctionFix);
369+
this.useWinNTFSJunctionFixIfApplicable);
370370

371371
this.log().info(
372372
"{}x files will be transferred (determination took {}ms)",
@@ -612,14 +612,14 @@ public AdvancedImageFromDockerFile withBuildImageCmdModifier(final Consumer<Buil
612612
}
613613

614614
/**
615-
* Should the fix for a crash when encountering Windows NTFS Junctions be applied?
615+
* Should the fix for a crash when encountering Windows NTFS Junctions be applied if applicable?
616616
* <p>
617617
* See {@link software.xdev.testcontainers.imagebuilder.transfer.java.nio.file.winntfs} for details
618618
* </p>
619619
*/
620-
public AdvancedImageFromDockerFile withUseWinNTFSJunctionFix(final boolean useWinNTFSJunctionFix)
620+
public AdvancedImageFromDockerFile withUseWinNTFSJunctionFixIfApplicable(final boolean useWinNTFSJunctionFixIfApplicable)
621621
{
622-
this.useWinNTFSJunctionFix = useWinNTFSJunctionFix;
622+
this.useWinNTFSJunctionFixIfApplicable = useWinNTFSJunctionFixIfApplicable;
623623
return this;
624624
}
625625
}

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/transfer/DefaultTransferFilesCreator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public Map<Path, String> determineFilesToTransfer(
8383
final Predicate<String> ignoreFileLineFilter,
8484
final Set<String> postGitIgnoreLines,
8585
final Set<String> alwaysIncludedRelativePaths,
86-
final boolean useWinNTFSJunctionFix)
86+
final boolean useWinNTFSJunctionFixIfApplicable)
8787
{
8888
try
8989
{
@@ -102,7 +102,7 @@ public Map<Path, String> determineFilesToTransfer(
102102
return this.walkFilesAndDetermineTransfer(
103103
ignoreNode,
104104
alwaysIncludedRelativePaths,
105-
useWinNTFSJunctionFix);
105+
useWinNTFSJunctionFixIfApplicable);
106106
}
107107
catch(final IOException ioe)
108108
{
@@ -136,10 +136,10 @@ protected IgnoreNode createIgnoreNode(final Set<String> ignoreLines)
136136
protected Map<Path, String> walkFilesAndDetermineTransfer(
137137
final IgnoreNode ignoreNode,
138138
final Set<String> alwaysIncludedRelativePaths,
139-
final boolean useWinNTFSJunctionFix) throws IOException
139+
final boolean useWinNTFSJunctionFixIfApplicable) throws IOException
140140
{
141141
try(final Stream<Path> walk = findFiles(
142-
useWinNTFSJunctionFix,
142+
useWinNTFSJunctionFixIfApplicable,
143143
this.baseDir,
144144
Integer.MAX_VALUE,
145145
// Ignore directories
@@ -165,14 +165,14 @@ protected Map<Path, String> walkFilesAndDetermineTransfer(
165165
}
166166

167167
protected static Stream<Path> findFiles(
168-
final boolean useWinNTFSJunctionFix,
168+
final boolean useWinNTFSJunctionFixIfApplicable,
169169
final Path start,
170170
final int maxDepth,
171171
final BiPredicate<Path, BasicFileAttributes> matcher,
172172
final FileVisitOption... options)
173173
throws IOException
174174
{
175-
return useWinNTFSJunctionFix && WinNTFSJunctionFiles.shouldBeApplied(start)
175+
return useWinNTFSJunctionFixIfApplicable && WinNTFSJunctionFiles.shouldBeApplied(start)
176176
? WinNTFSJunctionFiles.find(start, maxDepth, matcher, options)
177177
: Files.find(start, maxDepth, matcher, options);
178178
}

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/transfer/TransferFilesCreator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Map<Path, String> determineFilesToTransfer(
2929
Predicate<String> ignoreFileLineFilter,
3030
Set<String> postGitIgnoreLines,
3131
Set<String> alwaysIncludedRelativePaths,
32-
boolean useWinNTFSJunctionFix);
32+
boolean useWinNTFSJunctionFixIfApplicable);
3333

3434
InputStream getAllFilesToTransferAsTarInputStream(
3535
Map<Path, String> filesToTransfer,

0 commit comments

Comments
 (0)