Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#### Unreleased

* BREAKING: `paket pack --release-notes-file` reads the file with Fake.Core.ReleaseNotes 6, in the formats described in https://fake.build/reference/fake-core-releasenotes.html: the package version is the first word of the latest header that is a whole SemVer version, so `## [1.2.3] - 2020-01-01` and `## v1.2.3 - 2020-01-01` give `2020-01-01`; pass `--version` for such headers. Prerelease versions like `1.2.3-beta.11.2` are no longer cut, and build metadata (`+sha.abc`) is kept - https://github.com/fsprojects/FAKE/pull/2686
* BREAKING: Paket no longer looks for projects and `paket.template` files in the folders whose name starts with a dot, like `.devenv`, nor in the folders that are links, as `paket convert-from-nuget` already did for the solutions and NuGet files: the projects there are left out of install, restore, update, remove and pack. Until now only `.git` and `.fable` were skipped. A cyclic link, as in a Nix `.devenv` profile, no longer makes the search run forever - https://github.com/fsprojects/Paket/pull/4421
* BREAKING: Paket no longer looks for projects in the folders whose name starts with a dot, like `.devenv`, nor in the folders that are links, as `paket convert-from-nuget` already did for the solutions and NuGet files: the projects there are left out of install, restore, update, add, remove and convert-from-nuget. `paket pack` still finds the `paket.template` files there, but packs a `project` template without the assemblies and dependencies of its project, and fails when its folder holds more than one project. Until now only `.git` and `.fable` were skipped - https://github.com/fsprojects/Paket/pull/4421
* Looking for projects no longer runs forever on a cyclic directory link, as in a Nix `.devenv` profile. `paket pack` still follows the links when it looks for template files - https://github.com/fsprojects/Paket/pull/4421 @michaelglass
* The warning about the FSharp.Core binding redirects of F# projects links to an existing section of the documentation

#### 12.0.0-alpha003 - 2026-10-26
Expand Down
10 changes: 10 additions & 0 deletions docs/content/references-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ differences:
Paket looks for `paket.references` files underneath the directory where
[`paket.dependencies`](dependencies-file.html) is located.

Paket does not look into the folders whose name starts with a dot, like `.git`,
`.vs` or `.devenv`, nor into the folders that are symbolic links or junctions,
which may lead out of the repository or back into it on a cycle. The projects
there are left out of the commands that look for projects, such as
[`paket install`](paket-install.html), [`paket update`](paket-update.html),
[`paket add`](paket-add.html), [`paket remove`](paket-remove.html),
[`paket convert-from-nuget`](paket-convert-from-nuget.html) and a
[`paket restore`](paket-restore.html) of the whole repository. See the
[`paket.template` files](template-files.html) for `paket pack`.

## Layout

The file whitelists any dependencies from the
Expand Down
9 changes: 9 additions & 0 deletions docs/content/template-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ possible values:
* `project`: Paket will look for a matching project file, and infer dependencies
and metadata from the project

`paket pack` looks for the template files in every folder but the `packages`
and `paket-files` folders at the top, including the folders whose name starts
with a dot and the links, so a cyclic link there can keep it from finishing.
It does not look for projects in these folders, though (see
[the `paket.references` files](references-files.html#Location)), so it does not
pack their `project` templates properly: the package gets neither the
assemblies nor the dependencies of the project, and `paket pack` fails when the
folder holds more than one project. Keep such templates out of these folders.

Matching project and template files must be in the same directory. If only one
project is in the directory the template file can be called `paket.template`,
otherwise the name of the template file must be the name of the project file
Expand Down
14 changes: 9 additions & 5 deletions src/Paket.Core/Common/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,16 @@ let isLink (fileSystemInfo: FileSystemInfo) =
&& fileSystemInfo.Attributes.HasFlag(FileAttributes.ReparsePoint)
&& (try not (isNull fileSystemInfo.LinkTarget) with _ -> true)

/// Whether a search for project related files should not descend into the directory: its name starts
/// with a dot (e.g. .git, .vs, .localhistory, .devenv), so it is not expected to contain relevant files
/// and can be large or contain unrelated backup/history data (see issue #3250), or it is a link,
/// which may lead out of the folder, or back into it on a cycle
/// Whether the name of the directory starts with a dot (e.g. .git, .vs, .localhistory, .devenv): it is not
/// expected to contain relevant files and can be large or contain unrelated backup/history data (see issue #3250)
let isDotDirectory (directory: DirectoryInfo) =
directory.Name.StartsWith '.'

/// Whether FindAllFiles and SearchAllProjectRelatedFiles do not descend into the directory: it is a dot directory,
/// or a link, which may lead out of the folder, or back into it on a cycle.
/// SearchAllProjectRelatedFiles skips other directories too, such as packages and node_modules
let isSkippedSearchDirectory (directory: DirectoryInfo) =
directory.Name.StartsWith "." || isLink directory
isDotDirectory directory || isLink directory

/// Gets all files with the given pattern, skipping the directories for which isSkippedSearchDirectory holds
let FindAllFiles(folder, pattern) : FileInfo [] =
Expand Down
15 changes: 4 additions & 11 deletions src/Paket.Core/PackageManagement/NugetConvert.fs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ let private findLinkedFolders (rootDirectory : DirectoryInfo) =
let rec linkedFolders (directory : DirectoryInfo) =
seq {
for subDirectory in directory.GetDirectories() do
if not (subDirectory.Name.StartsWith ".") then
if not (isDotDirectory subDirectory) then
if isLink subDirectory then yield subDirectory
else yield! linkedFolders subDirectory
}
Expand Down Expand Up @@ -220,20 +220,13 @@ module NugetEnv =
Result.Succeed None
|> lift (fun configFile -> (projectFile,configFile))

// a project reached through a link may be out of the repository, like the files FindAllFiles skips;
// read warns about the folders that are links, so only the project files that are links get a warning
let root = rootDirectory.FullName.TrimEnd(Path.DirectorySeparatorChar)
let rec isBelowLink (directory : DirectoryInfo) =
not (isNull directory)
&& directory.FullName.TrimEnd(Path.DirectorySeparatorChar) <> root
&& (isLink directory || isBelowLink directory.Parent)

// FindAllProjects does not descend into the folders that are links, which read warns about,
// so only the project files that are links are left to skip, with a warning
let projectFiles =
ProjectFile.FindAllProjects rootDirectory.FullName
|> Array.filter (fun projectFile ->
let file = FileInfo projectFile.FileName
if isBelowLink file.Directory then false
elif isLink file then
if isLink file then
traceWarnfn $"%s{file.FullName} is a link: convert-from-nuget leaves it unchanged."
false
else true)
Expand Down
6 changes: 4 additions & 2 deletions src/Paket.Core/PaketConfigFiles/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1910,8 +1910,10 @@ type ProjectFile with

member this.FindOrCreateReferencesFile() = ProjectFile.FindOrCreateReferencesFile (FileInfo this.FileName)

// searches directory and all subdirectories for the search pattern, skipping known problematic directories
// and the ones for which isSkippedSearchDirectory holds
// searches directory and all subdirectories for the search pattern, skipping the ones for which
// isSkippedSearchDirectory holds, as FindAllFiles does, and also the packages and node_modules folders,
// the paket-files folder of the root, the folders with their own paket.dependencies,
// and the Linux system roots when searching from /
static member SearchAllProjectRelatedFiles searchPattern folder : FileInfo [] =
let paketPath = Path.Combine(folder,Constants.PaketFilesFolderName) |> normalizePath

Expand Down
Loading