Commit e6518ebe authored by Mart Lubbers's avatar Mart Lubbers

Search hierarchically for imported object files

Previously an imported object file:
```
implementation module test.test

import code from "obj.o"
```

Would only search in the roots of the project paths. Now it will als
search in the test/ folder in the root.
parent 790de761
Pipeline #20910 passed with stage
in 58 seconds
...@@ -833,18 +833,18 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj ...@@ -833,18 +833,18 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
// runtime objects and dynamic libs // runtime objects and dynamic libs
# stdl = Concat sys_libs (standardStaticLibraries tp lo.method) # stdl = Concat sys_libs (standardStaticLibraries tp lo.method)
# stdo = Concat sys_objs (standardObjectFiles ao.stack_traces ao.profiling tp use_64_bit_processor) # stdo = Concat sys_objs (standardObjectFiles ao.stack_traces ao.profiling tp use_64_bit_processor)
# (stdoOk,ofiles,abcPathsCache) # ((stdoOk,ofiles,abcPathsCache), ps)
= case ao.standard_rte of = case ao.standard_rte of
True -> GetPathNames stdo Nil abcPathsCache True -> accFiles (AccTuple4 (GetPathNames (Map (\x->("", x)) stdo) Nil srcpaths abcPathsCache)) ps
False -> (True,Nil,abcPathsCache) False -> ((True,Nil,abcPathsCache), ps)
| not stdoOk | not stdoOk
# line = Level3 ["Link error: File: '" +++ (Head ofiles) +++ "' not found."] # line = Level3 ["Link error: File: '" +++ (Head ofiles) +++ "' not found."]
# ps = showInfo line ps # ps = showInfo line ps
= continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps) = continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps)
# (stdlOk,lfiles,abcPathsCache) # ((stdlOk,lfiles,abcPathsCache), ps)
= case ao.standard_rte of = case ao.standard_rte of
True -> GetPathNames stdl Nil abcPathsCache True -> accFiles (AccTuple4 (GetPathNames (Map (\x->("", x)) stdl) Nil srcpaths abcPathsCache)) ps
False -> (True,Nil,abcPathsCache) False -> ((True,Nil,abcPathsCache), ps)
| not stdlOk | not stdlOk
# line = Level3 ["Link error: File: '" +++ (Head lfiles) +++ "' not found."] # line = Level3 ["Link error: File: '" +++ (Head lfiles) +++ "' not found."]
# ps = showInfo line ps # ps = showInfo line ps
...@@ -868,13 +868,14 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj ...@@ -868,13 +868,14 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
# ofiles = Reverse2 clmodpaths ofiles # ofiles = Reverse2 clmodpaths ofiles
// module imported objects and dynamic libs // module imported objects and dynamic libs
# abcLinkInfo = PR_GetABCLinkInfo project # (objs, libs) = PR_GetABCLinkInfo project
# linkObjFileNames = Map (append_object_file_extension_if_dot_at_end tp use_64_bit_processor) abcLinkInfo.linkObjFileNames # linkObjFileNames = Map (\(d, a)->(d, append_object_file_extension_if_dot_at_end tp use_64_bit_processor a)) objs
# (objPathsOk,ofiles,abcPathsCache) # ((objPathsOk,ofiles,abcPathsCache), ps)
= GetPathNames linkObjFileNames ofiles abcPathsCache = accFiles (AccTuple4 (GetPathNames linkObjFileNames ofiles srcpaths abcPathsCache)) ps
# (_,ofiles`,abcPathsCache) = GetPathNames /*abcLinkInfo.*/linkObjFileNames ofiles` abcPathsCache # ((_,ofiles`,abcPathsCache), ps)
# (libPathsOk,lfiles,abcPathsCache) = accFiles (AccTuple4 (GetPathNames /*abcLinkInfo.*/linkObjFileNames ofiles` srcpaths abcPathsCache)) ps
= GetPathNames abcLinkInfo.linkLibraryNames lfiles abcPathsCache # ((libPathsOk,lfiles,abcPathsCache), ps)
= accFiles (AccTuple4 (GetPathNames libs lfiles srcpaths abcPathsCache)) ps
| not objPathsOk | not objPathsOk
# line = Level3 ["Link error: File: '" +++ (Head ofiles) +++ "' not found."] # line = Level3 ["Link error: File: '" +++ (Head ofiles) +++ "' not found."]
# ps = showInfo line ps # ps = showInfo line ps
...@@ -1597,15 +1598,23 @@ CheckExecOutOfDate gen execpath fileinfo project ps ...@@ -1597,15 +1598,23 @@ CheckExecOutOfDate gen execpath fileinfo project ps
= (False,ps) = (False,ps)
//-- dircache functions //-- dircache functions
GetPathNames :: !(List (String, String)) !(List String) !(List String) !*DirCache !*Files -> (.Bool,List String,!*DirCache, !*Files)
GetPathNames :: !(List String) !(List String) !*DirCache -> (.Bool,List String,!*DirCache) GetPathNames Nil acc srcpaths cache files
GetPathNames Nil acc cache = (True, acc, cache, files)
= (True, acc, cache) GetPathNames ((mod, fn):!fns) acc srcpaths cache files
GetPathNames (fn:!fns) acc cache
# (ok,pn,_,cache) = DC_Search fn cache # (ok,pn,_,cache) = DC_Search fn cache
| ok | ok
= GetPathNames fns (pn +++ DirSeparatorString +++ fn :! acc) cache = GetPathNames fns (pn +++ DirSeparatorString +++ fn :! acc) srcpaths cache files
= (False, (fn :! Nil), cache) # ((ok, pn), files) = FindHModule (dropLastComponent mod (size mod - 2)) ("/Clean System Files/" +++ fn) srcpaths files
| ok
= GetPathNames fns (pn :! acc) srcpaths cache files
= (False, (fn :! Nil), cache, files)
where
dropLastComponent :: !String !Int -> !String
dropLastComponent s 0 = s
dropLastComponent s i
| s.[i] == '.' = s % (0, i-1)
= dropLastComponent s (i - 1)
// Lookup Module Paths in Directory Cache // Lookup Module Paths in Directory Cache
LookupModulePaths :: !(List .String) !*DirCache !*Files -> (Bool,.[!ModuleDirAndName],*DirCache,!*Files); LookupModulePaths :: !(List .String) !*DirCache !*Files -> (Bool,.[!ModuleDirAndName],*DirCache,!*Files);
......
...@@ -96,7 +96,8 @@ PR_GetLinkOptions :: !Project -> LinkOptions ...@@ -96,7 +96,8 @@ PR_GetLinkOptions :: !Project -> LinkOptions
PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !Project -> Project PR_AddABCInfo :: !ModuleDirAndName !(List LinkObjFileName) !(List LinkLibraryName) !CompilerOptions !Project -> Project
PR_GetABCLinkInfo :: !Project -> ABCLinkInfo // Retrieves the import object files and libraries together with their modules
PR_GetABCLinkInfo :: !Project -> (!(List (Modulename, LinkObjFileName)), !(List (Modulename, LinkLibraryName)))
PR_GetStaticLibsInfo :: !Project -> StaticLibInfo PR_GetStaticLibsInfo :: !Project -> StaticLibInfo
PR_SetStaticLibsInfo :: !StaticLibInfo !Project -> Project PR_SetStaticLibsInfo :: !StaticLibInfo !Project -> Project
......
...@@ -745,18 +745,14 @@ SubstitutePaths applicationDir projectDir list ...@@ -745,18 +745,14 @@ SubstitutePaths applicationDir projectDir list
SubstitutePath applicationDir projectDir path SubstitutePath applicationDir projectDir path
:== symPath applicationDir projectDir path :== symPath applicationDir projectDir path
PR_GetABCLinkInfo :: !Project -> ABCLinkInfo; PR_GetABCLinkInfo :: !Project -> (!(List (Modulename, LinkObjFileName)), !(List (Modulename, LinkLibraryName)))
PR_GetABCLinkInfo project=:{inflist} PR_GetABCLinkInfo project=:{inflist}
# allLinkInfoRecords = map (\{InfListItem | info={abcLinkInfo}} -> abcLinkInfo) (StrictListToList inflist); # allLinkInfoRecords = map toRecord (StrictListToList inflist);
oneLinkInfoRecord = foldl mergeTwoRecords emptyRecord allLinkInfoRecords; = foldl mergeTwoRecords emptyRecord allLinkInfoRecords;
= oneLinkInfoRecord;
where where
mergeTwoRecords { linkObjFileNames=linkObjFileNames1, linkLibraryNames=linkLibraryNames1} toRecord {InfListItem | mn,info={abcLinkInfo}} = (Map (\x->(mn, x)) abcLinkInfo.linkObjFileNames ,Map (\x->(mn, x)) abcLinkInfo.linkLibraryNames)
{ linkObjFileNames=linkObjFileNames2, linkLibraryNames=linkLibraryNames2} mergeTwoRecords (objs, libs) (cobjs, clibs) = (UnionList objs cobjs, UnionList libs clibs)
= { linkObjFileNames = UnionStringList linkObjFileNames2 linkObjFileNames1, emptyRecord = (Nil, Nil);
linkLibraryNames = UnionStringList linkLibraryNames2 linkLibraryNames1};
emptyRecord
= { linkObjFileNames = Nil, linkLibraryNames = Nil};
PR_GetStaticLibsInfo :: !Project -> StaticLibInfo PR_GetStaticLibsInfo :: !Project -> StaticLibInfo
PR_GetStaticLibsInfo {Project | staticLibInfo} = staticLibInfo PR_GetStaticLibsInfo {Project | staticLibInfo} = staticLibInfo
......
...@@ -35,6 +35,7 @@ RemoveStringFromList :: !String !(List String) -> List String ...@@ -35,6 +35,7 @@ RemoveStringFromList :: !String !(List String) -> List String
RemoveMember :: a !u:(List a) -> v:List a | == a, [u <= v] RemoveMember :: a !u:(List a) -> v:List a | == a, [u <= v]
RemoveMembers :: !u:(List a) !.(List a) -> v:List a | == a, [u <= v] RemoveMembers :: !u:(List a) !.(List a) -> v:List a | == a, [u <= v]
UnionStringList :: !(List String) !(List String) -> List String UnionStringList :: !(List String) !(List String) -> List String
UnionList :: !(List a) !(List a) -> List a | Ord a
StringOccurs :: !String !.(List String) -> Bool StringOccurs :: !String !.(List String) -> Bool
SortStrings :: !.(List String) -> .List String SortStrings :: !.(List String) -> .List String
EQStrings :: !(List String) !(List String) -> Bool EQStrings :: !(List String) !(List String) -> Bool
......
...@@ -131,6 +131,14 @@ UnionStringList xl=:(x:!xs) yl=:(y:!ys) ...@@ -131,6 +131,14 @@ UnionStringList xl=:(x:!xs) yl=:(y:!ys)
| x > y = y :! UnionStringList xl ys; | x > y = y :! UnionStringList xl ys;
= x :! UnionStringList xs ys; = x :! UnionStringList xs ys;
UnionList :: !(List a) !( List a) -> (List a) | Ord a;
UnionList Nil ys = ys;
UnionList xs Nil = xs;
UnionList xl=:(x:!xs) yl=:(y:!ys)
| x < y = x :! UnionList xs yl;
| x > y = y :! UnionList xl ys;
= x :! UnionList xs ys;
StringOccurs :: !String !.(List String) -> Bool; StringOccurs :: !String !.(List String) -> Bool;
StringOccurs s Nil = False; StringOccurs s Nil = False;
StringOccurs s (x:!xs) | x == s = True; StringOccurs s (x:!xs) | x == s = True;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment