Skip to content

Commit

Permalink
Add pin-project-references option.
Browse files Browse the repository at this point in the history
  • Loading branch information
jam40jeff committed Aug 4, 2016
1 parent 765e4be commit bc2e69e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Paket.Core/PackageMetaData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, TemplateFile * ProjectFile>) includeReferencedProjects (version :SemVerInfo option) specificVersions =
let findDependencies (dependenciesFile : DependenciesFile) config platform (template : TemplateFile) (project : ProjectFile) lockDependencies minimumFromLockFile pinProjectReferences (map : Map<string, TemplateFile * ProjectFile>) includeReferencedProjects (version :SemVerInfo option) specificVersions =
let targetDir =
match project.OutputType with
| ProjectOutputType.Exe -> "tools/"
Expand Down Expand Up @@ -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 ->
Expand Down
4 changes: 2 additions & 2 deletions src/Paket.Core/PackageProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/Paket.Core/PublicAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down
2 changes: 2 additions & 0 deletions src/Paket/Commands.fs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ type PackArgs =
| [<CustomCommandLine("releaseNotes")>] ReleaseNotes of text:string
| [<CustomCommandLine("lock-dependencies")>] LockDependencies
| [<CustomCommandLine("minimum-from-lock-file")>] LockDependenciesToMinimum
| [<CustomCommandLine("pin-project-references")>] PinProjectReferences
| [<CustomCommandLine("symbols")>] Symbols
| [<CustomCommandLine("include-referenced-projects")>] IncludeReferencedProjects
| [<CustomCommandLine("project-url")>] ProjectUrl of url:string
Expand All @@ -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."
Expand Down
1 change: 1 addition & 0 deletions src/Paket/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @>)
Expand Down

0 comments on commit bc2e69e

Please sign in to comment.