@@ -7,6 +7,19 @@ bool runcpp2::Data::DependencySource::ParseYAML_Node(ryml::ConstNodeRef& node)
77{
88 INTERNAL_RUNCPP2_SAFE_START ();
99
10+ if (ExistAndHasChild (node, " ImportPath" ))
11+ {
12+ std::string importPathStr;
13+ node[" ImportPath" ] >> importPathStr;
14+ ImportPath = importPathStr;
15+
16+ if (ImportPath.is_absolute ())
17+ {
18+ ssLOG_ERROR (" DependencySource: ImportPath must be relative: " << ImportPath.string ());
19+ return false ;
20+ }
21+ }
22+
1023 if (ExistAndHasChild (node, " Git" ))
1124 {
1225 if (ExistAndHasChild (node, " Local" ))
@@ -37,6 +50,15 @@ bool runcpp2::Data::DependencySource::ParseYAML_Node(ryml::ConstNodeRef& node)
3750 Source = localSource;
3851 return true ;
3952 }
53+ // If no source is found, we need to check if it's an imported source.
54+ // If so, we assume it's a local source with path "./"
55+ else if (!ImportPath.empty ())
56+ {
57+ LocalSource localSource;
58+ localSource.Path = " ./" ;
59+ Source = localSource;
60+ return true ;
61+ }
4062
4163 ssLOG_ERROR (" DependencySource: Neither Git nor Local source found" );
4264 return false ;
@@ -46,23 +68,33 @@ bool runcpp2::Data::DependencySource::ParseYAML_Node(ryml::ConstNodeRef& node)
4668
4769std::string runcpp2::Data::DependencySource::ToString (std::string indentation) const
4870{
71+ std::string out;
72+ if (!ImportPath.empty ())
73+ out += indentation + " ImportPath: " + GetEscapedYAMLString (ImportPath.string ()) + " \n " ;
74+
4975 if (mpark::get_if<GitSource>(&Source))
5076 {
5177 const GitSource* git = mpark::get_if<GitSource>(&Source);
52- return git->ToString (indentation);
78+ out += git->ToString (indentation);
5379 }
5480 else if (mpark::get_if<LocalSource>(&Source))
5581 {
5682 const LocalSource* local = mpark::get_if<LocalSource>(&Source);
57- return local->ToString (indentation);
83+ out += local->ToString (indentation);
5884 }
59-
60- ssLOG_ERROR (" Invalid DependencySource type" );
61- return " " ;
85+ else
86+ {
87+ ssLOG_ERROR (" Invalid DependencySource type" );
88+ return " " ;
89+ }
90+ return out;
6291}
6392
6493bool runcpp2::Data::DependencySource::Equals (const DependencySource& other) const
6594{
95+ if (ImportPath != other.ImportPath )
96+ return false ;
97+
6698 if (mpark::get_if<GitSource>(&Source))
6799 {
68100 if (mpark::get_if<GitSource>(&other.Source ))
0 commit comments