@@ -40,32 +40,15 @@ function SetupManagedTestProject()
40
40
files { " *.lua" }
41
41
end
42
42
43
- function SetupTestGeneratorProject (name , depends )
44
- if not EnabledManagedProjects () then
45
- return
46
- end
47
- project (name .. " .Gen" )
48
- SetupManagedTestProject ()
49
- kind " ConsoleApp"
50
- enabledefaultnoneitems " false"
51
-
52
- files { name .. " .cs" }
53
- dependson { name .. " .Native" }
54
- links { " CppSharp.Generator.Tests" }
55
-
56
- if depends ~= nil then
57
- links { depends .. " .Gen" }
58
- end
59
-
60
- local command = os .ishost (" windows" ) and " type nul >" or " touch"
61
- postbuildcommands { command .. " " .. SafePath (path .join (objsdir , name .. " .Native" , " timestamp.cs" )) }
62
- postbuildcommands { command .. " " .. SafePath (path .join (objsdir , name .. " .Native" , " timestamp.cpp" )) }
43
+ function SetupExternalManagedTestProject (name )
44
+ externalproject (name )
45
+ SetupManagedTestProject ()
63
46
end
64
47
65
- function SetupTestGeneratorBuildEvent (name )
66
- local cmd = os . ishost ( " windows " ) and " " or " dotnet "
67
- local ext = os . ishost ( " windows " ) and " exe " or " dll "
68
- prebuildcommands { cmd .. SafePath ( path . join ( " %{cfg.buildtarget.directory} " , name .. " .Gen. " .. ext )) }
48
+ function SetupTestGeneratorProject (name , depends )
49
+ if EnabledManagedProjects () then
50
+ SetupExternalManagedTestProject ( name .. " .Gen " )
51
+ end
69
52
end
70
53
71
54
function SetupTestNativeProject (name , depends )
@@ -86,10 +69,6 @@ function SetupTestNativeProject(name, depends)
86
69
if depends ~= nil then
87
70
links { depends .. " .Native" }
88
71
end
89
-
90
- local command = os .ishost (" windows" ) and " type nul >" or " touch"
91
- postbuildcommands { command .. " " .. SafePath (path .join (objsdir , name .. " .Native" , " timestamp.cs" )) }
92
- postbuildcommands { command .. " " .. SafePath (path .join (objsdir , name .. " .Native" , " timestamp.cpp" )) }
93
72
end
94
73
95
74
function SetupTestProjectsCSharp (name , depends , extraFiles , suffix )
@@ -103,35 +82,9 @@ function SetupTestProjectsCSharp(name, depends, extraFiles, suffix)
103
82
nm = name
104
83
str = " Std"
105
84
end
106
- project (name .. " .CSharp" )
107
- SetupManagedTestProject ()
108
-
109
- dependson { name .. " .Gen" , name .. " .Native" , " CppSharp.Generator" }
110
- SetupTestGeneratorBuildEvent (name )
111
- enabledefaultnoneitems " false"
112
-
113
- files
114
- {
115
- path .join (gendir , name , nm .. " .cs" ),
116
- path .join (gendir , name , str .. " .cs" ),
117
- path .join (objsdir , name .. " .Native" , " timestamp.cs" )
118
- }
119
-
120
- links { " CppSharp.Runtime" }
121
-
122
- if depends ~= nil then
123
- links { depends .. " .CSharp" }
124
- end
125
-
126
- project (name .. " .Tests.CSharp" )
127
- SetupManagedTestProject ()
128
-
129
- enabledefaultnoneitems " false"
130
- files { name .. " .Tests.cs" }
131
-
132
- links { name .. " .CSharp" , " CppSharp.Generator.Tests" , " CppSharp.Runtime" }
133
- nuget { " Microsoft.NET.Test.Sdk:16.8.0" }
134
- dependson { name .. " .Native" }
85
+
86
+ SetupExternalManagedTestProject (name .. " .CSharp" )
87
+ SetupExternalManagedTestProject (name .. " .Tests.CSharp" )
135
88
end
136
89
137
90
function SetupTestProjectsCLI (name , extraFiles , suffix )
@@ -142,14 +95,11 @@ function SetupTestProjectsCLI(name, extraFiles, suffix)
142
95
project (name .. " .CLI" )
143
96
SetupNativeProject ()
144
97
145
- enabledefaultcompileitems " false"
146
- enabledefaultnoneitems " false"
147
98
kind " SharedLib"
148
99
language " C++"
149
100
clr " NetCore"
150
101
151
- dependson { name .. " .Gen" , name .. " .Native" , " CppSharp.Generator" }
152
- SetupTestGeneratorBuildEvent (name )
102
+ dependson { name .. " .Gen" }
153
103
154
104
if (suffix ~= nil ) then
155
105
nm = name .. suffix
@@ -174,16 +124,9 @@ function SetupTestProjectsCLI(name, extraFiles, suffix)
174
124
175
125
includedirs { path .join (testsdir , name ), incdir }
176
126
links { name .. " .Native" }
177
- files { path .join (objsdir , name .. " .Native" , " timestamp.cpp" ) }
178
-
179
- project (name .. " .Tests.CLI" )
180
- SetupManagedTestProject ()
181
- enabledefaultnoneitems " false"
182
- files { name .. " .Tests.cs" }
127
+ files { path .join (objsdir , name .. " .Native" ) }
183
128
184
- links { name .. " .CLI" , " CppSharp.Generator.Tests" }
185
- dependson { name .. " .Native" }
186
- nuget { " Microsoft.NET.Test.Sdk:16.8.0" }
129
+ SetupExternalManagedTestProject (name .. " .Tests.CLI" )
187
130
end
188
131
189
132
function IncludeExamples ()
0 commit comments