From 42cb65e0cb878185e4d157cc57d2c3740da25dcc Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 29 Jul 2014 16:00:02 -0400 Subject: [PATCH] Allow ExcludeFromBuild flag to exclude entire configurations (VS only) --- src/actions/vstudio/vs2005_solution.lua | 2 +- .../vstudio/sln2005/test_platforms.lua | 55 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/actions/vstudio/vs2005_solution.lua b/src/actions/vstudio/vs2005_solution.lua index dd7582f9..261dfb1d 100644 --- a/src/actions/vstudio/vs2005_solution.lua +++ b/src/actions/vstudio/vs2005_solution.lua @@ -209,7 +209,7 @@ -- to closest available project configuration instead. local prjCfg = project.getconfig(prj, cfg.buildcfg, cfg.platform) - local excluded = (prjCfg == nil) + local excluded = (prjCfg == nil or prjCfg.flags.ExcludeFromBuild) if excluded then prjCfg = project.findClosestMatch(prj, cfg.buildcfg, cfg.platform) diff --git a/tests/actions/vstudio/sln2005/test_platforms.lua b/tests/actions/vstudio/sln2005/test_platforms.lua index 00fb9f5f..761c54b4 100644 --- a/tests/actions/vstudio/sln2005/test_platforms.lua +++ b/tests/actions/vstudio/sln2005/test_platforms.lua @@ -22,6 +22,7 @@ end local function prepare(lang) + filter {} uuid "C9135098-6047-8142-B10E-D27E7F73FCB3" sln = premake.oven.bakeSolution(sln) sln2005.configurationPlatforms(sln) @@ -696,6 +697,32 @@ ]] end + + function suite.onBuildCfgExcludedByFlag() + platforms { "DLL", "Static" } + project "MyProject" + filter "configurations:Debug" + flags "ExcludeFromBuild" + prepare() + test.capture [[ + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|DLL = Debug|DLL + Debug|Static = Debug|Static + Release|DLL = Release|DLL + Release|Static = Release|Static + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.Build.0 = Release Static|Win32 + EndGlobalSection + ]] + end + + function suite.onExcludedPlatform() platforms { "DLL", "Static" } project "MyProject" @@ -719,6 +746,31 @@ ]] end + + function suite.onPlatformExcludedByFlag() + platforms { "DLL", "Static" } + project "MyProject" + filter "platforms:Static" + flags "ExcludeFromBuild" + prepare() + test.capture [[ + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|DLL = Debug|DLL + Debug|Static = Debug|Static + Release|DLL = Release|DLL + Release|Static = Release|Static + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.Build.0 = Debug DLL|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32 + {C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32 + EndGlobalSection + ]] + end + function suite.onExcludedBuildCfg_noPlatforms() project "MyProject" removeconfigurations { "Debug" } @@ -736,8 +788,11 @@ ]] end + +--- -- Check that when a default platform is specified it is written in a separate -- configuration block so that Visual Studio picks it up as default. +--- function suite.onDefaultPlatforms() platforms { "x32", "x64" }