Skip to content

Commit f653153

Browse files
Merge pull request #2585 from nickclark2016/restore-exclude-from-build-behavior
Explicit separation between excludefrombuild and buildaction None
2 parents 1082ad4 + 3bf529e commit f653153

File tree

16 files changed

+47
-146
lines changed

16 files changed

+47
-146
lines changed

modules/codelite/codelite_project.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
for cfg in project.eachconfig(prj) do
134134
local cfgname = codelite.cfgname(cfg)
135135
local fcfg = p.fileconfig.getconfig(node, cfg)
136-
if not fcfg or fcfg.buildaction == "None" then
136+
if not fcfg or fcfg.excludefrombuild or fcfg.buildaction == "None" then
137137
table.insert(excludesFromBuild, cfgname)
138138
end
139139
end

modules/gmake/gmake_cpp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160

161161
function cpp.addFile(cfg, node)
162162
local filecfg = fileconfig.getconfig(node, cfg)
163-
if not filecfg or filecfg.buildaction == "None" then
163+
if not filecfg or filecfg.buildaction == "None" or filecfg.excludefrombuild then
164164
return
165165
end
166166

modules/gmake/gmake_utility.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
function utility.addFile(cfg, node, prj)
9090
local filecfg = fileconfig.getconfig(node, cfg)
91-
if not filecfg or filecfg.buildaction == "None" then
91+
if not filecfg or filecfg.buildaction == "None" or filecfg.excludefrombuild then
9292
return
9393
end
9494

modules/gmakelegacy/gmakelegacy_cpp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ end
292292
local custom = false
293293
for cfg in project.eachconfig(prj) do
294294
local filecfg = fileconfig.getconfig(node, cfg)
295-
if filecfg and filecfg.buildaction ~= "None" then
295+
if filecfg and filecfg.buildaction ~= "None" and not filecfg.excludefrombuild then
296296
incfg[cfg] = filecfg
297297
custom = fileconfig.hasCustomBuildRule(filecfg)
298298
else

modules/ninja/ninja_cpp.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ function m.buildFiles(cfg)
641641
onleaf = function(node, depth)
642642
local filecfg = fileconfig.getconfig(node, cfg)
643643
if filecfg then
644-
if filecfg.buildaction == "None" then
644+
if filecfg.buildaction == "None" or filecfg.excludefrombuild then
645645
return
646646
end
647647

@@ -687,7 +687,7 @@ function m.buildFiles(cfg)
687687
onleaf = function(node, depth)
688688
local filecfg = fileconfig.getconfig(node, cfg)
689689
if filecfg then
690-
if filecfg.buildaction == "None" then
690+
if filecfg.buildaction == "None" or filecfg.excludefrombuild then
691691
return
692692
end
693693

modules/vstudio/tests/vc200x/test_files.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,10 @@
434434
]]
435435
end
436436

437-
function suite.excludedFromBuild_onBuildActionNone()
437+
function suite.excludedFromBuild_onExcludeAPI()
438438
files { "hello.cpp" }
439439
filter "files:hello.cpp"
440-
buildaction "None"
440+
excludefrombuild "On"
441441
prepare()
442442
test.capture [[
443443
<Files>
@@ -521,12 +521,12 @@
521521
end
522522

523523

524-
function suite.excludedFromBuild_onCustomBuildRule_buildActionNone()
524+
function suite.excludedFromBuild_onCustomBuildRule_excludeAPI()
525525
files { "hello.cg" }
526526
filter "files:**.cg"
527527
buildcommands { "cgc $(InputFile)" }
528528
buildoutputs { "$(InputName).obj" }
529-
buildaction "None"
529+
excludefrombuild "On"
530530
prepare()
531531
test.capture [[
532532
<Files>

modules/vstudio/tests/vc2010/test_files.lua

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@
256256
prepare()
257257
test.capture [[
258258
<ItemGroup>
259-
<None Include="hello.cpp" />
259+
<ClCompile Include="hello.cpp">
260+
<ExcludedFromBuild>true</ExcludedFromBuild>
261+
</ClCompile>
260262
</ItemGroup>
261263
]]
262264
end
@@ -273,20 +275,21 @@
273275
]]
274276
end
275277

276-
function suite.excludedFromBuild_onBuildActionNone_Filtered()
278+
function suite.excludedFromBuild_onAPI()
277279
files { "hello.cpp" }
278-
filter { "files:hello.cpp", "configurations:Debug" }
279-
buildaction "None"
280+
filter "files:hello.cpp"
281+
excludefrombuild "On"
280282
prepare()
281283
test.capture [[
282284
<ItemGroup>
283285
<ClCompile Include="hello.cpp">
284-
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
286+
<ExcludedFromBuild>true</ExcludedFromBuild>
285287
</ClCompile>
286288
</ItemGroup>
287289
]]
288290
end
289291

292+
290293
function suite.excludedFromBuild_onResourceFile_excludedFile()
291294
files { "hello.rc" }
292295
filter "Debug"
@@ -308,7 +311,9 @@
308311
prepare()
309312
test.capture [[
310313
<ItemGroup>
311-
<None Include="hello.rc" />
314+
<ResourceCompile Include="hello.rc">
315+
<ExcludedFromBuild>true</ExcludedFromBuild>
316+
</ResourceCompile>
312317
</ItemGroup>
313318
]]
314319
end
@@ -325,15 +330,15 @@
325330
]]
326331
end
327332

328-
function suite.excludedFromBuild_onResourceFile_buildActionNone_Filtered()
333+
function suite.excludedFromBuild_onResourceFile_viaAPI()
329334
files { "hello.rc" }
330-
filter { "files:hello.rc", "configurations:Debug" }
331-
buildaction "None"
335+
filter "files:hello.rc"
336+
excludefrombuild "On"
332337
prepare()
333338
test.capture [[
334339
<ItemGroup>
335340
<ResourceCompile Include="hello.rc">
336-
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
341+
<ExcludedFromBuild>true</ExcludedFromBuild>
337342
</ResourceCompile>
338343
</ItemGroup>
339344
]]
@@ -347,34 +352,23 @@
347352
prepare()
348353
test.capture [[
349354
<ItemGroup>
350-
<None Include="hello.rc" />
355+
<ResourceCompile Include="hello.rc">
356+
<ExcludedFromBuild>true</ExcludedFromBuild>
357+
</ResourceCompile>
351358
</ItemGroup>
352359
]]
353360
end
354361

355-
function suite.excludedFromBuild_onResourceFile_buildActionNone_nonWindows()
362+
function suite.excludedFromBuild_onResourceFile_viaAPI_nonWindows()
356363
files { "hello.rc" }
357364
system "Linux"
358365
filter "files:hello.rc"
359-
buildaction "None"
360-
prepare()
361-
test.capture [[
362-
<ItemGroup>
363-
<None Include="hello.rc" />
364-
</ItemGroup>
365-
]]
366-
end
367-
368-
function suite.excludedFromBuild_onResourceFile_buildActionNone_nonWindows_Filtered()
369-
files { "hello.rc" }
370-
system "Linux"
371-
filter { "files:hello.rc", "configurations:Debug" }
372-
buildaction "None"
366+
excludefrombuild "On"
373367
prepare()
374368
test.capture [[
375369
<ItemGroup>
376370
<ResourceCompile Include="hello.rc">
377-
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">true</ExcludedFromBuild>
371+
<ExcludedFromBuild>true</ExcludedFromBuild>
378372
</ResourceCompile>
379373
</ItemGroup>
380374
]]
@@ -429,25 +423,6 @@
429423
]]
430424
end
431425

432-
function suite.excludedFromBuild_onCustomBuildRule_buildActionNone()
433-
files { "hello.cg" }
434-
filter "files:**.cg"
435-
buildcommands { "cgc $(InputFile)" }
436-
buildoutputs { "$(InputName).obj" }
437-
buildaction "None"
438-
prepare()
439-
test.capture [[
440-
<ItemGroup>
441-
<CustomBuild Include="hello.cg">
442-
<FileType>Document</FileType>
443-
<ExcludedFromBuild>true</ExcludedFromBuild>
444-
<Command>cgc $(InputFile)</Command>
445-
<Outputs>$(InputName).obj</Outputs>
446-
</CustomBuild>
447-
</ItemGroup>
448-
]]
449-
end
450-
451426
function suite.excludedFromBuild_onCustomBuildRule_withNoCommands_excludeViaFlag()
452427
files { "hello.cg" }
453428
filter { "files:**.cg", "Debug" }
@@ -468,13 +443,13 @@
468443
]]
469444
end
470445

471-
function suite.excludedFromBuild_onCustomBuildRule_withNoCommands_buildActionNone()
446+
function suite.excludedFromBuild_onCustomBuildRule_withNoCommands_excludeViaAPI()
472447
files { "hello.cg" }
473448
filter { "files:**.cg", "Debug" }
474449
buildcommands { "cgc $(InputFile)" }
475450
buildoutputs { "$(InputName).obj" }
476451
filter { "files:**.cg" }
477-
buildaction "None"
452+
excludefrombuild "On"
478453
prepare()
479454
test.capture [[
480455
<ItemGroup>

modules/vstudio/vs200x_vcproj.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@
10861086

10871087

10881088
function m.excludedFromBuild(filecfg)
1089-
if not filecfg or filecfg.buildaction == "None" then
1089+
if not filecfg or filecfg.excludefrombuild then
10901090
p.w('ExcludedFromBuild="true"')
10911091
end
10921092
end

modules/vstudio/vs2010_vcxproj.lua

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,9 +1653,6 @@
16531653
end
16541654

16551655
else
1656-
local allNone = nil
1657-
local foundAction = nil
1658-
16591656
for cfg in project.eachconfig(prj) do
16601657
local fcfg = fileconfig.getconfig(file, cfg)
16611658
if fcfg then
@@ -1666,15 +1663,7 @@
16661663

16671664
-- also check for buildaction
16681665
if fcfg.buildaction then
1669-
if fcfg.buildaction ~= "None" then
1670-
allNone = false
1671-
foundAction = m.categories[fcfg.buildaction] or m.categories.None
1672-
else
1673-
allNone = foundAction == nil
1674-
end
1675-
else
1676-
-- If no buildaction is defined for this file config, it's not "None"
1677-
allNone = false
1666+
return m.categories[fcfg.buildaction] or m.categories.None
16781667
end
16791668

16801669
if fcfg.compileas ~= nil and fcfg.compileas ~= "Default" then
@@ -1683,14 +1672,6 @@
16831672
end
16841673
end
16851674

1686-
if not foundAction and allNone == true then
1687-
return m.categories.None
1688-
end
1689-
1690-
if foundAction then
1691-
return foundAction
1692-
end
1693-
16941675
-- If there is a custom rule associated with it, use that
16951676
local rule = p.global.getRuleForFile(file.name, prj.rules)
16961677
if rule then
@@ -2499,7 +2480,7 @@
24992480

25002481

25012482
function m.excludedFromBuild(filecfg, condition)
2502-
if not filecfg or filecfg.buildaction == "None" then
2483+
if not filecfg or filecfg.excludefrombuild then
25032484
m.element("ExcludedFromBuild", condition, "true")
25042485
end
25052486
end

modules/xcode/xcode_common.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@
13031303
-- ms this seems to work on visual studio !!!
13041304
-- why not in xcode ??
13051305
local filecfg = fileconfig.getconfig(node, cfg)
1306-
if not filecfg or filecfg.buildaction == "None" then
1306+
if not filecfg or filecfg.buildaction == "None" or filecfg.excludefrombuild then
13071307
--fileNameList = fileNameList .. " " ..filecfg.name
13081308
table.insert(fileNameList, xcode.escapeArg(node.name))
13091309
end

0 commit comments

Comments
 (0)