Began work on new frameworks() api

This commit is contained in:
starkos 2010-03-04 21:01:45 +00:00
parent ccd6fa4b0c
commit 0da8416c9b
4 changed files with 110 additions and 5 deletions

View File

@ -1,13 +1,22 @@
--
-- vs2005_csproj.lua
-- Generate a Visual Studio 2005/2008 C# project.
-- Copyright (c) 2009 Jason Perkins and the Premake project
-- Copyright (c) 2009-2010 Jason Perkins and the Premake project
--
--
-- Figure out what elements a particular source code file need in its item
-- block, based on its build action and any related files in the project.
--
--
-- Set up namespaces
--
premake.vstudio.cs2005 = { }
local vstudio = premake.vstudio
local cs2005 = premake.vstudio.cs2005
--
-- Figure out what elements a particular source code file need in its item
-- block, based on its build action and any related files in the project.
--
local function getelements(prj, action, fname)
@ -61,6 +70,32 @@
end
--
-- Write the opening <Project> element and project level <PropertyGroup> block.
--
function cs2005.projectheader(prj)
local vsversion, toolversion
if _ACTION == "vs2005" then
vsversion = "8.0.50727"
toolversion = nil
elseif _ACTION == "vs2008" then
vsversion = "9.0.21022"
toolversion = "3.5"
end
if toolversion then
_p('<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="%s">', toolversion)
else
_p('<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
end
end
--
-- The main function: write the project file.
--
function premake.vs2005_csproj(prj)
io.eol = "\r\n"

View File

@ -102,6 +102,20 @@
}
},
framework =
{
kind = "string",
scope = "container",
allowed = {
"1.0",
"1.1",
"2.0",
"3.0",
"3.5",
"4.0"
}
},
imageoptions =
{
kind = "list",

View File

@ -0,0 +1,55 @@
--
-- tests/actions/test_vs2005_csproj.lua
-- Automated test suite for Visual Studio 2005-2008 C# project generation.
-- Copyright (c) 2010 Jason Perkins and the Premake project
--
T.vs2005_csproj = { }
local suite = T.vs2005_csproj
local cs2005 = premake.vstudio.cs2005
--
-- Configure a solution for testing
--
local sln, prj
function suite.setup()
_ACTION = "vs2005"
sln = solution "MySolution"
configurations { "Debug", "Release" }
platforms {}
prj = project "MyProject"
language "C#"
kind "ConsoleApp"
uuid "AE61726D-187C-E440-BD07-2556188A6565"
end
local function prepare()
io.capture()
premake.buildconfigs()
end
--
-- Project header tests
--
function suite.projectheader_OnVs2005()
_ACTION = "vs2005"
prepare()
cs2005.projectheader(prj)
test.capture [[
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
]]
end
function suite.projectheader_OnVs2008()
_ACTION = "vs2008"
prepare()
cs2005.projectheader(prj)
test.capture [[
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
]]
end

View File

@ -63,6 +63,7 @@
dofile("test_vs2003_sln.lua")
dofile("test_vs2005_sln.lua")
dofile("test_vs2008_sln.lua")
dofile("actions/vstudio/test_vs2005_csproj.lua")
dofile("actions/vstudio/test_vs200x_vcproj.lua")
-- Xcode tests