-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathPythonNetStubTask.cs
More file actions
42 lines (35 loc) · 1.16 KB
/
Copy pathPythonNetStubTask.cs
File metadata and controls
42 lines (35 loc) · 1.16 KB
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 Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using PythonNetStubGenerator;
using System;
using System.IO;
using System.Linq;
namespace PythonNetStubTask
{
public class PythonNetStubTask : Task
{
[Required]
public string DestPath { get; set; }
[Required]
public string[] SourceDlls { get; set; }
public string[] AdditionalSearchPaths { get; set; }
public override bool Execute()
{
var destPath = new DirectoryInfo(DestPath);
var sourceDlls = SourceDlls.Select(it => new FileInfo(it)).ToArray();
var directoryPaths = AdditionalSearchPaths?.Select(it => new DirectoryInfo(it)).ToArray();
try
{
Log.LogMessage(MessageImportance.High, "Generating Stubs for " + destPath.FullName);
StubBuilder.BuildAssemblyStubs(destPath, sourceDlls, directoryPaths);
Log.LogMessage(MessageImportance.High, "Done");
}
catch (Exception e)
{
Log.LogError(e.Message);
return false;
}
return true;
}
}
}