<include> now has attribute 'base' which allows to specify subdirectory of another...
[reactos.git] / reactos / tools / rbuild / include.cpp
1 #include "pch.h"
2 #include <assert.h>
3
4 #include "rbuild.h"
5
6 using std::string;
7 using std::vector;
8
9 Include::Include ( const Project& project_,
10 const XMLElement& includeNode )
11 : project(project_),
12 module(NULL),
13 node(includeNode),
14 base(NULL)
15 {
16 Initialize();
17 }
18
19 Include::Include ( const Project& project_,
20 const Module* module_,
21 const XMLElement& includeNode )
22 : project(project_),
23 module(module_),
24 node(includeNode),
25 base(NULL)
26 {
27 Initialize();
28 }
29
30 Include::~Include ()
31 {
32 }
33
34 void
35 Include::Initialize()
36 {
37 }
38
39 void
40 Include::ProcessXML()
41 {
42 const XMLAttribute* att;
43 att = node.GetAttribute("base",false);
44 if ( att )
45 {
46 if ( !module )
47 throw InvalidBuildFileException (
48 node.location,
49 "'base' attribute illegal from global <include>" );
50 base = project.LocateModule ( att->value );
51 if ( !base )
52 throw InvalidBuildFileException (
53 node.location,
54 "<include> attribute 'base' references non-existant module '%s'",
55 att->value.c_str() );
56 directory = FixSeparator ( base->GetBasePath() + "/" + node.value );
57 }
58 else
59 directory = FixSeparator ( node.value );
60 }