private import more_collections
import poset
import mdoc
+import graph::digraph
# A Nit package, that encompass a product
class MPackage
init
do
model.mpackages.add(self)
+ # Add `self` to the importation graph
+ model.mpackage_importation_graph.add_vertex(self)
model.mpackage_by_name.add_one(name, self)
end
if path == null then return false
return not path.has_suffix(".nit")
end
+
+ # The path to `self` ini file
+ fun ini_path: nullable String do
+ var path = package_path
+ if path == null then return null
+ if is_expanded then return path / "package.ini"
+ return path.dirname / "{name}.ini"
+ end
+
+ # Does `self` have a ini file?
+ fun has_ini: Bool do
+ var ini_path = self.ini_path
+ if ini_path == null then return false
+ return ini_path.file_exists
+ end
+
+ # The path to `self` README.md
+ fun readme_path: nullable String do
+ var path = package_path
+ if path == null then return null
+ if not is_expanded then return null
+ return path / "README.md"
+ end
+
+ # Does `self` have a README.md file?
+ fun has_readme: Bool do
+ var readme_path = self.readme_path
+ if readme_path == null then return false
+ return readme_path.file_exists
+ end
end
# A group of modules in a package
end
redef class Model
+
+ # Full package importation graph
+ # Each package is in relation with itself
+ var mpackage_importation_graph = new HashDigraph[MPackage]
+
# packages of the model
var mpackages = new Array[MPackage]