Merge utility and build rule improvements
This commit is contained in:
commit
7b8d4c4c98
@ -291,8 +291,8 @@
|
||||
--
|
||||
|
||||
function vstudio.archFromPlatform(platform)
|
||||
local system = premake.api.checkvalue(platform, premake.fields.system)
|
||||
local arch = premake.api.checkvalue(platform, premake.fields.architecture)
|
||||
local system = premake.api.checkValue(premake.fields.system, platform)
|
||||
local arch = premake.api.checkValue(premake.fields.architecture, platform)
|
||||
return architecture(system, arch)
|
||||
end
|
||||
|
||||
|
@ -303,7 +303,7 @@
|
||||
function cs2005.projectReferences(prj)
|
||||
_p(1,'<ItemGroup>')
|
||||
|
||||
local deps = project.getdependencies(prj)
|
||||
local deps = project.getdependencies(prj, true)
|
||||
if #deps > 0 then
|
||||
for _, dep in ipairs(deps) do
|
||||
local relpath = project.getrelative(prj, vstudio.projectfile(dep))
|
||||
|
@ -109,9 +109,7 @@
|
||||
prjpath = prjpath:gsub("$%((.-)%)", "%%%1%%")
|
||||
|
||||
_x('Project("{%s}") = "%s", "%s", "{%s}"', vstudio.tool(prj), prj.name, prjpath, prj.uuid)
|
||||
if _ACTION < "vs2012" then
|
||||
sln2005.projectdependencies(prj)
|
||||
end
|
||||
sln2005.projectdependencies(prj)
|
||||
_p('EndProject')
|
||||
end,
|
||||
|
||||
|
@ -91,7 +91,11 @@
|
||||
end
|
||||
|
||||
-- add this new field to my master list
|
||||
field = premake.field.new(field)
|
||||
field, err = premake.field.new(field)
|
||||
if not field then
|
||||
error(err)
|
||||
end
|
||||
|
||||
|
||||
-- Flag fields which contain filesystem paths. The context object will
|
||||
-- use this information when expanding tokens, to ensure that the paths
|
||||
@ -357,7 +361,7 @@
|
||||
table.insert(removes, value)
|
||||
|
||||
else
|
||||
local value, err, additional = api.checkvalue(value, field)
|
||||
local value, err, additional = api.checkValue(field, value)
|
||||
if err then
|
||||
error { msg=err }
|
||||
end
|
||||
@ -382,17 +386,21 @@
|
||||
--
|
||||
-- Check to see if a value is valid for a particular field.
|
||||
--
|
||||
-- @param value
|
||||
-- The value to check.
|
||||
-- @param field
|
||||
-- The field to check against.
|
||||
-- @param value
|
||||
-- The value to check.
|
||||
-- @param kind
|
||||
-- The kind of data currently being checked, corresponding to
|
||||
-- one segment of the field's kind string (e.g. "string"). If
|
||||
-- not set, defaults to "string".
|
||||
-- @return
|
||||
-- If the value is valid for this field, the canonical version
|
||||
-- of that value is returned. If the value is not valid two
|
||||
-- values are returned: nil, and an error message.
|
||||
--
|
||||
|
||||
function api.checkvalue(value, field)
|
||||
function api.checkValue(field, value, kind)
|
||||
if not field.allowed then
|
||||
return value
|
||||
end
|
||||
@ -406,7 +414,7 @@
|
||||
|
||||
if not canonical then
|
||||
if type(field.allowed) == "function" then
|
||||
canonical = field.allowed(value)
|
||||
canonical = field.allowed(value, kind or "string")
|
||||
else
|
||||
canonical = field.allowed[lowerValue]
|
||||
end
|
||||
@ -754,7 +762,7 @@
|
||||
|
||||
if value ~= nil then
|
||||
local err
|
||||
value, err = api.checkvalue(value, field)
|
||||
value, err = api.checkValue(field, value)
|
||||
if err then
|
||||
error { msg=err }
|
||||
end
|
||||
|
@ -332,7 +332,9 @@
|
||||
|
||||
values = premake.field.remove(field, {}, values)
|
||||
for i, value in ipairs(values) do
|
||||
values[i] = path.wildcards(value):lower()
|
||||
if type(value) == "string" then
|
||||
values[i] = path.wildcards(value):lower()
|
||||
end
|
||||
end
|
||||
|
||||
-- add a list of removed values to the block
|
||||
|
@ -83,7 +83,7 @@
|
||||
|
||||
-- All fields must have a valid store() function
|
||||
if not field.accessor(f, "store") then
|
||||
error("invalid field kind '" .. f._kind .. "'")
|
||||
return nil, "invalid field kind '" .. f._kind .. "'"
|
||||
end
|
||||
|
||||
field._list[f.name] = f
|
||||
@ -186,8 +186,8 @@
|
||||
end
|
||||
|
||||
-- Split off the first piece from the rest of the kind. If the
|
||||
-- incoming kind is "list:key:string", thisKind will "list" and
|
||||
-- nextKind will be "key:string".
|
||||
-- incoming kind is "list:key:string", thisKind will be "list"
|
||||
-- and nextKind will be "key:string".
|
||||
|
||||
local thisKind = kind:match('(.-):') or kind
|
||||
local nextKind = kind:sub(#thisKind + 2)
|
||||
@ -197,7 +197,7 @@
|
||||
|
||||
local functions = field._kinds[thisKind]
|
||||
if not functions then
|
||||
error("Invalid field kind '" .. thisKind .. "'")
|
||||
return nil, "Invalid field kind '" .. thisKind .. "'"
|
||||
end
|
||||
|
||||
local processor = functions[method]
|
||||
|
@ -441,8 +441,8 @@
|
||||
local architecture = nil
|
||||
|
||||
if platform then
|
||||
system = premake.api.checkvalue(platform, premake.fields.system) or system
|
||||
architecture = premake.api.checkvalue(platform, premake.fields.architecture) or architecture
|
||||
system = premake.api.checkValue(premake.fields.system, platform) or system
|
||||
architecture = premake.api.checkValue(premake.fields.architecture, platform) or architecture
|
||||
end
|
||||
|
||||
-- Wrap the projects's configuration set (which contains all of the information
|
||||
|
@ -167,7 +167,8 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
|
||||
---
|
||||
-- Returns a list of sibling projects on which the specified project depends.
|
||||
-- This is used to list dependencies within a solution or workspace. Must
|
||||
-- consider all configurations because Visual Studio does not support per-config
|
||||
@ -175,11 +176,14 @@
|
||||
--
|
||||
-- @param prj
|
||||
-- The project to query.
|
||||
-- @param linkOnly
|
||||
-- If set, returns only siblings which are linked against (links) and skips
|
||||
-- siblings which are not (dependson).
|
||||
-- @return
|
||||
-- A list of dependent projects, as an array of project objects.
|
||||
--
|
||||
---
|
||||
|
||||
function project.getdependencies(prj)
|
||||
function project.getdependencies(prj, linkOnly)
|
||||
if not prj.dependencies then
|
||||
local result = {}
|
||||
local function add_to_project_list(cfg, depproj, result)
|
||||
@ -193,8 +197,10 @@
|
||||
for _, link in ipairs(cfg.links) do
|
||||
add_to_project_list(cfg, link, result)
|
||||
end
|
||||
for _, depproj in ipairs(cfg.dependson) do
|
||||
add_to_project_list(cfg, depproj, result)
|
||||
if not linkOnly then
|
||||
for _, depproj in ipairs(cfg.dependson) do
|
||||
add_to_project_list(cfg, depproj, result)
|
||||
end
|
||||
end
|
||||
end
|
||||
prj.dependencies = result
|
||||
@ -203,6 +209,7 @@
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns the file name for this project. Also works with solutions.
|
||||
--
|
||||
|
@ -59,15 +59,11 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.projectReferenceAdded_onSiblingProjectDependson()
|
||||
function suite.projectReferenceNotAdded_onSiblingProjectDependson()
|
||||
dependson { "MyProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="MyProject.vcproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
<Name>MyProject</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
@ -72,7 +72,7 @@
|
||||
-- but until I know the conditions, put everything here to be safe.
|
||||
--
|
||||
|
||||
function suite.nothingOutput_onVs2010()
|
||||
function suite.dependency_onCSharpProjectsVs2010()
|
||||
_ACTION = "vs2010"
|
||||
prepare("C#")
|
||||
test.capture [[
|
||||
@ -83,3 +83,19 @@
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Verify dependencies between projects C# are listed for VS2012.
|
||||
--
|
||||
|
||||
function suite.dependency_onCSharpProjectsVs2012()
|
||||
_ACTION = "vs2012"
|
||||
prepare("C#")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AE61726D-187C-E440-BD07-2556188A6565} = {AE61726D-187C-E440-BD07-2556188A6565}
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
||||
|
Reference in New Issue
Block a user