Skip to content

Commit 87b8471

Browse files
authored
Ensure bindings are regenerated as needed without using DisableFastUpToDateCheck (#1511)
1 parent bdf084f commit 87b8471

File tree

1 file changed

+15
-29
lines changed

1 file changed

+15
-29
lines changed

build/Tests.lua

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,5 @@
11
-- Tests/examples helpers
22

3-
require('vstudio')
4-
5-
function disableFastUpToDateCheck(prj, cfg)
6-
premake.vstudio.vc2010.element("DisableFastUpToDateCheck", nil, "true")
7-
end
8-
9-
premake.override(premake.vstudio.cs2005.elements, "projectProperties",
10-
function(oldfn, prj)
11-
local elements = oldfn(prj)
12-
if (string.endswith(prj.filename, ".CSharp") and
13-
not string.endswith(prj.filename, ".Tests.CSharp") and
14-
not string.endswith(prj.filename, ".Parser.CSharp")) then
15-
elements = table.join(elements, {disableFastUpToDateCheck})
16-
end
17-
return elements
18-
end)
19-
20-
premake.override(premake.vstudio.vc2010.elements, "globals",
21-
function(oldfn, prj, cfg)
22-
local elements = oldfn(prj, cfg)
23-
if (string.endswith(prj.filename, ".CLI") and
24-
not string.endswith(prj.filename, ".Tests.CLI") and
25-
not string.endswith(prj.filename, ".Parser.CLI") and
26-
prj.filename ~= "CppSharp.CLI") then
27-
elements = table.join(elements, {disableFastUpToDateCheck})
28-
end
29-
return elements
30-
end)
31-
323
function SetupExampleProject()
334
kind "ConsoleApp"
345
language "C#"
@@ -159,6 +130,11 @@ function SetupTestNativeProject(name, depends)
159130
if depends ~= nil then
160131
links { depends .. ".Native" }
161132
end
133+
134+
if string.startswith(_ACTION, "vs") then
135+
postbuildcommands { "type nul > " .. SafePath(path.join(libdir, name .. ".Native.timestamp.cs")) }
136+
postbuildcommands { "type nul > " .. SafePath(path.join(libdir, name .. ".Native.timestamp.cpp")) }
137+
end
162138
end
163139

164140
function LinkNUnit()
@@ -221,6 +197,11 @@ function SetupTestProjectsCSharp(name, depends, extraFiles, suffix)
221197

222198
links(linktable)
223199

200+
if string.startswith(_ACTION, "vs") then
201+
files { path.join(libdir, name .. ".Native.timestamp.cs") }
202+
links { name .. ".Gen" }
203+
end
204+
224205
project(name .. ".Tests.CSharp")
225206
SetupManagedTestProject()
226207

@@ -276,6 +257,11 @@ function SetupTestProjectsCLI(name, extraFiles, suffix)
276257
includedirs { path.join(testsdir, name), incdir }
277258
links { name .. ".Native" }
278259

260+
if string.startswith(_ACTION, "vs") then
261+
files { path.join(libdir, name .. ".Native.timestamp.cpp") }
262+
links { name .. ".Gen" }
263+
end
264+
279265
project(name .. ".Tests.CLI")
280266
SetupManagedTestProject()
281267

0 commit comments

Comments
 (0)