Skip to content

Commit

Permalink
Maven build dir can now be a softlink (#1859 fixes #1858)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg authored Nov 2, 2023
2 parents 1b0d489 + 70e0015 commit eb54d43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).

## [Unreleased]
### Changes
* Bump default `ktlint` version to latest `1.0.0` -> `1.0.1`. ([#1855](https://github.com/diffplug/spotless/pull/1855))

### Added
* CompileSourceRoots and TestCompileSourceRoots are now respected as default includes. These properties are commonly set when adding extra source directories. ([#1846](https://github.com/diffplug/spotless/issues/1846))
### Fixed
* Fix crash when build dir is a softlink to another directory. ([#1859](https://github.com/diffplug/spotless/pull/1859))
### Changes
* Bump default `ktlint` version to latest `1.0.0` -> `1.0.1`. ([#1855](https://github.com/diffplug/spotless/pull/1855))

## [2.40.0] - 2023-09-28
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
Expand Down Expand Up @@ -144,7 +145,14 @@ private void ensureParentDirExists() {
throw new IllegalStateException("Index file does not have a parent dir: " + indexFile);
}
try {
Files.createDirectories(parentDir);
if (Files.exists(parentDir, LinkOption.NOFOLLOW_LINKS)) {
Path realPath = parentDir.toRealPath();
if (!Files.exists(realPath)) {
Files.createDirectories(realPath);
}
} else {
Files.createDirectories(parentDir);
}
} catch (IOException e) {
throw new UncheckedIOException("Unable to create parent directory for the index file: " + indexFile, e);
}
Expand Down

0 comments on commit eb54d43

Please sign in to comment.