Visual Studio 2013 integration changed table.insert to premake.override, added vs2013 tests.

This commit is contained in:
Igor Karatayev 2013-08-16 00:58:33 +03:00
parent 85c9608bc2
commit 219f0df11a
8 changed files with 245 additions and 17 deletions

View File

@ -60,23 +60,10 @@
-- Add new elements to the configuration properties block of C++ projects. -- Add new elements to the configuration properties block of C++ projects.
--- ---
table.insertafter(vc2010.elements.configurationProperties, "characterSet", "platformToolset") premake.override(vc2010, "platformToolset", function(orig, cfg)
function vc2010.platformToolset(cfg)
if _ACTION > "vs2012" then if _ACTION > "vs2012" then
_p(2,'<PlatformToolset>v120</PlatformToolset>') _p(2,'<PlatformToolset>v120</PlatformToolset>')
else
orig(cfg)
end end
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,'<Import Project="$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props" Condition="Exists(\'$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\')" />')
end
end

View File

@ -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 <ProductVersion> and <SchemaVersion>.
---
function suite.onDefaultCommonProps()
prepare()
test.capture [[
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
]]
end

View File

@ -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 [[
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
]]
end

View File

@ -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 [[
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyProject</RootNamespace>
<AssemblyName>MyProject</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
]]
end

View File

@ -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 [[
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
]]
end

View File

@ -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

View File

@ -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 <PlatformToolset> element.
---
function suite.addsPlatformToolset()
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
]]
end

View File

@ -156,6 +156,14 @@
dofile("actions/vs2012/test_sln_header.lua") dofile("actions/vs2012/test_sln_header.lua")
dofile("actions/vs2012/test_vcxproj_config_props.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 -- Makefile tests
dofile("actions/make/test_make_escaping.lua") dofile("actions/make/test_make_escaping.lua")
dofile("actions/make/test_make_tovar.lua") dofile("actions/make/test_make_tovar.lua")