added a buildinput command to add additional input dependencies to custom build commands.
This commit is contained in:
parent
ee305d4ff1
commit
4e7dc976ba
@ -114,6 +114,13 @@
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "buildinputs",
|
||||
scope = "config",
|
||||
kind = "list:path",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "buildrule", -- DEPRECATED
|
||||
scope = "config",
|
||||
|
@ -656,6 +656,11 @@
|
||||
if filecfg.buildmessage then
|
||||
m.element("Message", condition, '%s', filecfg.buildmessage)
|
||||
end
|
||||
|
||||
if filecfg.buildinputs and #filecfg.buildinputs > 0 then
|
||||
local inputs = project.getrelative(prj, filecfg.buildinputs)
|
||||
m.element("AdditionalInputs", condition, '%s', table.concat(inputs, " "))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -115,6 +115,28 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuild_onBuildRuleWithAdditionalInputs()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
buildinputs { "common.cg.inc" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">common.cg.inc</AdditionalInputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">common.cg.inc</AdditionalInputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a PCH source is specified, ensure it is included in the file configuration.
|
||||
|
Reference in New Issue
Block a user