diff --git a/src/Paket.Core/PackageMetaData.fs b/src/Paket.Core/PackageMetaData.fs index f2a5ff40a2..e2764a553b 100644 --- a/src/Paket.Core/PackageMetaData.fs +++ b/src/Paket.Core/PackageMetaData.fs @@ -133,7 +133,7 @@ let addFile (source : string) (target : string) (templateFile : TemplateFile) = | IncompleteTemplate -> failwith (sprintf "You should only try and add files to template files with complete metadata.%sFile: %s" Environment.NewLine templateFile.FileName) -let findDependencies (dependenciesFile : DependenciesFile) config platform (template : TemplateFile) (project : ProjectFile) lockDependencies minimumFromLockFile (map : Map) includeReferencedProjects (version :SemVerInfo option) specificVersions = +let findDependencies (dependenciesFile : DependenciesFile) config platform (template : TemplateFile) (project : ProjectFile) lockDependencies minimumFromLockFile pinProjectReferences (map : Map) includeReferencedProjects (version :SemVerInfo option) specificVersions = let targetDir = match project.OutputType with | ProjectOutputType.Exe -> "tools/" @@ -245,7 +245,7 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp | CompleteTemplate(core, opt) -> match core.Version with | Some v -> - let versionConstraint = if not lockDependencies then Minimum v else Specific v + let versionConstraint = if lockDependencies || pinProjectReferences then Specific v else Minimum v PackageName core.Id, VersionRequirement(versionConstraint, getPreReleaseStatus v) | None -> failwithf "There was no version given for %s." templateFile.FileName | IncompleteTemplate -> diff --git a/src/Paket.Core/PackageProcess.fs b/src/Paket.Core/PackageProcess.fs index edd9798442..a7ea67068c 100644 --- a/src/Paket.Core/PackageProcess.fs +++ b/src/Paket.Core/PackageProcess.fs @@ -113,7 +113,7 @@ let private convertToSymbols (projectFile : ProjectFile) (includeReferencedProje let augmentedFiles = optional.Files |> List.append sourceFiles { templateFile with Contents = ProjectInfo({ core with Symbols = true }, { optional with Files = augmentedFiles }) } -let Pack(workingDir,dependenciesFile : DependenciesFile, packageOutputPath, buildConfig, buildPlatform, version, specificVersions, releaseNotes, templateFile, excludedTemplates, lockDependencies, minimumFromLockFile, symbols, includeReferencedProjects, projectUrl) = +let Pack(workingDir,dependenciesFile : DependenciesFile, packageOutputPath, buildConfig, buildPlatform, version, specificVersions, releaseNotes, templateFile, excludedTemplates, lockDependencies, minimumFromLockFile, pinProjectReferences, symbols, includeReferencedProjects, projectUrl) = let buildConfig = defaultArg buildConfig "Release" let buildPlatform = defaultArg buildPlatform "" let packageOutputPath = if Path.IsPathRooted(packageOutputPath) then packageOutputPath else Path.Combine(workingDir,packageOutputPath) @@ -207,7 +207,7 @@ let Pack(workingDir,dependenciesFile : DependenciesFile, packageOutputPath, buil yield template, p } ) - |> Seq.map (fun (t, p) -> findDependencies dependenciesFile buildConfig buildPlatform t p lockDependencies minimumFromLockFile projectTemplates includeReferencedProjects version specificVersions) + |> Seq.map (fun (t, p) -> findDependencies dependenciesFile buildConfig buildPlatform t p lockDependencies minimumFromLockFile pinProjectReferences projectTemplates includeReferencedProjects version specificVersions) |> Seq.append remaining |> Seq.toList diff --git a/src/Paket.Core/PublicAPI.fs b/src/Paket.Core/PublicAPI.fs index 1be2a8286c..36c4e32751 100644 --- a/src/Paket.Core/PublicAPI.fs +++ b/src/Paket.Core/PublicAPI.fs @@ -535,16 +535,17 @@ type Dependencies(dependenciesFileName: string) = |> this.Process // Packs all paket.template files. - member this.Pack(outputPath, ?buildConfig, ?buildPlatform, ?version, ?specificVersions, ?releaseNotes, ?templateFile, ?workingDir, ?excludedTemplates, ?lockDependencies, ?minimumFromLockFile, ?symbols, ?includeReferencedProjects, ?projectUrl) = + member this.Pack(outputPath, ?buildConfig, ?buildPlatform, ?version, ?specificVersions, ?releaseNotes, ?templateFile, ?workingDir, ?excludedTemplates, ?lockDependencies, ?minimumFromLockFile, ?pinProjectReferences, ?symbols, ?includeReferencedProjects, ?projectUrl) = let dependenciesFile = DependenciesFile.ReadFromFile dependenciesFileName let specificVersions = defaultArg specificVersions Seq.empty let workingDir = defaultArg workingDir (dependenciesFile.FileName |> Path.GetDirectoryName) let lockDependencies = defaultArg lockDependencies false let minimumFromLockFile = defaultArg minimumFromLockFile false + let pinProjectReferences = defaultArg pinProjectReferences false let symbols = defaultArg symbols false let includeReferencedProjects = defaultArg includeReferencedProjects false let projectUrl = defaultArg (Some(projectUrl)) None - PackageProcess.Pack(workingDir, dependenciesFile, outputPath, buildConfig, buildPlatform, version, specificVersions, releaseNotes, templateFile, excludedTemplates, lockDependencies, minimumFromLockFile, symbols, includeReferencedProjects, projectUrl) + PackageProcess.Pack(workingDir, dependenciesFile, outputPath, buildConfig, buildPlatform, version, specificVersions, releaseNotes, templateFile, excludedTemplates, lockDependencies, minimumFromLockFile, pinProjectReferences, symbols, includeReferencedProjects, projectUrl) /// Pushes a nupkg file. static member Push(packageFileName, ?url, ?apiKey, (?endPoint: string), ?maxTrials) = diff --git a/src/Paket/Commands.fs b/src/Paket/Commands.fs index 42cc711fd3..92aa77af04 100644 --- a/src/Paket/Commands.fs +++ b/src/Paket/Commands.fs @@ -264,6 +264,7 @@ type PackArgs = | [] ReleaseNotes of text:string | [] LockDependencies | [] LockDependenciesToMinimum + | [] PinProjectReferences | [] Symbols | [] IncludeReferencedProjects | [] ProjectUrl of url:string @@ -281,6 +282,7 @@ with | ReleaseNotes(_) -> "Specify relase notes for the package." | LockDependencies -> "Get the version requirements from paket.lock instead of paket.dependencies." | LockDependenciesToMinimum -> "Get the version requirements from paket.lock instead of paket.dependencies, and add them as a minimum version. `lock-dependencies` will over-ride this option." + | PinProjectReferences -> "Pin dependencies generated from project references (=) instead of using minimum (>=) for version specification. If `lock-dependencies` is specified, project references will be pinned even if this option is not specified." | Symbols -> "Build symbol/source packages in addition to library/content packages." | IncludeReferencedProjects -> "Include symbol/source from referenced projects." | ProjectUrl(_) -> "Url to the projects home page." diff --git a/src/Paket/Program.fs b/src/Paket/Program.fs index 8faf992177..aed35fec72 100644 --- a/src/Paket/Program.fs +++ b/src/Paket/Program.fs @@ -205,6 +205,7 @@ let pack (results : ParseResults<_>) = workingDir = Environment.CurrentDirectory, lockDependencies = results.Contains <@ PackArgs.LockDependencies @>, minimumFromLockFile = results.Contains <@ PackArgs.LockDependenciesToMinimum @>, + pinProjectReferences = results.Contains <@ PackArgs.PinProjectReferences @>, symbols = results.Contains <@ PackArgs.Symbols @>, includeReferencedProjects = results.Contains <@ PackArgs.IncludeReferencedProjects @>, ?projectUrl = results.TryGetResult <@ PackArgs.ProjectUrl @>)