Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow files to be marked as Visual C++ deployment content #139

Merged
merged 1 commit into from
Mar 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions src/actions/vstudio/vs2010_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@
None = {},
ResourceCompile = {},
AppxManifest = {},
Image = {}
Image = {},
DeploymentContent = {}
}

local foundAppxManifest = false
Expand All @@ -566,14 +567,13 @@
end
elseif path.isresourcefile(file.name) then
table.insert(sortedfiles.ResourceCompile, file)
elseif path.isappxmanifest(file.name) then
foundAppxManifest = true
table.insert(sortedfiles.AppxManifest, file)
elseif file.flags and table.icontains(file.flags, "DeploymentContent") then
table.insert(sortedfiles.DeploymentContent, file)
else
local ext = path.getextension(file.name):lower()
if ext == ".appxmanifest" then
foundAppxManifest = true
table.insert(sortedfiles.AppxManifest, file)
else
table.insert(sortedfiles.None, file)
end
table.insert(sortedfiles.None, file)
end
end

Expand Down Expand Up @@ -613,6 +613,7 @@
vc2010.simplefilesgroup(prj, "ResourceCompile")
vc2010.simplefilesgroup(prj, "AppxManifest")
vc2010.deploymentcontentgroup(prj, "Image")
vc2010.deploymentcontentgroup(prj, "DeploymentContent", "None")
end

function vc2010.customtaskgroup(prj)
Expand Down Expand Up @@ -683,14 +684,20 @@
end
end

function vc2010.deploymentcontentgroup(prj, section)
function vc2010.deploymentcontentgroup(prj, section, filetype)
if filetype == nil then
filetype = section
end

local files = vc2010.getfilegroup(prj, section)
if #files > 0 then
_p(1,'<ItemGroup>')
for _, file in ipairs(files) do
_p(2,'<%s Include=\"%s\">', section, path.translate(file.name, "\\"))
_p(2,'<%s Include=\"%s\">', filetype, path.translate(file.name, "\\"))

_p(3,'<DeploymentContent>true</DeploymentContent>')
_p(2,'</%s>', section)
_p(3,'<Link>%s</Link>', path.translate(file.vpath, "\\"))
_p(2,'</%s>', filetype)
end
_p(1,'</ItemGroup>')
end
Expand Down
16 changes: 12 additions & 4 deletions src/actions/vstudio/vs2010_vcxproj_filters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,13 @@
-- "ResourceCompile", or "None".
--

function vc2010.filefiltergroup(prj, section)
function vc2010.filefiltergroup(prj, section, kind)
local files = vc2010.getfilegroup(prj, section) or {}

if kind == nill then
kind = section
end

if (section == "CustomBuild") then
for _, custombuildtask in ipairs(prj.custombuildtask or {}) do
for _, buildtask in ipairs(custombuildtask or {}) do
Expand All @@ -105,11 +110,11 @@
end

if filter ~= "." then
_p(2,'<%s Include=\"%s\">', section, path.translate(file.name, "\\"))
_p(2,'<%s Include=\"%s\">', kind, path.translate(file.name, "\\"))
_p(3,'<Filter>%s</Filter>', path.translate(filter, "\\"))
_p(2,'</%s>', section)
_p(2,'</%s>', kind)
else
_p(2,'<%s Include=\"%s\" />', section, path.translate(file.name, "\\"))
_p(2,'<%s Include=\"%s\" />', kind, path.translate(file.name, "\\"))
end
end
_p(1,'</ItemGroup>')
Expand All @@ -130,5 +135,8 @@
vc2010.filefiltergroup(prj, "ClCompile")
vc2010.filefiltergroup(prj, "ResourceCompile")
vc2010.filefiltergroup(prj, "CustomBuild")
vc2010.filefiltergroup(prj, "AppxManifest")
vc2010.filefiltergroup(prj, "Image")
vc2010.filefiltergroup(prj, "DeploymentContent", "None")
_p('</Project>')
end
1 change: 1 addition & 0 deletions src/base/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
ATL = 1,
DebugEnvsDontMerge = 1,
DebugEnvsInherit = 1,
DeploymentContent = 1,
EnableMinimalRebuild = 1,
EnableSSE = 1,
EnableSSE2 = 1,
Expand Down
5 changes: 5 additions & 0 deletions src/base/path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@
return table.contains(extensions, ext)
end

function path.isappxmanifest(fname)
local extensions = { ".appxmanifest" }
local ext = path.getextension(fname):lower()
return table.contains(extensions, ext)
end


--
Expand Down