[RTL]
[reactos.git] / reactos / tools / sysgen / SysGen.BuildEngine / Tasks / RBuild / PCHTask.cs
1 using System;
2
3 using SysGen.BuildEngine.Attributes;
4 using SysGen.RBuild.Framework;
5
6 namespace SysGen.BuildEngine.Tasks
7 {
8 /// <summary>
9 /// PreCompiled Header task
10 /// </summary>
11 [TaskName("pch")]
12 public class PCHTask : FileTask
13 {
14 /// <summary>
15 /// Creates a new instance of the <see cref="PCHTask"/> class.
16 /// </summary>
17 public PCHTask()
18 {
19 }
20
21 protected override void CreateFileSystemObject()
22 {
23 m_FileSystemInfo = new RBuildSourceFile();
24 }
25
26 public RBuildSourceFile SourceFile
27 {
28 get { return m_FileSystemInfo as RBuildSourceFile; }
29 }
30
31 protected override void ExecuteTask()
32 {
33 if (Module.PreCompiledHeader != null)
34 throw new BuildException("Only one <pch ../> is allowed per module", Location);
35
36 //Call the base class
37 base.ExecuteTask();
38
39 //Add the folder where the PCH is present as a include folder
40 Module.IncludeFolders.Add(new RBuildFolder(PathRoot.Intermediate, Base));
41 }
42 }
43 }