Merge with premake-dev

This commit is contained in:
Jason Perkins 2012-01-25 16:10:59 -05:00
commit 0d46fe4135
14 changed files with 103 additions and 45 deletions

View File

@ -63,6 +63,8 @@
* Patch 3430158: Reorder LINKCMD for Gmake (rjmyst3)
* Patch 3451212: Fix Visual Studio MFC with StaticRuntime
* Patch 3463020: Add windres environment variable for makefiles (icebreaker)
* Bug 3413866: Incorrect VS200x .csproj relative source paths
* Patch 3111264: Allow path.join() to accept any number of args
-------

View File

@ -1,4 +1,4 @@
Copyright (c) 2003-2011 Jason Perkins and individual contributors.
Copyright (c) 2003-2012 Jason Perkins and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,

View File

@ -1,7 +1,7 @@
PREMAKE
A build configuration tool
Copyright (C) 2002-2011 by Jason Perkins
Copyright (C) 2002-2012 by Jason Perkins
Distributed under the terms of the BSD License, see LICENSE.txt
The Lua language and runtime library is (C) TeCGraf, PUC-Rio.

View File

@ -52,6 +52,9 @@
configuration "vs2005"
defines {"_CRT_SECURE_NO_DEPRECATE" }
configuration "windows"
links { "ole32" }
configuration "linux"
defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
links { "m", "dl" }

View File

@ -42,7 +42,7 @@
premake.tree.traverse(tr, {
onleaf = function(node)
local action = premake.dotnet.getbuildaction(node.cfg)
local fname = path.translate(premake.esc(node.path), "\\")
local fname = path.translate(premake.esc(node.cfg.name), "\\")
local elements, dependency = getelements(prj, action, node.path)
_p(4,'<File')

View File

@ -95,7 +95,7 @@
premake.tree.traverse(tr, {
onleaf = function(node)
local action = premake.dotnet.getbuildaction(node.cfg)
local fname = path.translate(premake.esc(node.path), "\\")
local fname = path.translate(premake.esc(node.cfg.name), "\\")
local elements, dependency = getelements(prj, action, node.path)
if elements == "None" then

View File

@ -217,34 +217,41 @@
return table.contains(extensions, ext)
end
--
-- Join two pieces of a path together into a single path.
-- Join one or more pieces of a path together into a single path.
--
-- @param ...
-- One or more path strings.
-- @return
-- The joined path.
--
function path.join(leading, trailing)
leading = leading or ""
if (not trailing) then
return leading
function path.join(...)
local numargs = select("#", ...)
if numargs == 0 then
return "";
end
if (path.isabsolute(trailing)) then
return trailing
end
if (leading == ".") then
leading = ""
local allparts = {}
for i = numargs, 1, -1 do
local part = select(i, ...)
if part and #part > 0 and part ~= "." then
-- trim off trailing slashes
while part:endswith("/") do
part = part:sub(1, -2)
end
table.insert(allparts, 1, part)
if path.isabsolute(part) then
break
end
end
end
if (leading:len() > 0 and not leading:endswith("/")) then
leading = leading .. "/"
end
return leading .. trailing
return table.concat(allparts, "/")
end
--
-- Takes a path which is relative to one location and makes it relative

View File

@ -5,7 +5,9 @@
*/
#include "premake.h"
#if PLATFORM_WINDOWS
#include <Objbase.h>
#endif
int os_uuid(lua_State* L)
{
@ -13,15 +15,7 @@ int os_uuid(lua_State* L)
char uuid[38];
#if PLATFORM_WINDOWS
static int (__stdcall *CoCreateGuid)(char*) = NULL;
if (CoCreateGuid == NULL)
{
HMODULE hOleDll = LoadLibrary("OLE32.DLL");
CoCreateGuid = (int(__stdcall*)(char*))GetProcAddress(hOleDll, "CoCreateGuid");
}
CoCreateGuid((char*)bytes);
#else
int result;

View File

@ -14,7 +14,7 @@
#define VERSION "HEAD"
#define COPYRIGHT "Copyright (C) 2002-2011 Jason Perkins and the Premake Project"
#define COPYRIGHT "Copyright (C) 2002-2012 Jason Perkins and the Premake Project"
#define ERROR_MESSAGE "%s\n"

View File

@ -106,7 +106,6 @@
language "C++"
kind "ConsoleApp"
prepare()
test.contains(removed, "obj")
test.contains(removed, "obj/Debug")
test.contains(removed, "obj/Release")
end

View File

@ -1,7 +1,7 @@
--
-- tests/actions/vstudio/cs2002/files.lua
-- tests/actions/vstudio/cs2002/test_files.lua
-- Validate generation of <Files/> block in Visual Studio 2002 .csproj
-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
--
T.vstudio_cs2002_files = { }
@ -56,6 +56,25 @@
end
--
-- The relative path to the file is correct for files that live outside
-- the project's folder.
--
function suite.filesUseRelativePath_onOutOfTreePath()
files { "../Src/Hello.cs" }
prepare()
test.capture [[
<File
RelPath = "..\Src\Hello.cs"
BuildAction = "Compile"
SubType = "Code"
/>
]]
end
--
-- Test file dependencies
--

View File

@ -1,7 +1,7 @@
--
-- tests/actions/vstudio/cs2005/files.lua
-- tests/actions/vstudio/cs2005/test_files.lua
-- Validate generation of <Files/> block in Visual Studio 2005 .csproj
-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
--
T.vstudio_cs2005_files = { }
@ -48,6 +48,20 @@
end
--
-- The relative path to the file is correct for files that live outside
-- the project's folder.
--
function suite.filesUseRelativePath_onOutOfTreePath()
files { "../Src/Hello.cs" }
prepare()
test.capture [[
<Compile Include="..\Src\Hello.cs" />
]]
end
--
-- Test file dependencies
--

View File

@ -182,23 +182,43 @@
--
function suite.join_OnValidParts()
test.isequal("leading/trailing", path.join("leading", "trailing"))
test.isequal("p1/p2", path.join("p1", "p2"))
end
function suite.join_OnAbsoluteUnixPath()
test.isequal("/trailing", path.join("leading", "/trailing"))
test.isequal("/p2", path.join("p1", "/p2"))
end
function suite.join_OnAbsoluteWindowsPath()
test.isequal("C:/trailing", path.join("leading", "C:/trailing"))
test.isequal("C:/p2", path.join("p1", "C:/p2"))
end
function suite.join_OnCurrentDirectory()
test.isequal("trailing", path.join(".", "trailing"))
test.isequal("p2", path.join(".", "p2"))
end
function suite.join_OnNilSecondPart()
test.isequal("leading", path.join("leading", nil))
test.isequal("p1", path.join("p1", nil))
end
function suite.join_onMoreThanTwoParts()
test.isequal("p1/p2/p3", path.join("p1", "p2", "p3"))
end
function suite.join_removesExtraInternalSlashes()
test.isequal("p1/p2", path.join("p1/", "p2"))
end
function suite.join_removesTrailingSlash()
test.isequal("p1/p2", path.join("p1", "p2/"))
end
function suite.join_ignoresNilParts()
test.isequal("p2", path.join(nil, "p2", nil))
end
function suite.join_ignoresEmptyParts()
test.isequal("p2", path.join("", "p2", ""))
end

View File

@ -86,10 +86,10 @@
dofile("actions/vstudio/test_vs2010_project_kinds.lua")
-- Visual Studio 2002-2003 C# projects
dofile("actions/vstudio/cs2002/files.lua")
dofile("actions/vstudio/cs2002/test_files.lua")
-- Visual Studio 2005-2010 C# projects
dofile("actions/vstudio/cs2005/files.lua")
dofile("actions/vstudio/cs2005/test_files.lua")
dofile("actions/vstudio/cs2005/projectelement.lua")
dofile("actions/vstudio/cs2005/projectsettings.lua")
dofile("actions/vstudio/cs2005/propertygroup.lua")