Skip to content

Commit

Permalink
Merge branch 'master' into core3
Browse files Browse the repository at this point in the history
# Conflicts:
#	RELEASE_NOTES.md
#	src/Paket.Bootstrapper/Properties/AssemblyInfo.cs
#	src/Paket.Core/AssemblyInfo.fs
#	src/Paket.Core/Paket.Core/project.json
#	src/Paket.PowerShell/AssemblyInfo.fs
#	src/Paket/AssemblyInfo.fs
  • Loading branch information
forki committed Nov 3, 2016
2 parents 17f6538 + a29dc36 commit 62f8f18
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 29 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,5 @@ docs/tools/FSharp.Formatting.svclog
docs/content/paket.exe
TestResult.xml
tests/Paket.Tests/NuGetConfig/PasswordConfig.xml
paket.local
paket.local
dotnetcore
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* Make Paket compatible with dotnet sdk preview3
* USABILITY: Added option to have paket restore fail on check failure - https://github.com/fsprojects/Paket/pull/1963

#### 3.26.1 - 03.11.2016
* BUGFIX: Version constraint was missing on referenced projects packed separately - https://github.com/fsprojects/Paket/issues/1976
* BUGFIX: Make download loop to terminate in max N=5 iterations - https://github.com/fsprojects/Paket/pull/1999

#### 3.26.0 - 31.10.2016
* New Command: paket why - http://theimowski.com/blog/2016/10-30-paket-why-command/index.html
* BUGFIX: Do not remove main group - https://github.com/fsprojects/Paket/issues/1950
Expand Down
49 changes: 43 additions & 6 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// --------------------------------------------------------------------------------------

#r @"packages/build/FAKE/tools/FakeLib.dll"
#r "System.IO.Compression.FileSystem"

open Fake
open Fake.Git
Expand Down Expand Up @@ -60,6 +61,11 @@ let gitName = "Paket"
// The url for the raw files hosted
let gitRaw = environVarOrDefault "gitRaw" "https://raw.github.com/fsprojects"


let dotnetcliVersion = "1.0.0-preview3-004031"

let dotnetPath = DirectoryInfo "./dotnetcore"

// --------------------------------------------------------------------------------------
// END TODO: The rest of the file includes standard build steps
// --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -117,6 +123,41 @@ Target "AssemblyInfo" (fun _ ->
csProjs |> Seq.filter (fun s -> s.Contains "PaketRestoreTask" |> not) |> Seq.iter genCSAssemblyInfo
)

let dotnetExePath = if isWindows then "dotnetcore/dotnet.exe" else "dotnetcore/dotnet" |> FullName

Target "InstallDotNetCore" (fun _ ->
let correctVersionInstalled =
try
if FileInfo(Path.Combine(dotnetPath.FullName,"dotnet.exe")).Exists then
let processResult =
ExecProcessAndReturnMessages (fun info ->
info.FileName <- dotnetExePath
info.WorkingDirectory <- Environment.CurrentDirectory
info.Arguments <- "--version") (TimeSpan.FromMinutes 30.)

processResult.Messages |> separated "" = dotnetcliVersion

else
false
with
| _ -> false

if correctVersionInstalled then
tracefn "dotnetcli %s already installed" dotnetcliVersion
else
CleanDir dotnetPath.FullName
let zipFileName = sprintf "dotnet-dev-win-x64.%s.zip" dotnetcliVersion
let downloadPath = sprintf "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/%s/%s" dotnetcliVersion zipFileName
let localPath = Path.Combine(dotnetPath.FullName, zipFileName)

tracefn "Installing '%s' to '%s" downloadPath localPath

use webclient = new Net.WebClient()
webclient.DownloadFile(downloadPath, localPath)

System.IO.Compression.ZipFile.ExtractToDirectory(localPath, dotnetPath.FullName)
)

// --------------------------------------------------------------------------------------
// Clean build results

Expand All @@ -140,11 +181,6 @@ Target "Build" (fun _ ->
|> ignore
)

let dotnetExePath =
match tryFindFileOnPath (if isWindows then "dotnet.exe" else "dotnet") with
| Some p -> p
| None -> ""

Target "DotnetRestore" (fun _ ->
// dotnet restore
!! "src/**/project.json"
Expand Down Expand Up @@ -492,8 +528,9 @@ Target "All" DoNothing

"Clean"
==> "AssemblyInfo"
==> "Build"
=?> ("InstallDotNetCore", not <| hasBuildParam "DISABLE_NETCORE")
=?> ("DotnetRestore", not <| hasBuildParam "DISABLE_NETCORE")
==> "Build"
=?> ("DotnetPackage", not <| hasBuildParam "DISABLE_NETCORE")
=?> ("BuildPowerShell", not isMono)
==> "RunTests"
Expand Down
1 change: 1 addition & 0 deletions docs/content/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ The following files can be committed, but are not essential:
The following files should *not* be committed to your version control system, and should be added to any ignore files:

* `.paket/paket.exe` - the main Paket executable, downloaded by [`.paket/paket.bootstrapper.exe`](getting-started.html). This should not be committed, as it is a binary file, which can unnecessarily bloat repositories, and because it is likely to be updated on a regular basis.
* `paket-files` directory, as paket install will restore this. Same goes for the `packages` directory

## Why should I commit the lock file?

Expand Down
7 changes: 4 additions & 3 deletions src/Paket.Core/NuGetV2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ let DownloadPackage(root, (source : PackageSource), caches:Cache list, groupName
| _ -> getFromCache rest
| [] -> false

let rec download authenticated =
let rec download authenticated attempt =
async {
if not force && targetFile.Exists && targetFile.Length > 0L then
verbosefn "%O %O already downloaded." packageName version
Expand Down Expand Up @@ -979,16 +979,17 @@ let DownloadPackage(root, (source : PackageSource), caches:Cache list, groupName
traceWarnfn "Could not download license for %O %O from %s.%s %s" packageName version nugetPackage.LicenseUrl Environment.NewLine exn.Message
with
| :? System.Net.WebException as exn when
attempt < 5 &&
exn.Status = WebExceptionStatus.ProtocolError &&
(match source.Auth |> Option.map toBasicAuth with
| Some(Credentials(_)) -> true
| _ -> false)
-> do! download false
-> do! download false (attempt + 1)
| exn when String.IsNullOrWhiteSpace !downloadUrl -> failwithf "Could not download %O %O.%s %s" packageName version Environment.NewLine exn.Message
| exn -> failwithf "Could not download %O %O from %s.%s %s" packageName version !downloadUrl Environment.NewLine exn.Message }

async {
do! download true
do! download true 0
let! files = CopyFromCache(root, groupName, targetFile.FullName, licenseFileName, packageName, version, includeVersionInPath, force, detailed)
return targetFileName,files
}
47 changes: 28 additions & 19 deletions src/Paket.Core/PackageMetaData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
let assemblyfi = FileInfo(assemblyFileName)
let name = Path.GetFileNameWithoutExtension assemblyfi.Name

let projectdir = Path.GetDirectoryName(Path.GetFullPath(project.FileName))
let path = Path.Combine(projectDir, project.GetOutputDirectory config platform)

Directory.GetFiles(path, name + ".*")
Expand All @@ -240,8 +239,8 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp

let templateWithOutputAndExcludes =
match template.Contents with
| CompleteInfo(core, optional) -> optional.ExcludedGroups
| ProjectInfo(core, optional) -> optional.ExcludedGroups
| CompleteInfo(_, optional) -> optional.ExcludedGroups
| ProjectInfo(_, optional) -> optional.ExcludedGroups
|> Seq.collect dependenciesFile.GetDependenciesInGroup
|> Seq.fold (fun templatefile package -> excludeDependency templatefile package.Key) templateWithOutput

Expand All @@ -250,7 +249,7 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
deps
|> List.map (fun (templateFile, _) ->
match templateFile with
| CompleteTemplate(core, opt) ->
| CompleteTemplate(core, _) ->
match core.Version with
| Some v ->
let versionConstraint = if lockDependencies || pinProjectReferences then Specific v else Minimum v
Expand All @@ -275,7 +274,7 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
| Some f ->
let refFile = ReferencesFile.FromFile f
refFile.Groups
|> Seq.map (fun kv -> kv.Value.NugetPackages |> List.map (fun p -> Some kv.Key, p))
|> Seq.map (fun kv -> kv.Value.NugetPackages |> List.map (fun p -> Some kv.Key, p, None))
|> List.concat
| None -> []

Expand All @@ -284,15 +283,22 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
match proj.FindTemplatesFile() with
| Some templateFileName when TemplateFile.IsProjectType templateFileName ->
match TemplateFile.Load(templateFileName, lockFile, None, Seq.empty |> Map.ofSeq).Contents with
| CompleteInfo(core, optional) ->
| CompleteInfo(_) ->
yield! getPackages proj
| ProjectInfo(core, optional) ->
| ProjectInfo(core, _) ->
let name =
match core.Id with
| Some name -> name
| None -> proj.GetAssemblyName().Replace(".dll","").Replace(".exe","")

yield None, { Name = PackageName name; Settings = InstallSettings.Default }

let versionConstraint =
match core.Version with
| Some v ->
let vr = if lockDependencies || pinProjectReferences then Specific v else Minimum v
VersionRequirement(vr, getPreReleaseStatus v)
| None -> VersionRequirement.AllReleases

yield None, { Name = PackageName name; Settings = InstallSettings.Default }, Some versionConstraint
| _ -> yield! getPackages proj

yield! getPackages project]
Expand All @@ -301,10 +307,10 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
let distinctRefs = allReferences |> List.distinct
let refs =
distinctRefs
|> List.filter (fun (group, settings: Paket.PackageInstallSettings) ->
|> List.filter (fun (group, settings: Paket.PackageInstallSettings, _) ->
let isDependencyOfAnyOtherDependency packageName =
distinctRefs
|> List.exists (fun (group, settings2) ->
|> List.exists (fun (group, settings2,_) ->
settings2.Name <> packageName &&
match group with
| Some groupName ->
Expand All @@ -321,14 +327,14 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
| Some group ->
group.Packages |> List.exists (fun p -> p.Name = settings.Name) ||
isDependencyOfAnyOtherDependency settings.Name |> not)
|> List.sortByDescending (fun (group, settings) -> settings.Name)
|> List.sortByDescending (fun (_, settings,_) -> settings.Name)

match refs with
| [] -> withDepsAndIncluded
| _ ->
let deps =
refs
|> List.filter (fun (group, np) ->
|> List.filter (fun (group, np, _) ->
match group with
| None -> true
| Some groupName ->
Expand All @@ -345,7 +351,8 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
not nuspec.IsDevelopmentDependency
with
| _ -> true)
|> List.map (fun (group, np) ->
|> List.map (fun (group, np, specificVersionRequirement) ->
let specificVersionRequirement = defaultArg specificVersionRequirement VersionRequirement.AllReleases
match group with
| None ->
match version with
Expand All @@ -361,18 +368,18 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
|> Option.map fst

match groupName with
| None -> np.Name,VersionRequirement.AllReleases
| None -> np.Name,specificVersionRequirement
| Some groupName ->
let group = lockFile.GetGroup groupName

let lockedVersion =
match Map.tryFind np.Name group.Resolution with
| Some resolvedPackage -> VersionRequirement(GreaterThan resolvedPackage.Version, getPreReleaseStatus resolvedPackage.Version)
| None -> VersionRequirement.AllReleases
| None -> specificVersionRequirement

np.Name,lockedVersion
else
np.Name,VersionRequirement.AllReleases
np.Name,specificVersionRequirement
| Some groupName ->
let dependencyVersionRequirement =
if not lockDependencies then
Expand Down Expand Up @@ -402,7 +409,7 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
Some(VersionRequirement(Specific resolvedPackage.Version,pre))
else
Some(VersionRequirement(VersionRange.Range(VersionRangeBound.Including,resolvedPackage.Version,v,VersionRangeBound.Including),pre))
| Range(lb,v,v2,ub) ->
| Range(_,_,v2,ub) ->
Some(VersionRequirement(VersionRange.Range(VersionRangeBound.Including,resolvedPackage.Version,v2,ub),pre))
| _ -> Some(VersionRequirement(Minimum resolvedPackage.Version,pre))
| None -> Some requirement.VersionRequirement
Expand Down Expand Up @@ -430,4 +437,6 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp
| Some installed -> installed
| None -> failwithf "No package with id '%O' installed in group %O." np.Name groupName
np.Name, dep)
deps |> List.fold addDependency withDepsAndIncluded

deps
|> List.fold addDependency withDepsAndIncluded

0 comments on commit 62f8f18

Please sign in to comment.