loader: add MGroup::is_interesting
authorJean Privat <jean@pryen.org>
Thu, 4 Dec 2014 04:08:16 +0000 (23:08 -0500)
committerJean Privat <jean@pryen.org>
Sat, 6 Dec 2014 04:25:19 +0000 (23:25 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit

index 7a28ac0..9e29a1f 100644 (file)
@@ -553,6 +553,22 @@ end
 redef class MGroup
        # modules paths associated with the group
        private var module_paths = new Array[ModulePath]
+
+       # Is the group interesting for a final user?
+       #
+       # groups are mandatory in the model but for simple projects they are not
+       # always interesting.
+       #
+       # A interesting group has, at least, one of the following true:
+       #
+       # * it has 2 modules or more
+       # * it has a subgroup
+       # * it has a documentation
+       fun is_interesting: Bool
+       do
+               return module_paths.length > 1 or mmodules.length > 1 or not in_nesting.direct_smallers.is_empty or mdoc != null
+       end
+
 end
 
 redef class AStdImport