Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1. use absolute paths when storage:none is specified
2. make sure the RootPath is properly evaluated.
  • Loading branch information
matthid committed Feb 25, 2018
1 parent f654969 commit 7b4a946
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/Paket.Core/Installation/ScriptGeneration.fs
Expand Up @@ -101,6 +101,7 @@ module ScriptGeneration =
type ScriptContent = {
Lang : ScriptType
Input : ReferenceType seq
UseRelativePath : bool
PartialPath : string
} with
/// use the provided directory to compute the relative paths for the script's contents
Expand All @@ -110,8 +111,10 @@ module ScriptGeneration =

// create a relative pathReferenceType directory of the script to the dll or script to load
let relativePath (scriptFile: FileInfo) (libFile: FileInfo) =
(Uri scriptFile.FullName).MakeRelativeUri(Uri libFile.FullName).ToString()

if self.UseRelativePath then
(Uri scriptFile.FullName).MakeRelativeUri(Uri libFile.FullName).ToString()
else libFile.FullName

// create the approiate load string for the target resource
let refString (reference:ReferenceType) =
match reference, self.Lang with
Expand Down Expand Up @@ -154,7 +157,7 @@ module ScriptGeneration =
Cache : DependencyCache
Groups : GroupName list
DefaultFramework : bool * FrameworkIdentifier
RootDir : DirectoryInfo
LoadScriptRootDir : DirectoryInfo
ScriptType : ScriptType
}

Expand All @@ -166,7 +169,7 @@ module ScriptGeneration =
let scriptType, groups, (isDefaultFramework, framework) = ctx.ScriptType, ctx.Groups, ctx.DefaultFramework

// -- LOAD SCRIPT FORMATTING POINT --
let loadScriptsRootFolder = Constants.PaketFolderName </> "load"
let loadScriptsRootFolder = ctx.LoadScriptRootDir

// -- LOAD SCRIPT FORMATTING POINT --
/// Create the path for a script that will load all of the packages in the provided Group
Expand Down Expand Up @@ -222,7 +225,7 @@ module ScriptGeneration =

let scriptInfo = {
PackageName = package.Name
IncludeScriptsRootFolder = DirectoryInfo loadScriptsRootFolder
IncludeScriptsRootFolder = loadScriptsRootFolder
FrameworkReferences = frameworkRefs
OrderedDllReferences = dllFiles
DependentScripts = dependencies
Expand All @@ -233,10 +236,12 @@ module ScriptGeneration =
(knownIncludeScripts,scriptFiles)
| Generate pieces ->
let knownScripts = knownIncludeScripts |> Map.add package.Name scriptFile
let storageConf = defaultArg package.Settings.StorageConfig PackagesFolderGroupConfig.Default
let rendered =
{ PartialPath = scriptFile
Lang = scriptType
Input = pieces
Input = pieces
UseRelativePath = storageConf = PackagesFolderGroupConfig.DefaultPackagesFolder
}
(knownScripts, rendered::scriptFiles))
|> fun (_,sfs) -> groupName, sfs
Expand All @@ -247,19 +252,20 @@ module ScriptGeneration =
ctx.Groups
|> List.map (fun group ->
let scriptFile = getGroupFile group
let storageConf = defaultArg ctx.Cache.LockFile.Groups.[group].Options.Settings.StorageConfig PackagesFolderGroupConfig.Default
let pieces =
ctx.Cache.GetOrderedReferences group framework
|> filterReferences ctx.ScriptType

let scriptContent : ScriptContent =
{ PartialPath = scriptFile
Lang = ctx.ScriptType
Input = pieces }
Input = pieces
UseRelativePath = storageConf = PackagesFolderGroupConfig.DefaultPackagesFolder }

group,[scriptContent]
)
List.append scriptContent groupScriptContent


let constructScriptsFromData (depCache:DependencyCache) (groups:GroupName list) providedFrameworks providedScriptTypes =
let lockFile = depCache.LockFile
Expand Down Expand Up @@ -326,7 +332,7 @@ module ScriptGeneration =
let content = generateScriptContent {
Cache = depCache
ScriptType = scriptType
RootDir = DirectoryInfo lockFile.RootPath
LoadScriptRootDir = DirectoryInfo (lockFile.RootPath </> Constants.PaketFolderName </> "load")
Groups = groups
DefaultFramework = isDefaultFramework,framework
}
Expand Down

0 comments on commit 7b4a946

Please sign in to comment.