Add opening XML and project elements to rule files; consolidate common code
This commit is contained in:
parent
9230abc637
commit
67582066a0
@ -6,9 +6,11 @@
|
||||
|
||||
premake.vstudio = {}
|
||||
local vstudio = premake.vstudio
|
||||
local solution = premake.solution
|
||||
local project = premake.project
|
||||
local config = premake.config
|
||||
|
||||
local p = premake
|
||||
local solution = p.solution
|
||||
local project = p.project
|
||||
local config = p.config
|
||||
|
||||
|
||||
--
|
||||
@ -368,6 +370,16 @@
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Generates a Visual Studio project element for the current action.
|
||||
---
|
||||
|
||||
function vstudio.projectElement()
|
||||
p.push('<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns the full, absolute path to the Visual Studio project file
|
||||
-- corresponding to a particular project object.
|
||||
@ -563,3 +575,4 @@
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -467,7 +467,7 @@
|
||||
|
||||
function cs2005.xmlDeclaration()
|
||||
if _ACTION > "vs2008" then
|
||||
_p('<?xml version="1.0" encoding="utf-8"?>')
|
||||
p.xmlUtf8()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
--
|
||||
|
||||
function cs2005.generate_user(prj)
|
||||
_p('<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
|
||||
vstudio.projectElement()
|
||||
_p(1,'<PropertyGroup>')
|
||||
|
||||
-- Per-configuration reference paths aren't supported (are they?) so just
|
||||
|
@ -5,14 +5,23 @@
|
||||
--
|
||||
|
||||
premake.vstudio.rules = {}
|
||||
|
||||
local p = premake
|
||||
local project = p.project
|
||||
local tree = p.tree
|
||||
|
||||
local m = premake.vstudio.rules
|
||||
|
||||
local p = premake
|
||||
|
||||
m.elements = {}
|
||||
|
||||
|
||||
|
||||
m.elements.ruleProps = function(rule)
|
||||
return {
|
||||
p.xmlUtf8,
|
||||
p.vstudio.projectElement,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateRuleProps(rule)
|
||||
p.callArray(m.elements.ruleProps, rule)
|
||||
p.pop()
|
||||
p.out('</Project>')
|
||||
end
|
||||
|
@ -4,13 +4,20 @@
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local project = p.project
|
||||
local tree = p.tree
|
||||
|
||||
local m = premake.vstudio.rules
|
||||
|
||||
local p = premake
|
||||
|
||||
|
||||
m.elements.ruleTargets = function(rule)
|
||||
return {
|
||||
p.xmlUtf8,
|
||||
p.vstudio.projectElement,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateRuleTargets(rule)
|
||||
p.callArray(m.elements.ruleTargets)
|
||||
p.pop()
|
||||
p.out('</Project>')
|
||||
end
|
||||
|
@ -4,13 +4,19 @@
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local m = premake.vstudio.rules
|
||||
|
||||
local p = premake
|
||||
local project = p.project
|
||||
local tree = p.tree
|
||||
|
||||
local m = premake.vstudio.rules
|
||||
|
||||
|
||||
m.elements.ruleXml = function(rule)
|
||||
return {
|
||||
p.xmlUtf8,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateRuleXml(rule)
|
||||
p.callArray(m.elements.ruleXml, rule)
|
||||
end
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
function m.generate(prj)
|
||||
io.utf8()
|
||||
m.xmlDeclaration()
|
||||
p.xmlUtf8()
|
||||
m.project("Build")
|
||||
p.callArray(m.elements.project, prj)
|
||||
p.out('</Project>')
|
||||
@ -1529,11 +1529,6 @@
|
||||
end
|
||||
|
||||
|
||||
function m.xmlDeclaration()
|
||||
_p('<?xml version="1.0" encoding="utf-8"?>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
--
|
||||
|
@ -462,6 +462,18 @@ end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Write a opening XML element for a UTF-8 encoded file. Used by
|
||||
-- several different files for different actions, so makes sense
|
||||
-- to have a common call for it.
|
||||
---
|
||||
|
||||
function premake.xmlUtf8()
|
||||
premake.w('<?xml version="1.0" encoding="utf-8"?>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- These are the output shortcuts that I used before switching to the
|
||||
-- indentation-aware calls above. They are still in use all over the
|
||||
|
Reference in New Issue
Block a user