Custom Rule fixes.
This commit is contained in:
parent
7b712d7ce3
commit
8b7b4c1139
@ -31,6 +31,7 @@
|
|||||||
["file.basename"] = { absolute = false, token = "%(Filename)" },
|
["file.basename"] = { absolute = false, token = "%(Filename)" },
|
||||||
["file.abspath"] = { absolute = true, token = "%(FullPath)" },
|
["file.abspath"] = { absolute = true, token = "%(FullPath)" },
|
||||||
["file.relpath"] = { absolute = false, token = "%(Identity)" },
|
["file.relpath"] = { absolute = false, token = "%(Identity)" },
|
||||||
|
["file.path"] = { absolute = true, token = "%(RelativeDir)" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,6 @@
|
|||||||
return {
|
return {
|
||||||
m.propertyDefaults,
|
m.propertyDefaults,
|
||||||
m.commandLineTemplates,
|
m.commandLineTemplates,
|
||||||
m.outputs,
|
|
||||||
m.executionDescription,
|
m.executionDescription,
|
||||||
m.additionalDependencies,
|
m.additionalDependencies,
|
||||||
}
|
}
|
||||||
@ -144,18 +143,18 @@
|
|||||||
|
|
||||||
|
|
||||||
function m.commandLineTemplates(r)
|
function m.commandLineTemplates(r)
|
||||||
if #r.buildcommands then
|
-- create shadow context.
|
||||||
|
local env = p.rule.createEnvironment(r, "[%s]")
|
||||||
|
local ctx = p.context.extent(r, env)
|
||||||
|
|
||||||
-- create shadow context.
|
-- now use the shadow context to detoken.
|
||||||
local env = p.rule.createEnvironment(r, "[%s]")
|
local buildcommands = ctx.buildcommands
|
||||||
local ctx = p.context.extent(r, env)
|
|
||||||
|
|
||||||
-- now use the shadow context to detoken.
|
-- write out the result.
|
||||||
local cmds = os.translateCommands(ctx.buildcommands, p.WINDOWS)
|
if buildcommands and #buildcommands > 0 then
|
||||||
|
local cmds = os.translateCommands(buildcommands, p.WINDOWS)
|
||||||
-- write out the result.
|
|
||||||
cmds = table.concat(cmds, p.eol())
|
cmds = table.concat(cmds, p.eol())
|
||||||
p.x('<CommandLineTemplate>%s</CommandLineTemplate>', cmds)
|
p.x('<CommandLineTemplate>@echo off\n%s</CommandLineTemplate>', cmds)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -170,28 +169,16 @@
|
|||||||
|
|
||||||
|
|
||||||
function m.executionDescription(r)
|
function m.executionDescription(r)
|
||||||
if r.buildmessage then
|
-- create shadow context.
|
||||||
-- create shadow context.
|
local env = p.rule.createEnvironment(r, "%%(%s)")
|
||||||
local env = p.rule.createEnvironment(r, "[%s]")
|
local ctx = p.context.extent(r, env)
|
||||||
local ctx = p.context.extent(r, env)
|
|
||||||
|
|
||||||
-- write out the result.
|
-- now use the shadow context to detoken.
|
||||||
p.x('<ExecutionDescription>%s</ExecutionDescription>', ctx.buildmessage)
|
local buildmessage = ctx.buildmessage
|
||||||
|
|
||||||
|
-- write out the result.
|
||||||
|
if buildmessage and #buildmessage > 0 then
|
||||||
|
p.x('<ExecutionDescription>%s</ExecutionDescription>', buildmessage)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function m.outputs(r)
|
|
||||||
if #r.buildoutputs then
|
|
||||||
-- create shadow context.
|
|
||||||
local pathVars = p.rule.createPathVars(r, "%%(%s)")
|
|
||||||
local ctx = p.context.extent(r, { pathVars = pathVars })
|
|
||||||
|
|
||||||
-- now use the shadow context to detoken.
|
|
||||||
local outputs = table.concat(ctx.buildoutputs, ";")
|
|
||||||
|
|
||||||
-- write out the result.
|
|
||||||
p.x('<Outputs>%s</Outputs>', path.translate(outputs))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
return {
|
return {
|
||||||
p.vstudio.projectElement,
|
p.vstudio.projectElement,
|
||||||
m.availableItemGroup,
|
m.availableItemGroup,
|
||||||
|
m.computedProperties,
|
||||||
m.computeInputsGroup,
|
m.computeInputsGroup,
|
||||||
m.usingTask,
|
m.usingTask,
|
||||||
m.ruleTarget,
|
m.ruleTarget,
|
||||||
@ -54,6 +55,29 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Generate the computed outputs property.
|
||||||
|
---
|
||||||
|
function m.computedProperties(r)
|
||||||
|
-- create shadow context.
|
||||||
|
local pathVars = p.rule.createPathVars(r, "%%(%s)")
|
||||||
|
local ctx = p.context.extent(r, { pathVars = pathVars })
|
||||||
|
|
||||||
|
-- now use the shadow context to detoken.
|
||||||
|
local buildoutputs = ctx.buildoutputs
|
||||||
|
|
||||||
|
-- write the output.
|
||||||
|
if buildoutputs and #buildoutputs > 0 then
|
||||||
|
local outputs = table.concat(buildoutputs, ";")
|
||||||
|
p.push('<ItemDefinitionGroup>')
|
||||||
|
p.push('<%s>', r.name)
|
||||||
|
p.x('<Outputs>%s</Outputs>', path.translate(outputs))
|
||||||
|
p.pop('</%s>', r.name)
|
||||||
|
p.pop('</ItemDefinitionGroup>')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Generate the computed input targets group.
|
-- Generate the computed input targets group.
|
||||||
@ -277,12 +301,19 @@
|
|||||||
|
|
||||||
|
|
||||||
function m.linkLib(r)
|
function m.linkLib(r)
|
||||||
|
-- create shadow context.
|
||||||
|
local pathVars = p.rule.createPathVars(r, "%%(%s)")
|
||||||
|
local ctx = p.context.extent(r, { pathVars = pathVars })
|
||||||
|
|
||||||
|
-- now use the shadow context to detoken.
|
||||||
|
local buildoutputs = ctx.buildoutputs
|
||||||
|
|
||||||
local linkable, compileable
|
local linkable, compileable
|
||||||
for i = 1, #r.buildoutputs do
|
for i = 1, #buildoutputs do
|
||||||
if (path.islinkable(r.buildoutputs[i])) then
|
if (path.islinkable(buildoutputs[i])) then
|
||||||
linkable = true
|
linkable = true
|
||||||
end
|
end
|
||||||
if (path.iscppfile(r.buildoutputs[i])) then
|
if (path.iscppfile(buildoutputs[i])) then
|
||||||
compileable = true
|
compileable = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -314,7 +345,7 @@
|
|||||||
p.w('<Message')
|
p.w('<Message')
|
||||||
p.w(' Importance="High"')
|
p.w(' Importance="High"')
|
||||||
p.w(' Text="%%(%s.ExecutionDescription)" />', r.name)
|
p.w(' Text="%%(%s.ExecutionDescription)" />', r.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -326,13 +357,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function m.properties(r)
|
function m.properties(r)
|
||||||
local defs = r.propertydefinition
|
local defs = r.propertydefinition
|
||||||
for i = 1, #defs do
|
for i = 1, #defs do
|
||||||
local name = defs[i].name
|
local name = defs[i].name
|
||||||
p.w('%s="%%(%s.%s)"', name, r.name, name)
|
p.w('%s="%%(%s.%s)"', name, r.name, name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user