-
Notifications
You must be signed in to change notification settings - Fork 0
/
CCompilerTask.cs
42 lines (37 loc) · 1.1 KB
/
CCompilerTask.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.IO;
using cake.Tests;
namespace cake
{
public class CCompilerTask
{
private readonly string _targetFile;
private readonly string _sourceFile;
private readonly string[] _includePaths;
public CCompilerTask(string targetFile, string sourceFile, string[] includePaths)
{
_targetFile = targetFile;
_sourceFile = sourceFile;
_includePaths = includePaths;
}
public IEnumerable<string> GetInputFiles(DependencyGraph depGraph)
{
var scanner = new RecursiveIncludeScanner(_includePaths, depGraph.IsTargetRegistered,new IncludeScanner().Scan);
yield return _sourceFile;
foreach (var file in scanner.GetFilesIncludedBy(_sourceFile))
yield return file;
}
public void RegisterWithDepGraph(DependencyGraph depGraph)
{
var action = new SimpleAction(Execute, "todo");
var settings = new TargetGenerateSettings(action, GetInputFiles(depGraph), _targetFile);
depGraph.RegisterTarget(settings);
}
public void Execute(TargetGenerateSettings settings)
{
//todo
File.Copy(_sourceFile, _targetFile, true);
}
}
}