Skip to content

Commit

Permalink
Remove dnxcore50 moniker from lock file - fixes #2810
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Oct 2, 2017
1 parent 8a7070f commit b68311b
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 23 deletions.
1 change: 0 additions & 1 deletion src/Paket.Core/Dependencies/DependenciesFileParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ module DependenciesFileParser =
match VersionRange.BasicOperators |> List.tryFind(text.StartsWith) with
| Some token -> token, text.Replace(token + " ", "").Split ' ' |> Array.toList
| None -> "=", text.Split ' ' |> Array.toList


match splitVersion text with
| "==", version :: rest ->
Expand Down
15 changes: 10 additions & 5 deletions src/Paket.Core/Dependencies/NuGetCache.fs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type NuGetRequestGetVersions =
}


// An unparsed file in the nuget package -> still need to inspect the path for further information. After parsing an entry will be part of a "LibFolder" for example.
// An unparsed file in the NuGet package -> still need to inspect the path for further information. After parsing an entry will be part of a "LibFolder" for example.
type UnparsedPackageFile =
{ FullPath : string
PathWithinPackage : string }
Expand Down Expand Up @@ -128,16 +128,18 @@ type NuGetPackageCache =
let restrictionString =
match restrictions with
| FrameworkRestrictions.AutoDetectFramework -> "AUTO"
| FrameworkRestrictions.ExplicitRestriction re ->
re.ToString()
| FrameworkRestrictions.ExplicitRestriction re -> re.ToString()
n, v, restrictionString) }

static member getDependencies (x:NuGetPackageCache) : (PackageName * VersionRequirement * FrameworkRestrictions) list =
x.SerializedDependencies
|> List.map (fun (n,v,restrictionString) ->
let restrictions =
if restrictionString = "AUTO" then
FrameworkRestrictions.AutoDetectFramework
else FrameworkRestrictions.ExplicitRestriction(Requirements.parseRestrictions restrictionString |> fst)
else
let restrictions = Requirements.parseRestrictions restrictionString |> fst
FrameworkRestrictions.ExplicitRestriction restrictions
n, v, restrictions)

let inline normalizeUrl(url:string) = url.Replace("https://","http://").Replace("www.","")
Expand All @@ -159,6 +161,7 @@ let getCacheFiles cacheVersion nugetURL (packageName:PackageName) (version:SemVe
type ODataSearchResult =
| EmptyResult
| Match of NuGetPackageCache

module ODataSearchResult =
let get x =
match x with
Expand All @@ -176,7 +179,8 @@ let tryGetDetailsFromCache force nugetURL (packageName:PackageName) (version:Sem
if (PackageName cachedObject.PackageName <> packageName) ||
(cachedObject.Version <> version.Normalize())
then
traceVerbose (sprintf "Invalidating Cache '%s:%s' <> '%s:%s'" cachedObject.PackageName cachedObject.Version packageName.Name (version.Normalize()))
if verbose then
traceVerbose (sprintf "Invalidating Cache '%s:%s' <> '%s:%s'" cachedObject.PackageName cachedObject.Version packageName.Name (version.Normalize()))
cacheFile.Delete()
None
else
Expand Down Expand Up @@ -292,6 +296,7 @@ let rec private cleanup (dir : DirectoryInfo) =

let GetTargetUserFolder packageName (version:SemVerInfo) =
DirectoryInfo(Path.Combine(Constants.UserNuGetPackagesFolder,packageName.ToString(),version.Normalize())).FullName

let GetTargetUserNupkg packageName (version:SemVerInfo) =
let normalizedNupkgName = GetPackageFileName packageName version
let path = GetTargetUserFolder packageName version
Expand Down
3 changes: 2 additions & 1 deletion src/Paket.Core/Dependencies/NuGetV2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ let private handleODataEntry nugetURL packageName version entry =
(if a.Length > 2 && a.[2] <> "" then
let restriction = a.[2]
match PlatformMatching.extractPlatforms false restriction with
| Some p -> Some p
| Some p ->
Some { p with Platforms = p.Platforms |> List.filter KnownTargetProfiles.isSupportedProfile }
| None ->
Logging.traceWarnIfNotBefore ("Package", restriction, packageName, version) "Could not detect any platforms from '%s' in package %O %O, please tell the package authors" restriction packageName version
None
Expand Down
9 changes: 5 additions & 4 deletions src/Paket.Core/Dependencies/Nuspec.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ module internal NuSpecParserHelper =
| Some name, Some targetFrameworks ->
targetFrameworks.Split([|','; ' '|],System.StringSplitOptions.RemoveEmptyEntries)
|> Array.choose FrameworkDetection.Extract
|> Array.map (fun fw -> { AssemblyName = name; FrameworkRestrictions = ExplicitRestriction (FrameworkRestriction.Exactly fw) })
|> Array.map (fun fw ->
{ AssemblyName = name
FrameworkRestrictions = ExplicitRestriction (FrameworkRestriction.Exactly fw) })
|> Array.toList
| _ -> []

Expand Down Expand Up @@ -99,8 +101,7 @@ type Nuspec =

let dependencies =
lazy
let dependencies, warnings =
addFrameworkRestrictionsToDependencies rawDependencies frameworks
let dependencies, warnings = addFrameworkRestrictionsToDependencies rawDependencies frameworks
for warning in warnings do
Logging.traceWarnfn "%s" (warning.Format name version)
dependencies
Expand Down Expand Up @@ -134,7 +135,7 @@ type Nuspec =
FrameworkRestrictions =
ExplicitRestriction(
restrictions
|> List.map (fun x -> x.FrameworkRestrictions |> getExplicitRestriction)
|> List.map (fun x -> getExplicitRestriction x.FrameworkRestrictions)
|> List.fold FrameworkRestriction.combineRestrictionsWithOr FrameworkRestriction.EmptySet) } ] }

/// load the file from an nuspec text stream. The fileName is only used for error reporting.
Expand Down
10 changes: 9 additions & 1 deletion src/Paket.Core/Versioning/FrameworkHandling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1217,13 +1217,20 @@ module KnownTargetProfiles =
AllDotNetProfiles
|> Set.ofList

let isSupportedProfile profile =
match profile with
| FrameworkIdentifier.DNX _ -> false
| FrameworkIdentifier.DNXCore _ -> false
| _ -> true

let TryFindPortableProfile (name:string) =
let lowerName = name.ToLowerInvariant()
AllProfiles
|> Set.toSeq
|> Seq.tryPick (function
| TargetProfile.PortableProfile p when p.ProfileName.ToLowerInvariant() = lowerName -> Some (TargetProfile.PortableProfile p)
| _ -> None)

let FindPortableProfile name =
match TryFindPortableProfile name with
| Some s -> s
Expand Down Expand Up @@ -1269,7 +1276,7 @@ module SupportCalculation =
else
// try to optimize on the 'pos' position
let curPos = supported.[pos]
let supportList = buildSupportMap supportMap curPos // supportMap.[curPos] //
let supportList = buildSupportMap supportMap curPos
(supported |> List.take pos |> List.filter (fun s -> supportList |> List.contains s |> not))
@ [curPos] @
(supported
Expand All @@ -1291,6 +1298,7 @@ module SupportCalculation =
if old.Count <> sup.Count then
hasChanged <- true
sup

let private getSupportedPortables p =
getSupported p
|> List.choose (function TargetProfile.PortableProfile p -> Some p | _ -> failwithf "Expected portable")
Expand Down
6 changes: 5 additions & 1 deletion src/Paket.Core/Versioning/PlatformMatching.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ let inline split (path : string) =
// TODO: This function does now quite a lot, there probably should be several functions.
let private extractPlatformsPriv = memoize (fun path ->
let splits = split path
let platforms = splits |> Array.choose FrameworkDetection.Extract |> Array.toList
let platforms =
splits
|> Array.choose FrameworkDetection.Extract
|> Array.toList

if platforms.Length = 0 then
if splits.Length = 1 && splits.[0].StartsWith "profile" then
// might be something like portable4.6-profile151
Expand Down
20 changes: 12 additions & 8 deletions src/Paket.Core/Versioning/Requirements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ module FrameworkRestriction =
|> List.filter (fun literal ->
positiveSingles
|> List.exists (fun p -> literal.IsNegated && literal.LiteraL = p.LiteraL)
|> not
)
|> not)
if reworkedAnd.Length < andFormula.Literals.Length then
true, { Literals = reworkedAnd } :: reworkedOrFormulas
else
Expand Down Expand Up @@ -568,6 +567,7 @@ type FrameworkRestrictions =
match x with
| ExplicitRestriction r -> r.ToString()
| AutoDetectFramework -> "AutoDetect"

member x.GetExplicitRestriction () =
match x with
| ExplicitRestriction list -> list
Expand Down Expand Up @@ -598,6 +598,7 @@ type RestrictionParseProblem =
| RestrictionParseProblem.UnsupportedPortable _ -> false
| RestrictionParseProblem.ParseSecondOperator _
| RestrictionParseProblem.ParseFramework _ -> true

let parseRestrictionsLegacy failImmediatly (text:string) =
// older lockfiles to the new "restriction" semantics
let problems = ResizeArray<_>()
Expand Down Expand Up @@ -655,7 +656,7 @@ let private parseRestrictionsRaw skipSimplify (text:string) =

let rec parseOperator (text:string) =
match text.Trim() with
| t when String.IsNullOrEmpty t -> failwithf "trying to parse an otherator but got no content"
| t when String.IsNullOrEmpty t -> failwithf "trying to parse an operator but got no content"
| h when h.StartsWith ">=" || h.StartsWith "==" || h.StartsWith "<" ->
// parse >=
let smallerThan = h.StartsWith "<"
Expand Down Expand Up @@ -714,7 +715,7 @@ let private parseRestrictionsRaw skipSimplify (text:string) =
| { OrFormulas = [ {Literals = [ lit] } ] } ->
[ {Literals = [ { lit with IsNegated = not lit.IsNegated } ] } ]
|> FrameworkRestriction.FromOrList
| _ -> failwithf "a general NOT is not implemted jet (and shouldn't be emitted for now)"
| _ -> failwithf "a general NOT is not implemented (and shouldn't be emitted for now)"
negated, next
else
failwithf "Expected operand after NOT, '%s'" text
Expand All @@ -730,8 +731,7 @@ let private parseRestrictionsRaw skipSimplify (text:string) =
let result, next = parseOperator text
if String.IsNullOrEmpty next |> not then
failwithf "Successfully parsed '%O' but got additional text '%s'" result next
result,
problems.ToArray()
result, problems.ToArray()

let parseRestrictions = memoize (parseRestrictionsRaw false)
let internal parseRestrictionsSimplified = parseRestrictionsRaw true
Expand Down Expand Up @@ -1107,6 +1107,10 @@ let addFrameworkRestrictionsToDependencies rawDependencies (frameworkGroups:Pars
if prof.IsSome && prof.Value.IsUnsupportedPortable then
handleProblem <| UnknownPortableProfile prof.Value
prof)
|> Seq.filter (fun frameworkGroup ->
match frameworkGroup with
| TargetProfile.SinglePlatform sp -> KnownTargetProfiles.isSupportedProfile sp
| _ -> true)
// TODO: Check if this is needed (I think the logic below is a general version of this subset logic)
|> Seq.filter (fun frameworkGroup ->
// filter all restrictions which would render this group to nothing (ie smaller restrictions)
Expand All @@ -1123,8 +1127,8 @@ let addFrameworkRestrictionsToDependencies rawDependencies (frameworkGroups:Pars

let missing = FrameworkRestriction.combineRestrictionsWithAnd curRestr (FrameworkRestriction.AtLeastPlatform frameworkGroup)
let combined = lazy FrameworkRestriction.combineRestrictionsWithAnd curRestr (FrameworkRestriction.NotAtLeastPlatform frameworkGroup)
match packageGroup.Platforms, missing.RepresentedFrameworks.IsEmpty with
| [ packageGroupFw ], false ->
match packageGroup.Platforms with
| [ packageGroupFw ] when not missing.RepresentedFrameworks.IsEmpty ->
// the common set goes to the better matching one
match PlatformMatching.findBestMatch (frameworkGroups, missing.RepresentedFrameworks.MinimumElement) with
| Some { PlatformMatching.ParsedPlatformPath.Platforms = [ cfw ] } when cfw = packageGroupFw -> curRestr
Expand Down
4 changes: 2 additions & 2 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
<StartAction>Project</StartAction>
<StartArguments>install</StartArguments>
<StartWorkingDirectory>C:\temp\Gu.Reactive</StartWorkingDirectory>
<StartArguments>update</StartArguments>
<StartArguments>update -f</StartArguments>
<StartWorkingDirectory>C:\proj\Paket</StartWorkingDirectory>
<StartWorkingDirectory>D:\temp\androidTest</StartWorkingDirectory>
<StartWorkingDirectory>D:\code\fable-suave-scaffold</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
Expand Down

0 comments on commit b68311b

Please sign in to comment.