Rename solution to workspace in global.lua and propagate changes
This commit is contained in:
parent
30dbdb5b15
commit
3d778a7151
@ -270,8 +270,8 @@
|
||||
|
||||
function m.postBake()
|
||||
local function shouldLoad(func)
|
||||
for sln in p.global.eachSolution() do
|
||||
for prj in p.solution.eachproject(sln) do
|
||||
for wks in p.global.eachWorkspace() do
|
||||
for prj in p.solution.eachproject(wks) do
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
if func(cfg) then
|
||||
return true
|
||||
|
@ -5,9 +5,10 @@
|
||||
--
|
||||
|
||||
premake.make = {}
|
||||
local make = premake.make
|
||||
local solution = premake.solution
|
||||
local project = premake.project
|
||||
|
||||
local p = premake
|
||||
local make = p.make
|
||||
local project = p.project
|
||||
|
||||
|
||||
---
|
||||
@ -61,7 +62,7 @@
|
||||
|
||||
function make.defaultconfig(target)
|
||||
-- find the right configuration iterator function for this object
|
||||
local eachconfig = iif(target.project, project.eachconfig, solution.eachconfig)
|
||||
local eachconfig = iif(target.project, project.eachconfig, p.workspace.eachconfig)
|
||||
local iter = eachconfig(target)
|
||||
|
||||
-- grab the first configuration and write the block
|
||||
@ -99,7 +100,7 @@
|
||||
|
||||
function make.getmakefilename(this, searchprjs)
|
||||
local count = 0
|
||||
for sln in premake.global.eachSolution() do
|
||||
for sln in p.global.eachWorkspace() do
|
||||
if sln.location == this.location then
|
||||
count = count + 1
|
||||
end
|
||||
|
@ -79,13 +79,13 @@
|
||||
a.onStart()
|
||||
end
|
||||
|
||||
for sln in p.global.eachSolution() do
|
||||
local onSolution = a.onWorkspace or a.onSolution or a.onsolution
|
||||
if onSolution and not sln.external then
|
||||
onSolution(sln)
|
||||
for wks in p.global.eachWorkspace() do
|
||||
local onWorkspace = a.onWorkspace or a.onSolution or a.onsolution
|
||||
if onWorkspace and not wks.external then
|
||||
onWorkspace(wks)
|
||||
end
|
||||
|
||||
for prj in p.solution.eachproject(sln) do
|
||||
for prj in p.solution.eachproject(wks) do
|
||||
local onProject = a.onProject or a.onproject
|
||||
if onProject and not prj.external then
|
||||
onProject(prj)
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
-- global.lua
|
||||
-- The global container holds solutions and rules.
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
-- The global container holds workspaces and rules.
|
||||
-- Copyright (c) 2014-2015 Jason Perkins and the Premake project
|
||||
---
|
||||
|
||||
local p = premake
|
||||
@ -34,17 +34,19 @@
|
||||
|
||||
|
||||
---
|
||||
-- Iterate over the collection of solutions in a session.
|
||||
-- Iterate over the collection of workspaces in a session.
|
||||
--
|
||||
-- @returns
|
||||
-- An iterator function.
|
||||
-- A workspace iterator function.
|
||||
---
|
||||
|
||||
function global.eachSolution()
|
||||
function global.eachWorkspace()
|
||||
local root = p.api.rootContainer()
|
||||
return p.container.eachChild(root, p.solution)
|
||||
return p.container.eachChild(root, p.workspace)
|
||||
end
|
||||
|
||||
p.alias(global, "eachWorkspace", "eachSolution")
|
||||
|
||||
|
||||
|
||||
---
|
||||
@ -90,15 +92,17 @@
|
||||
|
||||
|
||||
---
|
||||
-- Retrieve a solution by name or index.
|
||||
-- Retrieve a workspace by name or index.
|
||||
--
|
||||
-- @param key
|
||||
-- The solution key, either a string name or integer index.
|
||||
-- The workspace key, either a string name or integer index.
|
||||
-- @returns
|
||||
-- The solution with the provided key.
|
||||
-- The workspace with the provided key.
|
||||
---
|
||||
|
||||
function global.getSolution(key)
|
||||
function global.getWorkspace(key)
|
||||
local root = p.api.rootContainer()
|
||||
return root.solutions[key]
|
||||
end
|
||||
|
||||
p.alias(global, "getWorkspace", "getSolution")
|
||||
|
@ -1,12 +1,10 @@
|
||||
--
|
||||
-- tests/actions/make/solution/test_project_rule.lua
|
||||
-- Validate generation of project rules in solution makefile.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.make_project_rule = {}
|
||||
local suite = T.make_project_rule
|
||||
local make = premake.make
|
||||
local suite = test.declare("make_project_rule")
|
||||
|
||||
|
||||
--
|
||||
@ -21,8 +19,8 @@
|
||||
|
||||
local function prepare()
|
||||
premake.oven.bake()
|
||||
sln = premake.global.getSolution(sln.name)
|
||||
make.projectrules(sln)
|
||||
sln = test.getsolution(sln)
|
||||
premake.make.projectrules(sln)
|
||||
end
|
||||
|
||||
|
||||
|
@ -12,10 +12,10 @@
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local sln
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
sln = solution("MySolution")
|
||||
wks = workspace("MyWorkspace")
|
||||
end
|
||||
|
||||
|
||||
@ -24,12 +24,12 @@
|
||||
--
|
||||
|
||||
function suite.solution_createsOnFirstUse()
|
||||
test.isnotnil(premake.global.getSolution("MySolution"))
|
||||
test.isnotnil(premake.global.getWorkspace("MyWorkspace"))
|
||||
end
|
||||
|
||||
function suite.project_createsOnFirstUse()
|
||||
project("MyProject")
|
||||
test.isnotnil(premake.solution.getproject(sln, "MyProject"))
|
||||
test.isnotnil(premake.solution.getproject(wks, "MyProject"))
|
||||
end
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
--
|
||||
|
||||
function suite.solution_setsActiveScope()
|
||||
test.issame(api.scope.solution, sln)
|
||||
test.issame(api.scope.solution, wks)
|
||||
end
|
||||
|
||||
function suite.project_setsActiveScope()
|
||||
@ -56,7 +56,7 @@
|
||||
project("MyProject")
|
||||
group("MyGroup")
|
||||
solution()
|
||||
test.issame(sln, api.scope.solution)
|
||||
test.issame(wks, api.scope.solution)
|
||||
test.isnil(api.scope.project)
|
||||
test.isnil(api.scope.group)
|
||||
end
|
||||
@ -88,6 +88,6 @@
|
||||
group("MyGroup")
|
||||
filter("Debug")
|
||||
project "*"
|
||||
test.issame(sln, api.scope.solution)
|
||||
test.issame(wks, api.scope.solution)
|
||||
test.isnil(api.scope.project)
|
||||
end
|
||||
|
@ -272,8 +272,8 @@
|
||||
|
||||
|
||||
function test.getsolution(sln)
|
||||
premake.oven.bake()
|
||||
return premake.global.getSolution(sln.name)
|
||||
p.oven.bake()
|
||||
return p.global.getWorkspace(sln.name)
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user