nitc :: ModelBuilder :: scan_group
When a group is scanned, its sub-groups hierarchy is filled (see MGroup::in_nesting
)
and the potential modules (and nested modules) are identified (see MGroup::modules
).
Basically, this recursively call identify_group
and identify_module
on each directory entry.
No-op if the group was already scanned (see MGroup::scanned
).
# Force the identification of all MModule of the group and sub-groups in the file system.
#
# When a group is scanned, its sub-groups hierarchy is filled (see `MGroup::in_nesting`)
# and the potential modules (and nested modules) are identified (see `MGroup::modules`).
#
# Basically, this recursively call `identify_group` and `identify_module` on each directory entry.
#
# No-op if the group was already scanned (see `MGroup::scanned`).
fun scan_group(mgroup: MGroup) do
if mgroup.scanned then return
mgroup.scanned = true
var p = mgroup.filepath
# a virtual group has nothing to scan
if p == null then return
var files = p.files
alpha_comparator.sort(files)
for f in files do
if f.first == '.' then continue
var fp = p/f
var g = identify_group(fp)
# Recursively scan for groups of the same package
if g == null then
identify_module(fp)
else if g.mpackage == mgroup.mpackage then
scan_group(g)
end
end
end
src/loader.nit:639,2--666,4