1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // ARGUMENTS
3
+ ///////////////////////////////////////////////////////////////////////////////
4
+
5
+ var target = Argument ( "target" , "Default" ) ;
6
+ var configuration = Argument ( "configuration" , "Release" ) ;
7
+
8
+ ///////////////////////////////////////////////////////////////////////////////
9
+ // SETUP / TEARDOWN
10
+ ///////////////////////////////////////////////////////////////////////////////
11
+
12
+ Setup ( ctx =>
13
+ {
14
+ // Executed BEFORE the first task.
15
+ Information ( "Running tasks..." ) ;
16
+ } ) ;
17
+
18
+ Teardown ( ctx =>
19
+ {
20
+ // Executed AFTER the last task.
21
+ Information ( "Finished running tasks." ) ;
22
+ } ) ;
23
+
24
+ ///////////////////////////////////////////////////////////////////////////////
25
+ // TASKS
26
+ ///////////////////////////////////////////////////////////////////////////////
27
+
28
+ Task ( "Build" )
29
+ . Does ( ( ) => {
30
+
31
+ if ( ! IsRunningOnWindows ( ) )
32
+ throw new NotImplementedException ( "TODO Implement other platforms" ) ;
33
+
34
+ // TODO update this when there's a 64-bit solution
35
+
36
+ var settings = new MSBuildSettings ( ) ;
37
+ settings . SetConfiguration ( "Release" ) ;
38
+ settings . SetPlatformTarget ( PlatformTarget . x86 ) ;
39
+ MSBuild ( "../vs2017/CppSharp.sln" , settings ) ;
40
+
41
+ } ) ;
42
+
43
+ Task ( "Package" )
44
+ . Does ( ( ) => {
45
+
46
+ var scratchDir = new DirectoryPath ( "temp" ) ;
47
+
48
+ // clear previous session
49
+ if ( DirectoryExists ( scratchDir ) )
50
+ DeleteDirectory ( scratchDir , true ) ;
51
+
52
+ var files = new Dictionary < string , string > ( )
53
+ {
54
+ { "CppSharp.dll" , "lib" } ,
55
+ { "CppSharp.AST.dll" , "lib" } ,
56
+ { "CppSharp.Generator.dll" , "lib" } ,
57
+ { "CppSharp.Parser.dll" , "lib" } ,
58
+ { "CppSharp.Parser.CLI.dll" , "lib" } ,
59
+ { "CppSharp.Runtime.dll" , "lib" } ,
60
+
61
+ { "CppSharp.CLI.exe" , "tools" } ,
62
+
63
+ { "CppSharp.CppParser.dll" , "output" } ,
64
+ { "clang" , "output/lib/clang" } ,
65
+ } ;
66
+
67
+ var path = new DirectoryPath ( "../vs2017/lib/Release_x86/" ) ;
68
+
69
+ CreateDirectory ( scratchDir ) ;
70
+
71
+ foreach ( var file in files )
72
+ {
73
+ var tgt = scratchDir . Combine ( file . Value ) ;
74
+ CreateDirectory ( tgt ) ;
75
+
76
+ var isDirPath = path . Combine ( file . Key ) ;
77
+ var isDir = DirectoryExists ( isDirPath ) ;
78
+ if ( isDir )
79
+ {
80
+ var src = path . Combine ( file . Key ) ;
81
+ CopyDirectory ( src , tgt ) ;
82
+ }
83
+ else
84
+ {
85
+ var src = path . CombineWithFilePath ( file . Key ) ;
86
+ CopyFileToDirectory ( src , tgt ) ;
87
+ }
88
+ }
89
+
90
+ var nuspec = "cppsharp.nuspec" ;
91
+
92
+ var settings = new NuGetPackSettings ( )
93
+ {
94
+ OutputDirectory = "." ,
95
+ BasePath = scratchDir ,
96
+ NoPackageAnalysis = false ,
97
+ } ;
98
+
99
+ NuGetPack ( nuspec , settings ) ;
100
+
101
+ // clear current session
102
+ DeleteDirectory ( scratchDir , true ) ;
103
+ } ) ;
104
+
105
+ Task ( "CppSharpBuildAndPackage" )
106
+ . IsDependentOn ( "Build" )
107
+ . IsDependentOn ( "Package" )
108
+ . Does ( ( ) => {
109
+
110
+ } ) ;
111
+
112
+ Task ( "CppSharpPackageOnly" )
113
+ . IsDependentOn ( "Package" )
114
+ . Does ( ( ) => {
115
+
116
+ } ) ;
117
+
118
+ Task ( "Default" )
119
+ . IsDependentOn ( "CppSharpPackageOnly" )
120
+ . Does ( ( ) => {
121
+
122
+ } ) ;
123
+
124
+
125
+ RunTarget ( target ) ;
0 commit comments