From 219f0df11aafa38a10f7dc54d95d282cc85d5a4c Mon Sep 17 00:00:00 2001 From: Igor Karatayev Date: Fri, 16 Aug 2013 00:58:33 +0300 Subject: [PATCH] Visual Studio 2013 integration changed table.insert to premake.override, added vs2013 tests. --- src/actions/vstudio/vs2013.lua | 21 ++------ .../vs2013/test_csproj_common_props.lua | 38 +++++++++++++++ .../vs2013/test_csproj_project_element.lua | 29 +++++++++++ .../vs2013/test_csproj_project_props.lua | 48 +++++++++++++++++++ tests/actions/vs2013/test_csproj_targets.lua | 45 +++++++++++++++++ tests/actions/vs2013/test_sln_header.lua | 29 +++++++++++ .../vs2013/test_vcxproj_config_props.lua | 44 +++++++++++++++++ tests/premake4.lua | 8 ++++ 8 files changed, 245 insertions(+), 17 deletions(-) create mode 100644 tests/actions/vs2013/test_csproj_common_props.lua create mode 100644 tests/actions/vs2013/test_csproj_project_element.lua create mode 100644 tests/actions/vs2013/test_csproj_project_props.lua create mode 100644 tests/actions/vs2013/test_csproj_targets.lua create mode 100644 tests/actions/vs2013/test_sln_header.lua create mode 100644 tests/actions/vs2013/test_vcxproj_config_props.lua diff --git a/src/actions/vstudio/vs2013.lua b/src/actions/vstudio/vs2013.lua index 2246eac9..8305f6f0 100644 --- a/src/actions/vstudio/vs2013.lua +++ b/src/actions/vstudio/vs2013.lua @@ -60,23 +60,10 @@ -- Add new elements to the configuration properties block of C++ projects. --- - table.insertafter(vc2010.elements.configurationProperties, "characterSet", "platformToolset") - - function vc2010.platformToolset(cfg) + premake.override(vc2010, "platformToolset", function(orig, cfg) if _ACTION > "vs2012" then _p(2,'v120') + else + orig(cfg) end - end - - --- --- Add a common properties import statement to the top of C# projects. --- - - table.insertafter(cs2005.elements.project, "projectElement", "commonProperties") - - function cs2005.commonProperties(prj) - if _ACTION > "vs2010" then - _p(1,'') - end - end + end) diff --git a/tests/actions/vs2013/test_csproj_common_props.lua b/tests/actions/vs2013/test_csproj_common_props.lua new file mode 100644 index 00000000..444137b3 --- /dev/null +++ b/tests/actions/vs2013/test_csproj_common_props.lua @@ -0,0 +1,38 @@ +-- +-- tests/actions/vs2013/test_csproj_common_props.lua +-- Check Visual Studio 2013 extensions to the project properties block. +-- Copyright (c) 2013 Jason Perkins and the Premake project +-- + + local suite = test.declare("vs2013_csproj_common_props") + local cs2005 = premake.vstudio.cs2005 + + +-- +-- Setup +-- + + local sln, prj + + function suite.setup() + _ACTION = "vs2013" + sln = test.createsolution() + language "C#" + end + + local function prepare() + prj = premake.solution.getproject_ng(sln, 1) + cs2005.commonProperties(prj) + end + + +--- +-- Visual Studio 2013 omits and . +--- + + function suite.onDefaultCommonProps() + prepare() + test.capture [[ + + ]] + end diff --git a/tests/actions/vs2013/test_csproj_project_element.lua b/tests/actions/vs2013/test_csproj_project_element.lua new file mode 100644 index 00000000..204a4e61 --- /dev/null +++ b/tests/actions/vs2013/test_csproj_project_element.lua @@ -0,0 +1,29 @@ +-- +-- tests/actions/vs2013/test_csproj_project_element.lua +-- Check generation of opening project element for VS2013 C# projects. +-- Copyright (c) 2013 Jason Perkins and the Premake project +-- + + local suite = test.declare("vs2013_csproj_project_element") + local cs2005 = premake.vstudio.cs2005 + + +-- +-- Setup +-- + + local sln, prj + + function suite.setup() + _ACTION = "vs2013" + sln, prj = test.createsolution() + end + + + function suite.allVersionsCorrect() + cs2005.projectElement(prj) + test.capture [[ + + + ]] + end diff --git a/tests/actions/vs2013/test_csproj_project_props.lua b/tests/actions/vs2013/test_csproj_project_props.lua new file mode 100644 index 00000000..9891caef --- /dev/null +++ b/tests/actions/vs2013/test_csproj_project_props.lua @@ -0,0 +1,48 @@ +-- +-- tests/actions/vs2013/test_csproj_project_props.lua +-- Check Visual Studio 2013 extensions to the project properties block. +-- Copyright (c) 2013 Jason Perkins and the Premake project +-- + + local suite = test.declare("vs2013_csproj_project_props") + local cs2005 = premake.vstudio.cs2005 + + +-- +-- Setup +-- + + local sln, prj + + function suite.setup() + _ACTION = "vs2013" + sln = test.createsolution() + language "C#" + end + + local function prepare() + prj = premake.solution.getproject_ng(sln, 1) + cs2005.projectProperties(prj) + end + + +--- +-- Visual Studio 2013 omits ProductVersion and SchemaVersion. +--- + + function suite.onDefaultProps() + prepare() + test.capture [[ + + Debug + AnyCPU + {42B5DBC6-AE1F-903D-F75D-41E363076E92} + Exe + Properties + MyProject + MyProject + v4.5 + 512 + + ]] + end diff --git a/tests/actions/vs2013/test_csproj_targets.lua b/tests/actions/vs2013/test_csproj_targets.lua new file mode 100644 index 00000000..f1e1df20 --- /dev/null +++ b/tests/actions/vs2013/test_csproj_targets.lua @@ -0,0 +1,45 @@ +-- +-- tests/actions/vs2013/test_csproj_targets.lua +-- Check Visual Studio 2013 extensions to the targets block. +-- Copyright (c) 2013 Jason Perkins and the Premake project +-- + + local suite = test.declare("vs2013_csproj_targets") + local cs2005 = premake.vstudio.cs2005 + + +-- +-- Setup +-- + + local sln, prj + + function suite.setup() + _ACTION = "vs2013" + sln = test.createsolution() + language "C#" + end + + local function prepare() + prj = premake.solution.getproject_ng(sln, 1) + cs2005.targets(prj) + end + + +--- +-- Visual Studio 2013 changes the MS Build path slightly. +--- + + function suite.onDefaultCommonProps() + prepare() + test.capture [[ + + + ]] + end diff --git a/tests/actions/vs2013/test_sln_header.lua b/tests/actions/vs2013/test_sln_header.lua new file mode 100644 index 00000000..9386be7b --- /dev/null +++ b/tests/actions/vs2013/test_sln_header.lua @@ -0,0 +1,29 @@ +-- +-- tests/actions/vs2013/test_sln_header.lua +-- Check VS2013 modifications to the solution header markup. +-- Copyright (c) 2013 Jason Perkins and the Premake project +-- + + local suite = test.declare("vs2013_sln_header") + local sln2005 = premake.vstudio.sln2005 + + +-- +-- Setup +-- + + local sln, prj + + function suite.setup() + _ACTION = "vs2013" + sln = test.createsolution() + end + + + function suite.setsVersionsInHeader() + sln2005.header() + test.capture [[ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 + ]] + end diff --git a/tests/actions/vs2013/test_vcxproj_config_props.lua b/tests/actions/vs2013/test_vcxproj_config_props.lua new file mode 100644 index 00000000..71209c52 --- /dev/null +++ b/tests/actions/vs2013/test_vcxproj_config_props.lua @@ -0,0 +1,44 @@ +--- +-- tests/actions/vs2013/test_vcxproj_config_props.lua +-- Check the VC2013 extensions to the configuration properties block. +-- Copyright (c) 2013 Jason Perkins and the Premake project +--- + + local suite = test.declare("vs2013_vcxproj_config_props") + local vc2010 = premake.vstudio.vc2010 + local project = premake5.project + + +--- +-- Setup +--- + + local sln, prj, cfg + + function suite.setup() + _ACTION = "vs2013" + sln = test.createsolution() + end + + local function prepare() + prj = premake.solution.getproject_ng(sln, 1) + cfg = project.getconfig(prj, "Debug") + vc2010.configurationProperties(cfg) + end + + +--- +-- Visual Studio 2013 adds a new element. +--- + + function suite.addsPlatformToolset() + prepare() + test.capture [[ + + Application + false + MultiByte + v120 + + ]] + end diff --git a/tests/premake4.lua b/tests/premake4.lua index 98c0b511..4b7a70b2 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -156,6 +156,14 @@ dofile("actions/vs2012/test_sln_header.lua") dofile("actions/vs2012/test_vcxproj_config_props.lua") + -- Visual Studio 2013 + dofile("actions/vs2013/test_csproj_common_props.lua") + dofile("actions/vs2013/test_csproj_project_element.lua") + dofile("actions/vs2013/test_csproj_project_props.lua") + dofile("actions/vs2013/test_csproj_targets.lua") + dofile("actions/vs2013/test_sln_header.lua") + dofile("actions/vs2013/test_vcxproj_config_props.lua") + -- Makefile tests dofile("actions/make/test_make_escaping.lua") dofile("actions/make/test_make_tovar.lua")