Skip to content

Commit 9ac4c56

Browse files
committed
Deprecate ExcludeFromBuild flag
1 parent 2d7aec7 commit 9ac4c56

22 files changed

+376
-24
lines changed

modules/codelite/codelite_project.lua

Lines changed: 2 additions & 2 deletions
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.flags.ExcludeFromBuild or fcfg.buildaction == "None" then
136+
if not fcfg or fcfg.buildaction == "None" then
137137
table.insert(excludesFromBuild, cfgname)
138138
end
139139
end
@@ -282,7 +282,7 @@
282282
local workingdir = iif(isExe, project.getrelative(prj, cfg.debugdir), "")
283283
local pauseexec = iif(prj.kind == "ConsoleApp", "yes", "no")
284284
local isguiprogram = iif(prj.kind == "WindowedApp", "yes", "no")
285-
local isenabled = iif(cfg.flags.ExcludeFromBuild, "no", "yes")
285+
local isenabled = iif(cfg.excludefrombuild, "no", "yes")
286286

287287
_x(3, '<General OutputFile="%s" IntermediateDirectory="%s" Command="%s" CommandArguments="%s" UseSeparateDebugArgs="%s" DebugArguments="%s" WorkingDirectory="%s" PauseExecWhenProcTerminates="%s" IsGUIProgram="%s" IsEnabled="%s"/>',
288288
targetname, objdir, command, cmdargs, useseparatedebugargs, debugargs, workingdir, pauseexec, isguiprogram, isenabled)

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.flags.ExcludeFromBuild or filecfg.buildaction == "None" then
163+
if not filecfg or filecfg.buildaction == "None" 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.flags.ExcludeFromBuild or filecfg.buildaction == "None" then
91+
if not filecfg or filecfg.buildaction == "None" 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 not filecfg.flags.ExcludeFromBuild and filecfg.buildaction ~= "None" then
295+
if filecfg and filecfg.buildaction ~= "None" 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
@@ -640,7 +640,7 @@ function m.buildFiles(cfg)
640640
tree.traverse(tr, {
641641
onleaf = function(node, depth)
642642
local filecfg = fileconfig.getconfig(node, cfg)
643-
if filecfg and not filecfg.flags.ExcludeFromBuild then
643+
if filecfg then
644644
if filecfg.buildaction == "None" then
645645
return
646646
end
@@ -686,7 +686,7 @@ function m.buildFiles(cfg)
686686
tree.traverse(tr, {
687687
onleaf = function(node, depth)
688688
local filecfg = fileconfig.getconfig(node, cfg)
689-
if filecfg and not filecfg.flags.ExcludeFromBuild then
689+
if filecfg then
690690
if filecfg.buildaction == "None" then
691691
return
692692
end

modules/vstudio/tests/sln2005/test_platforms.lua

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,31 @@ EndGlobalSection
737737
end
738738

739739

740+
function suite.onBuildCfgExcludedByAPI()
741+
platforms { "DLL", "Static" }
742+
project "MyProject"
743+
filter "configurations:Debug"
744+
excludefrombuild "On"
745+
prepare()
746+
test.capture [[
747+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
748+
Debug|DLL = Debug|DLL
749+
Debug|Static = Debug|Static
750+
Release|DLL = Release|DLL
751+
Release|Static = Release|Static
752+
EndGlobalSection
753+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
754+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32
755+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Win32
756+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32
757+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32
758+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32
759+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.Build.0 = Release Static|Win32
760+
EndGlobalSection
761+
]]
762+
end
763+
764+
740765
function suite.onExcludedPlatform()
741766
platforms { "DLL", "Static" }
742767
project "MyProject"
@@ -785,6 +810,30 @@ EndGlobalSection
785810
]]
786811
end
787812

813+
function suite.onPlatformExcludedByAPI()
814+
platforms { "DLL", "Static" }
815+
project "MyProject"
816+
filter "platforms:Static"
817+
excludefrombuild "On"
818+
prepare()
819+
test.capture [[
820+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
821+
Debug|DLL = Debug|DLL
822+
Debug|Static = Debug|Static
823+
Release|DLL = Release|DLL
824+
Release|Static = Release|Static
825+
EndGlobalSection
826+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
827+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32
828+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.Build.0 = Debug DLL|Win32
829+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Win32
830+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32
831+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32
832+
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32
833+
EndGlobalSection
834+
]]
835+
end
836+
788837
function suite.onExcludedBuildCfg_noPlatforms()
789838
project "MyProject"
790839
removeconfigurations { "Debug" }

modules/vstudio/tests/sln2026/test_projects.lua

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ function suite.project_with_platform_and_config_configmap()
182182
end
183183

184184

185-
function suite.project_excluded_from_build()
185+
function suite.project_excluded_from_build_by_flag()
186186
local wks = workspace "MyWorkspace"
187187
configurations { "Debug", "Release" }
188188

@@ -204,6 +204,25 @@ function suite.project_excluded_from_build()
204204
end
205205

206206

207+
function suite.project_excluded_from_build_by_api()
208+
local wks = workspace "MyWorkspace"
209+
configurations { "Debug", "Release" }
210+
211+
local prj1 = project "MyProject1"
212+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
213+
filter "configurations:Release"
214+
excludefrombuild "On"
215+
216+
sln2026.projects(wks)
217+
218+
test.capture [[
219+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
220+
<Build Solution="Release|Win32" Project="false" />
221+
</Project>
222+
]]
223+
end
224+
225+
207226
function suite.project_remove_configuration()
208227
local wks = workspace "MyWorkspace"
209228
configurations { "Debug", "Release" }

modules/vstudio/tests/vc200x/test_files.lua

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,36 @@
434434
]]
435435
end
436436

437+
function suite.excludedFromBuild_onBuildActionNone()
438+
files { "hello.cpp" }
439+
filter "files:hello.cpp"
440+
buildaction "None"
441+
prepare()
442+
test.capture [[
443+
<Files>
444+
<File
445+
RelativePath="hello.cpp"
446+
>
447+
<FileConfiguration
448+
Name="Debug|Win32"
449+
ExcludedFromBuild="true"
450+
>
451+
<Tool
452+
Name="VCCLCompilerTool"
453+
/>
454+
</FileConfiguration>
455+
<FileConfiguration
456+
Name="Release|Win32"
457+
ExcludedFromBuild="true"
458+
>
459+
<Tool
460+
Name="VCCLCompilerTool"
461+
/>
462+
</FileConfiguration>
463+
</File>
464+
]]
465+
end
466+
437467
function suite.excludedFromBuild_onCustomBuildRule_excludedFile()
438468
files { "hello.cg" }
439469
filter "files:**.cg"
@@ -490,6 +520,36 @@
490520
]]
491521
end
492522

523+
524+
function suite.excludedFromBuild_onCustomBuildRule_buildActionNone()
525+
files { "hello.cg" }
526+
filter "files:**.cg"
527+
buildcommands { "cgc $(InputFile)" }
528+
buildoutputs { "$(InputName).obj" }
529+
buildaction "None"
530+
prepare()
531+
test.capture [[
532+
<Files>
533+
<File
534+
RelativePath="hello.cg"
535+
>
536+
<FileConfiguration
537+
Name="Debug|Win32"
538+
ExcludedFromBuild="true"
539+
>
540+
<Tool
541+
Name="VCCustomBuildTool"
542+
CommandLine="cgc $(InputFile)"
543+
Outputs="$(InputName).obj"
544+
/>
545+
</FileConfiguration>
546+
<FileConfiguration
547+
Name="Release|Win32"
548+
ExcludedFromBuild="true"
549+
>
550+
]]
551+
end
552+
493553

494554
--
495555
-- If a custom build rule is supplied, the custom build tool settings should be used.

modules/vstudio/tests/vc2010/test_files.lua

Lines changed: 117 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,33 @@
255255
flags { "ExcludeFromBuild" }
256256
prepare()
257257
test.capture [[
258+
<ItemGroup>
259+
<None Include="hello.cpp" />
260+
</ItemGroup>
261+
]]
262+
end
263+
264+
function suite.excludedFromBuild_onBuildActionNone()
265+
files { "hello.cpp" }
266+
filter "files:hello.cpp"
267+
buildaction "None"
268+
prepare()
269+
test.capture [[
270+
<ItemGroup>
271+
<None Include="hello.cpp" />
272+
</ItemGroup>
273+
]]
274+
end
275+
276+
function suite.excludedFromBuild_onBuildActionNone_Filtered()
277+
files { "hello.cpp" }
278+
filter { "files:hello.cpp", "configurations:Debug" }
279+
buildaction "None"
280+
prepare()
281+
test.capture [[
258282
<ItemGroup>
259283
<ClCompile Include="hello.cpp">
260-
<ExcludedFromBuild>true</ExcludedFromBuild>
284+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
261285
</ClCompile>
262286
</ItemGroup>
263287
]]
@@ -283,9 +307,33 @@
283307
flags { "ExcludeFromBuild" }
284308
prepare()
285309
test.capture [[
310+
<ItemGroup>
311+
<None Include="hello.rc" />
312+
</ItemGroup>
313+
]]
314+
end
315+
316+
function suite.excludedFromBuild_onResourceFile_buildActionNone()
317+
files { "hello.rc" }
318+
filter "files:hello.rc"
319+
buildaction "None"
320+
prepare()
321+
test.capture [[
322+
<ItemGroup>
323+
<None Include="hello.rc" />
324+
</ItemGroup>
325+
]]
326+
end
327+
328+
function suite.excludedFromBuild_onResourceFile_buildActionNone_Filtered()
329+
files { "hello.rc" }
330+
filter { "files:hello.rc", "configurations:Debug" }
331+
buildaction "None"
332+
prepare()
333+
test.capture [[
286334
<ItemGroup>
287335
<ResourceCompile Include="hello.rc">
288-
<ExcludedFromBuild>true</ExcludedFromBuild>
336+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
289337
</ResourceCompile>
290338
</ItemGroup>
291339
]]
@@ -298,9 +346,35 @@
298346
flags { "ExcludeFromBuild" }
299347
prepare()
300348
test.capture [[
349+
<ItemGroup>
350+
<None Include="hello.rc" />
351+
</ItemGroup>
352+
]]
353+
end
354+
355+
function suite.excludedFromBuild_onResourceFile_buildActionNone_nonWindows()
356+
files { "hello.rc" }
357+
system "Linux"
358+
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"
373+
prepare()
374+
test.capture [[
301375
<ItemGroup>
302376
<ResourceCompile Include="hello.rc">
303-
<ExcludedFromBuild>true</ExcludedFromBuild>
377+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">true</ExcludedFromBuild>
304378
</ResourceCompile>
305379
</ItemGroup>
306380
]]
@@ -355,7 +429,26 @@
355429
]]
356430
end
357431

358-
function suite.excludedFromBuild_onCustomBuildRule_withNoCommands()
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+
451+
function suite.excludedFromBuild_onCustomBuildRule_withNoCommands_excludeViaFlag()
359452
files { "hello.cg" }
360453
filter { "files:**.cg", "Debug" }
361454
buildcommands { "cgc $(InputFile)" }
@@ -375,6 +468,26 @@
375468
]]
376469
end
377470

471+
function suite.excludedFromBuild_onCustomBuildRule_withNoCommands_buildActionNone()
472+
files { "hello.cg" }
473+
filter { "files:**.cg", "Debug" }
474+
buildcommands { "cgc $(InputFile)" }
475+
buildoutputs { "$(InputName).obj" }
476+
filter { "files:**.cg" }
477+
buildaction "None"
478+
prepare()
479+
test.capture [[
480+
<ItemGroup>
481+
<CustomBuild Include="hello.cg">
482+
<FileType>Document</FileType>
483+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
484+
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
485+
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
486+
</CustomBuild>
487+
</ItemGroup>
488+
]]
489+
end
490+
378491

379492
--
380493
-- If a custom rule outputs an object file, it's automatically linked, unless

0 commit comments

Comments
 (0)