From 3d778a715153edcee2fc20fd72324367d495774a Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Mon, 10 Aug 2015 13:05:26 -0400 Subject: [PATCH 1/4] Rename solution to workspace in global.lua and propagate changes --- src/_premake_main.lua | 4 ++-- src/actions/make/_make.lua | 11 +++++---- src/base/action.lua | 10 ++++---- src/base/global.lua | 24 +++++++++++-------- .../make/solution/test_project_rule.lua | 10 ++++---- tests/api/test_containers.lua | 14 +++++------ tests/testfx.lua | 4 ++-- 7 files changed, 40 insertions(+), 37 deletions(-) diff --git a/src/_premake_main.lua b/src/_premake_main.lua index 355aebd2..b57a375f 100644 --- a/src/_premake_main.lua +++ b/src/_premake_main.lua @@ -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 diff --git a/src/actions/make/_make.lua b/src/actions/make/_make.lua index 9b4eb5f8..c2c4aebb 100644 --- a/src/actions/make/_make.lua +++ b/src/actions/make/_make.lua @@ -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 diff --git a/src/base/action.lua b/src/base/action.lua index 3758967f..d1d184e0 100644 --- a/src/base/action.lua +++ b/src/base/action.lua @@ -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) diff --git a/src/base/global.lua b/src/base/global.lua index 84632452..4004d874 100644 --- a/src/base/global.lua +++ b/src/base/global.lua @@ -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") diff --git a/tests/actions/make/solution/test_project_rule.lua b/tests/actions/make/solution/test_project_rule.lua index ac607a40..06e47f55 100644 --- a/tests/actions/make/solution/test_project_rule.lua +++ b/tests/actions/make/solution/test_project_rule.lua @@ -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 diff --git a/tests/api/test_containers.lua b/tests/api/test_containers.lua index 367bd9ae..32fd1af6 100644 --- a/tests/api/test_containers.lua +++ b/tests/api/test_containers.lua @@ -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 diff --git a/tests/testfx.lua b/tests/testfx.lua index 6b53afb0..5d3ca26e 100644 --- a/tests/testfx.lua +++ b/tests/testfx.lua @@ -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 From 1eb38c9fc143a09f5976f3360e4dcf7f92830f33 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 11 Aug 2015 16:31:17 -0400 Subject: [PATCH 2/4] Rename solution to workspace in oven and validation code --- src/base/oven.lua | 90 ++++++++++--------- src/base/validation.lua | 8 +- src/base/workspace.lua | 4 +- .../actions/make/solution/test_group_rule.lua | 7 +- .../actions/make/solution/test_help_rule.lua | 10 +-- .../vstudio/sln2005/test_platforms.lua | 2 +- tests/oven/test_filtering.lua | 5 +- tests/solution/test_location.lua | 4 +- 8 files changed, 66 insertions(+), 64 deletions(-) diff --git a/src/base/oven.lua b/src/base/oven.lua index 4ec2ea69..9148ed28 100644 --- a/src/base/oven.lua +++ b/src/base/oven.lua @@ -1,7 +1,7 @@ -- -- base/oven.lua -- --- Process the solutions, projects, and configurations that were specified +-- Process the workspaces, projects, and configurations that were specified -- by the project script, and make them suitable for use by the exporters -- and actions. Fills in computed values (e.g. object directories) and -- optimizes the layout of the data for faster fetches. @@ -39,24 +39,26 @@ -- -- This call replaces the existing the container objects with their -- processed replacements. If you are using the provided container APIs --- (p.global.*, p.solution.*, etc.) this will be transparent. +-- (p.global.*, p.workspace.*, etc.) this will be transparent. --- function oven.bake() p.container.bakeChildren(p.api.rootContainer()) end - function oven.bakeSolution(sln) - return p.container.bake(sln) + function oven.bakeWorkspace(wks) + return p.container.bake(wks) end + p.alias(oven, "bakeWorkspace", "bakeSolution") + --- --- Bakes a specific solution object. +-- Bakes a specific workspace object. --- - function p.solution.bake(self) + function p.workspace.bake(self) -- Add filtering terms to the context and then compile the results. These -- terms describe the "operating environment"; only results contained by -- configuration blocks which match these terms will be returned. @@ -83,31 +85,31 @@ -- Set up my token expansion environment self.environ = { - sln = self, wks = self, + sln = self, } context.compile(self) - -- Specify the solution's file system location; when path tokens are - -- expanded in solution values, they will be made relative to this. + -- Specify the workspaces's file system location; when path tokens are + -- expanded in workspace values, they will be made relative to this. self.location = self.location or self.basedir context.basedir(self, self.location) - -- Now bake down all of the projects contained in the solution, and + -- Now bake down all of the projects contained in the workspace, and -- store that for future reference p.container.bakeChildren(self) -- I now have enough information to assign unique object directories - -- to each project configuration in the solution. + -- to each project configuration in the workspace. oven.bakeObjDirs(self) -- Build a master list of configuration/platform pairs from all of the - -- projects contained by the solution; I will need this when generating - -- solution files in order to provide a map from solution configurations + -- projects contained by the workspace; I will need this when generating + -- workspace files in order to provide a map from workspace configurations -- to project configurations. self.configs = oven.bakeConfigs(self) @@ -116,12 +118,13 @@ function p.project.bake(self) - local sln = self.solution + self.workspace = self.solution + local wks = self.workspace -- Add filtering terms to the context to make it as specific as I can. - -- Start with the same filtering that was applied at the solution level. + -- Start with the same filtering that was applied at the workspace level. - context.copyFilters(self, sln) + context.copyFilters(self, wks) -- Now filter on the current system and architecture, allowing the -- values that might already in the context to override my defaults. @@ -142,8 +145,8 @@ -- Populate the token expansion environment self.environ = { - sln = sln, - wks = sln, + wks = wks, + sln = wks, prj = self, } @@ -157,11 +160,11 @@ -- location. Any path tokens which are expanded in non-path fields -- are made relative to this, ensuring a portable generated project. - self.location = self.location or sln.location or self.basedir + self.location = self.location or wks.location or self.basedir context.basedir(self, self.location) -- This bit could use some work: create a canonical set of configurations - -- for the project, along with a mapping from the solution's configurations. + -- for the project, along with a mapping from the workspace's configurations. -- This works, but it could probably be simplified. local cfgs = table.fold(self.configurations or {}, self.platforms or {}) @@ -181,7 +184,7 @@ for _, pairing in ipairs(self._cfglist) do local buildcfg = pairing[1] local platform = pairing[2] - local cfg = oven.bakeConfig(sln, self, buildcfg, platform) + local cfg = oven.bakeConfig(wks, self, buildcfg, platform) if premake.action.supportsconfig(premake.action.current(), cfg) then self.configs[(buildcfg or "*") .. (platform or "")] = cfg @@ -217,7 +220,7 @@ -- -- Assigns a unique objects directory to every configuration of every project --- in the solution, taking any objdir settings into account, to ensure builds +-- in the workspace, taking any objdir settings into account, to ensure builds -- from different configurations won't step on each others' object files. -- The path is built from these choices, in order: -- @@ -226,11 +229,11 @@ -- [3] -> [2] + the build configuration name -- [4] -> [3] + the project name -- --- @param sln --- The solution to process. The directories are modified inline. +-- @param wks +-- The workspace to process. The directories are modified inline. -- - function oven.bakeObjDirs(sln) + function oven.bakeObjDirs(wks) -- function to compute the four options for a specific configuration local function getobjdirs(cfg) -- the "!" prefix indicates the directory is not to be touched @@ -260,12 +263,12 @@ return dirs end - -- walk all of the configs in the solution, and count the number of + -- walk all of the configs in the workspace, and count the number of -- times each obj dir gets used local counts = {} local configs = {} - for prj in p.solution.eachproject(sln) do + for prj in p.workspace.eachproject(wks) do for cfg in p.project.eachconfig(prj) do -- get the dirs for this config, and associate them together, -- and increment a counter for each one discovered @@ -292,18 +295,18 @@ -- --- Create a list of solution-level build configuration/platform pairs. +-- Create a list of workspace-level build configuration/platform pairs. -- - function oven.bakeConfigs(sln) - local buildcfgs = sln.configurations or {} - local platforms = sln.platforms or {} + function oven.bakeConfigs(wks) + local buildcfgs = wks.configurations or {} + local platforms = wks.platforms or {} local configs = {} local pairings = table.fold(buildcfgs, platforms) for _, pairing in ipairs(pairings) do - local cfg = oven.bakeConfig(sln, nil, pairing[1], pairing[2]) + local cfg = oven.bakeConfig(wks, nil, pairing[1], pairing[2]) if premake.action.supportsconfig(premake.action.current(), cfg) then table.insert(configs, cfg) end @@ -364,7 +367,7 @@ -- -- Builds a list of build configuration/platform pairs for a project, --- along with a mapping between the solution and project configurations. +-- along with a mapping between the workspace and project configurations. -- -- @param ctx -- The project context information. @@ -407,8 +410,8 @@ -- Flattens out the build settings for a particular build configuration and -- platform pairing, and returns the result. -- --- @param sln --- The solution which contains the configuration data. +-- @param wks +-- The workpace which contains the configuration data. -- @param prj -- The project which contains the configuration data. Can be nil. -- @param buildcfg @@ -420,7 +423,7 @@ -- this configuration --- - function oven.bakeConfig(sln, prj, buildcfg, platform, extraFilters) + function oven.bakeConfig(wks, prj, buildcfg, platform, extraFilters) -- Set the default system and architecture values; if the platform's -- name matches a known system or architecture, use that as the default. @@ -441,15 +444,16 @@ -- values are used when expanding tokens. local environ = { - sln = sln, - wks = sln, + wks = wks, + sln = wks, prj = prj, } - local ctx = context.new(prj or sln, environ) + local ctx = context.new(prj or wks, environ) ctx.project = prj - ctx.solution = sln + ctx.workspace = wks + ctx.solution = wks ctx.buildcfg = buildcfg ctx.platform = platform ctx.action = _ACTION @@ -462,10 +466,10 @@ -- Add filtering terms to the context and then compile the results. These -- terms describe the "operating environment"; only results contained by -- configuration blocks which match these terms will be returned. Start - -- by copying over the top-level environment from the solution. Don't + -- by copying over the top-level environment from the workspace. Don't -- copy the project terms though, so configurations can override those. - context.copyFilters(ctx, sln) + context.copyFilters(ctx, wks) context.addFilter(ctx, "configurations", buildcfg) context.addFilter(ctx, "platforms", platform) @@ -603,7 +607,7 @@ -- --- Finish the baking process for a solution or project level configurations. +-- Finish the baking process for a workspace or project level configurations. -- Doesn't bake per se, just fills in some calculated values. -- diff --git a/src/base/validation.lua b/src/base/validation.lua index 965dbd19..fe1758ce 100644 --- a/src/base/validation.lua +++ b/src/base/validation.lua @@ -22,18 +22,18 @@ --- --- Validate a solution and its projects. +-- Validate a workspace and its projects. --- - function p.solution.validate(self) + function p.workspace.validate(self) -- there must be at least one build configuration if not self.configurations or #self.configurations == 0 then - p.error("solution '%s' does not contain any configurations", self.name) + p.error("workspace '%s' does not contain any configurations", self.name) end -- all project UUIDs must be unique local uuids = {} - for prj in p.solution.eachproject(self) do + for prj in p.workspace.eachproject(self) do if uuids[prj.uuid] then p.error("projects '%s' and '%s' have the same UUID", uuids[prj.uuid], prj.name) end diff --git a/src/base/workspace.lua b/src/base/workspace.lua index e5745bfd..54462acf 100644 --- a/src/base/workspace.lua +++ b/src/base/workspace.lua @@ -39,7 +39,7 @@ -- function workspace.eachconfig(self) - self = premake.oven.bakeSolution(self) + self = p.oven.bakeWorkspace(self) local i = 0 return function() @@ -135,7 +135,7 @@ -- function workspace.getproject(self, idx) - self = p.oven.bakeSolution(self) + self = p.oven.bakeWorkspace(self) return self.projects[idx] end diff --git a/tests/actions/make/solution/test_group_rule.lua b/tests/actions/make/solution/test_group_rule.lua index c084ad7f..17b24013 100644 --- a/tests/actions/make/solution/test_group_rule.lua +++ b/tests/actions/make/solution/test_group_rule.lua @@ -1,11 +1,10 @@ -- -- tests/actions/make/solution/test_group_rule.lua -- Validate generation of group rules --- Copyright (c) 2012-2014 Jason Perkins and the Premake project +-- Copyright (c) 2012-2015 Jason Perkins and the Premake project -- - T.make_group_rule = {} - local suite = T.make_group_rule + local suite = test.declare("make_group_rule") local make = premake.make @@ -27,7 +26,7 @@ end local function prepare() - sln = premake.oven.bakeSolution(sln) + sln = test.getsolution(sln) end diff --git a/tests/actions/make/solution/test_help_rule.lua b/tests/actions/make/solution/test_help_rule.lua index 8693ea5e..af8f100d 100644 --- a/tests/actions/make/solution/test_help_rule.lua +++ b/tests/actions/make/solution/test_help_rule.lua @@ -1,12 +1,10 @@ -- -- tests/actions/make/test_help_rule.lua -- Validate generation of help rule and configurations list. --- Copyright (c) 2012-2013 Jason Perkins and the Premake project +-- Copyright (c) 2012-2015 Jason Perkins and the Premake project -- - T.make_help_rule = {} - local suite = T.make_help_rule - local make = premake.make + local suite = test.declare("make_help_rule") -- @@ -20,8 +18,8 @@ end local function prepare() - sln = premake.oven.bakeSolution(sln) - make.helprule(sln) + sln = test.getsolution(sln) + premake.make.helprule(sln) end diff --git a/tests/actions/vstudio/sln2005/test_platforms.lua b/tests/actions/vstudio/sln2005/test_platforms.lua index babfc61a..ae013dfa 100644 --- a/tests/actions/vstudio/sln2005/test_platforms.lua +++ b/tests/actions/vstudio/sln2005/test_platforms.lua @@ -24,7 +24,7 @@ local function prepare(lang) filter {} uuid "C9135098-6047-8142-B10E-D27E7F73FCB3" - sln = premake.oven.bakeSolution(sln) + sln = test.getsolution(sln) sln2005.configurationPlatforms(sln) end diff --git a/tests/oven/test_filtering.lua b/tests/oven/test_filtering.lua index e71ea256..56a855d1 100644 --- a/tests/oven/test_filtering.lua +++ b/tests/oven/test_filtering.lua @@ -10,6 +10,7 @@ local sln, prj + -- -- Setup -- @@ -19,8 +20,8 @@ end local function prepare() - sln = oven.bakeSolution(sln) - prj = solution.getproject(sln, 1) + sln = test.getsolution(sln) + prj = test.getproject(sln, 1) end diff --git a/tests/solution/test_location.lua b/tests/solution/test_location.lua index 9ad26ecc..3c1bae5a 100644 --- a/tests/solution/test_location.lua +++ b/tests/solution/test_location.lua @@ -1,7 +1,7 @@ -- -- tests/solution/test_location.lua -- Test handling of the solution's location field. --- Copyright (c) 2013 Jason Perkins and the Premake project +-- Copyright (c) 2013-2015 Jason Perkins and the Premake project -- local suite = test.declare("solution_location") @@ -18,7 +18,7 @@ end local function prepare() - sln = premake.oven.bakeSolution(sln) + sln = test.getsolution(sln) end From bf3e68287c2ffb4297f8dec49a39772e860f0faf Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Wed, 12 Aug 2015 14:53:12 -0400 Subject: [PATCH 3/4] More easy solution to workspace renames --- src/_premake_main.lua | 2 +- src/actions/make/_make.lua | 16 +++++----- src/actions/make/make_solution.lua | 42 ++++++++++++------------- src/actions/vstudio/_vstudio.lua | 5 ++- src/actions/vstudio/vs2005.lua | 2 +- src/actions/vstudio/vs2005_solution.lua | 27 ++++++++-------- src/actions/vstudio/vs2008.lua | 2 +- src/actions/vstudio/vs200x_vcproj.lua | 6 ++-- src/actions/vstudio/vs2010.lua | 3 +- src/actions/vstudio/vs2012.lua | 2 +- src/actions/vstudio/vs2013.lua | 2 +- src/actions/vstudio/vs2015.lua | 2 +- src/base/action.lua | 2 +- src/base/api.lua | 20 ++++++------ src/base/config.lua | 4 +-- src/base/container.lua | 2 +- src/base/group.lua | 2 +- src/base/premake.lua | 15 +++------ src/base/project.lua | 14 ++++----- 19 files changed, 83 insertions(+), 87 deletions(-) diff --git a/src/_premake_main.lua b/src/_premake_main.lua index b57a375f..527687ed 100644 --- a/src/_premake_main.lua +++ b/src/_premake_main.lua @@ -271,7 +271,7 @@ function m.postBake() local function shouldLoad(func) for wks in p.global.eachWorkspace() do - for prj in p.solution.eachproject(wks) do + for prj in p.workspace.eachproject(wks) do for cfg in p.project.eachconfig(prj) do if func(cfg) then return true diff --git a/src/actions/make/_make.lua b/src/actions/make/_make.lua index c2c4aebb..478ecf0a 100644 --- a/src/actions/make/_make.lua +++ b/src/actions/make/_make.lua @@ -55,9 +55,10 @@ -- --- Write out the default configuration rule for a solution or project. +-- Write out the default configuration rule for a workspace or project. +-- -- @param target --- The solution or project object for which a makefile is being generated. +-- The workspace or project object for which a makefile is being generated. -- function make.defaultconfig(target) @@ -93,7 +94,7 @@ -- --- Get the makefile file name for a solution or a project. If this object is the +-- Get the makefile file name for a workspace or a project. If this object is the -- only one writing to a location then I can use "Makefile". If more than one object -- writes to the same location I use name + ".make" to keep it unique. -- @@ -126,17 +127,16 @@ -- Output a makefile header. -- -- @param target --- The solution or project object for which the makefile is being generated. +-- The workspace or project object for which the makefile is being generated. -- function make.header(target) - -- find the right configuration iterator function for this object - local kind = iif(target.project, "project", "solution") + local kind = iif(target.project, "project", "workspace") _p('# %s %s makefile autogenerated by Premake', premake.action.current().shortname, kind) _p('') - if kind == "solution" then + if kind == "workspace" then _p('.NOTPARALLEL:') _p('') end @@ -152,7 +152,7 @@ -- -- Rules for file ops based on the shell type. Can't use defines and $@ because --- it screws up the escaping of spaces and parethesis (anyone know a solution?) +-- it screws up the escaping of spaces and parethesis (anyone know a fix?) -- function make.mkdirRules(dirname) diff --git a/src/actions/make/make_solution.lua b/src/actions/make/make_solution.lua index 5a375155..6e62b5ff 100644 --- a/src/actions/make/make_solution.lua +++ b/src/actions/make/make_solution.lua @@ -1,17 +1,17 @@ -- --- make_solution.lua --- Generate a solution-level makefile. --- Copyright (c) 2002-2012 Jason Perkins and the Premake project +-- make_workspace.lua +-- Generate a workspace-level makefile. +-- Copyright (c) 2002-2015 Jason Perkins and the Premake project -- - local make = premake.make - local solution = premake.solution - local tree = premake.tree - local project = premake.project + local p = premake + local make = p.make + local tree = p.tree + local project = p.project -- --- Generate a GNU make "solution" makefile, with support for the new platforms API. +-- Generate a GNU make "workspace" makefile, with support for the new platforms API. -- function make.generate_solution(sln) @@ -32,14 +32,14 @@ -- --- Write out the solution's configuration map, which maps solution +-- Write out the workspace's configuration map, which maps workspace -- level configurations to the project level equivalents. -- function make.configmap(sln) - for cfg in solution.eachconfig(sln) do + for cfg in p.workspace.eachconfig(sln) do _p('ifeq ($(config),%s)', cfg.shortname) - for prj in solution.eachproject(sln) do + for prj in p.workspace.eachproject(sln) do local prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform) if prjcfg then _p(' %s_config = %s', make.tovar(prj.name), prjcfg.shortname) @@ -57,7 +57,7 @@ function make.cleanrules(sln) _p('clean:') - for prj in solution.eachproject(sln) do + for prj in p.workspace.eachproject(sln) do local prjpath = premake.filename(prj, make.getmakefilename(prj, true)) local prjdir = path.getdirectory(path.getrelative(sln.location, prjpath)) local prjname = path.getname(prjpath) @@ -77,7 +77,7 @@ _p(1,'@echo ""') _p(1,'@echo "CONFIGURATIONS:"') - for cfg in solution.eachconfig(sln) do + for cfg in p.workspace.eachconfig(sln) do _x(1, '@echo " %s"', cfg.shortname) end @@ -87,7 +87,7 @@ _p(1,'@echo " all (default)"') _p(1,'@echo " clean"') - for prj in solution.eachproject(sln) do + for prj in p.workspace.eachproject(sln) do _p(1,'@echo " %s"', prj.name) end @@ -97,7 +97,7 @@ -- --- Write out the list of projects that comprise the solution. +-- Write out the list of projects that comprise the workspace. -- function make.projects(sln) @@ -106,12 +106,12 @@ end -- --- Write out the solution PHONY rule +-- Write out the workspace PHONY rule -- function make.solutionPhonyRule(sln) local groups = {} - local tr = solution.grouptree(sln) + local tr = p.workspace.grouptree(sln) tree.traverse(tr, { onbranch = function(n) table.insert(groups, n.path) @@ -128,8 +128,8 @@ -- Write out the phony rules representing project groups -- function make.groupRules(sln) - -- Transform solution groups into target aggregate - local tr = solution.grouptree(sln) + -- Transform workspace groups into target aggregate + local tr = p.workspace.grouptree(sln) tree.traverse(tr, { onbranch = function(n) local rule = n.path .. ":" @@ -160,11 +160,11 @@ end -- --- Write out the rules to build each of the solution's projects. +-- Write out the rules to build each of the workspace's projects. -- function make.projectrules(sln) - for prj in solution.eachproject(sln) do + for prj in p.workspace.eachproject(sln) do local deps = project.getdependencies(prj) deps = table.extract(deps, "name") _p('%s:%s', premake.esc(prj.name), make.list(deps)) diff --git a/src/actions/vstudio/_vstudio.lua b/src/actions/vstudio/_vstudio.lua index 9a153c21..e48b67ad 100644 --- a/src/actions/vstudio/_vstudio.lua +++ b/src/actions/vstudio/_vstudio.lua @@ -8,7 +8,6 @@ local vstudio = premake.vstudio local p = premake - local solution = p.solution local project = p.project local config = p.config @@ -515,7 +514,7 @@ local hasnative = false local hasnet = false local slnarch - for prj in solution.eachproject(cfg.solution) do + for prj in p.workspace.eachproject(cfg.workspace) do if project.isnative(prj) then hasnative = true elseif project.isdotnet(prj) then @@ -569,7 +568,7 @@ -- if the platform identifier matches a known system or architecture, -- - for prj in solution.eachproject(cfg.solution) do + for prj in p.workspace.eachproject(cfg.workspace) do if project.isnative(prj) then hasnative = true elseif project.isdotnet(prj) then diff --git a/src/actions/vstudio/vs2005.lua b/src/actions/vstudio/vs2005.lua index 35e84483..66687090 100644 --- a/src/actions/vstudio/vs2005.lua +++ b/src/actions/vstudio/vs2005.lua @@ -94,7 +94,7 @@ dotnet = { "msnet" }, }, - -- Solution and project generation logic + -- Workspace and project generation logic onWorkspace = vstudio.vs2005.generateSolution, onProject = vstudio.vs2005.generateProject, diff --git a/src/actions/vstudio/vs2005_solution.lua b/src/actions/vstudio/vs2005_solution.lua index 66152811..24ba510a 100644 --- a/src/actions/vstudio/vs2005_solution.lua +++ b/src/actions/vstudio/vs2005_solution.lua @@ -1,15 +1,16 @@ -- -- vs2005_solution.lua -- Generate a Visual Studio 2005-2012 solution. --- Copyright (c) 2009-2013 Jason Perkins and the Premake project +-- Copyright (c) 2009-2015 Jason Perkins and the Premake project -- premake.vstudio.sln2005 = {} - local vstudio = premake.vstudio - local sln2005 = premake.vstudio.sln2005 - local solution = premake.solution - local project = premake.project - local tree = premake.tree + + local p = premake + local vstudio = p.vstudio + local sln2005 = p.vstudio.sln2005 + local project = p.project + local tree = p.tree -- @@ -70,7 +71,7 @@ function sln2005.reorderProjects(sln) if sln.startproject then local np - local tr = solution.grouptree(sln) + local tr = p.workspace.grouptree(sln) tree.traverse(tr, { onleaf = function(n) if n.project.name == sln.startproject then @@ -95,14 +96,14 @@ -- function sln2005.projects(sln) - local tr = solution.grouptree(sln) + local tr = p.workspace.grouptree(sln) tree.traverse(tr, { onleaf = function(n) local prj = n.project -- Build a relative path from the solution file to the project file local prjpath = vstudio.projectfile(prj) - prjpath = vstudio.path(prj.solution, prjpath) + prjpath = vstudio.path(prj.workspace, prjpath) -- Unlike projects, solutions must use old-school %...% DOS style -- for environment variables. @@ -146,7 +147,7 @@ local descriptors = {} local sorted = {} - for cfg in solution.eachconfig(sln) do + for cfg in p.workspace.eachconfig(sln) do -- Create a Visual Studio solution descriptor (i.e. Debug|Win32) for -- this solution configuration. I need to use it in a few different places @@ -193,7 +194,7 @@ _p(1,"GlobalSection(ProjectConfigurationPlatforms) = postSolution") - local tr = solution.grouptree(sln) + local tr = p.workspace.grouptree(sln) tree.traverse(tr, { onleaf = function(n) local prj = n.project @@ -253,7 +254,7 @@ -- function sln2005.NestedProjects(sln) - local tr = solution.grouptree(sln) + local tr = p.workspace.grouptree(sln) if tree.hasbranches(tr) then _p(1,'GlobalSection(NestedProjects) = preSolution') tree.traverse(tr, { @@ -281,7 +282,7 @@ -- --- Write out all of the solution sections. +-- Write out all of the workspace sections. -- function sln2005.sections(sln) diff --git a/src/actions/vstudio/vs2008.lua b/src/actions/vstudio/vs2008.lua index b9aec9ca..afe3e49a 100644 --- a/src/actions/vstudio/vs2008.lua +++ b/src/actions/vstudio/vs2008.lua @@ -33,7 +33,7 @@ dotnet = { "msnet" }, }, - -- Solution and project generation logic + -- Workspace and project generation logic onWorkspace = vstudio.vs2005.generateSolution, onProject = vstudio.vs2005.generateProject, diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua index 5cce45ed..73c97974 100644 --- a/src/actions/vstudio/vs200x_vcproj.lua +++ b/src/actions/vstudio/vs200x_vcproj.lua @@ -1443,12 +1443,12 @@ local deps = project.getdependencies(prj) if #deps > 0 then -- This is a little odd: Visual Studio wants the "relative path to project" - -- to be relative to the *solution*, rather than the project doing the + -- to be relative to the *workspace*, rather than the project doing the -- referencing. Which, in theory, would break if the project is included - -- in more than one solution. But that's how they do it. + -- in more than one workspace. But that's how they do it. for i, dep in ipairs(deps) do - local relpath = vstudio.path(prj.solution, vstudio.projectfile(dep)) + local relpath = vstudio.path(prj.workspace, vstudio.projectfile(dep)) -- Visual Studio wants the path to start with ./ or ../ if not relpath:startswith(".") then diff --git a/src/actions/vstudio/vs2010.lua b/src/actions/vstudio/vs2010.lua index 6f553f4e..94ba9149 100644 --- a/src/actions/vstudio/vs2010.lua +++ b/src/actions/vstudio/vs2010.lua @@ -21,6 +21,7 @@ ["cfg.objdir"] = "$(IntDir)", ["prj.location"] = "$(ProjectDir)", ["sln.location"] = "$(SolutionDir)", + ["wks.location"] = "$(SolutionDir)", ["cfg.buildtarget.directory"] = "$(TargetDir)", ["cfg.buildtarget.name"] = "$(TargetFileName)", ["cfg.buildtarget.basename"] = "$(TargetName)", @@ -119,7 +120,7 @@ dotnet = { "msnet" }, }, - -- Solution and project generation logic + -- Workspace and project generation logic onWorkspace = function(wks) vstudio.vs2005.generateSolution(wks) diff --git a/src/actions/vstudio/vs2012.lua b/src/actions/vstudio/vs2012.lua index a98e7799..4f46dc56 100644 --- a/src/actions/vstudio/vs2012.lua +++ b/src/actions/vstudio/vs2012.lua @@ -35,7 +35,7 @@ dotnet = { "msnet" }, }, - -- Solution and project generation logic + -- Workspace and project generation logic onWorkspace = function(wks) vstudio.vs2005.generateSolution(wks) diff --git a/src/actions/vstudio/vs2013.lua b/src/actions/vstudio/vs2013.lua index c25516a8..558f02bc 100644 --- a/src/actions/vstudio/vs2013.lua +++ b/src/actions/vstudio/vs2013.lua @@ -37,7 +37,7 @@ dotnet = { "msnet" }, }, - -- Solution and project generation logic + -- Workspace and project generation logic onWorkspace = function(wks) vstudio.vs2005.generateSolution(wks) diff --git a/src/actions/vstudio/vs2015.lua b/src/actions/vstudio/vs2015.lua index 39b2a7c0..4707e489 100644 --- a/src/actions/vstudio/vs2015.lua +++ b/src/actions/vstudio/vs2015.lua @@ -37,7 +37,7 @@ dotnet = { "msnet" }, }, - -- Solution and project generation logic + -- Workspace and project generation logic onWorkspace = function(wks) vstudio.vs2005.generateSolution(wks) diff --git a/src/base/action.lua b/src/base/action.lua index d1d184e0..cf3ca1d1 100644 --- a/src/base/action.lua +++ b/src/base/action.lua @@ -85,7 +85,7 @@ onWorkspace(wks) end - for prj in p.solution.eachproject(wks) do + for prj in p.workspace.eachproject(wks) do local onProject = a.onProject or a.onproject if onProject and not prj.external then onProject(prj) diff --git a/src/base/api.lua b/src/base/api.lua index 6b05d228..473f77d9 100755 --- a/src/base/api.lua +++ b/src/base/api.lua @@ -1,6 +1,6 @@ -- -- api.lua --- Implementation of the solution, project, and configuration APIs. +-- Implementation of the workspace, project, and configuration APIs. -- Author Jason Perkins -- Copyright (c) 2002-2015 Jason Perkins and the Premake project -- @@ -15,7 +15,7 @@ --- -- Set up a place to store the current active objects in each configuration --- scope (e.g. solutions, projects, groups, and configurations). This likely +-- scope (e.g. wprkspaces, projects, groups, and configurations). This likely -- ought to be internal scope, but it is useful for testing. --- @@ -27,15 +27,15 @@ -- Define a new class of configuration container. A container can receive and -- store configuration blocks, which are what hold the individial settings -- from the scripts. A container can also hold one or more kinds of child --- containers; a solution can contain projects, for instance. +-- containers; a workspace can contain projects, for instance. -- -- @param containerName --- The name of the new container type, e.g. "solution". Used to define a --- corresponding global function, e.g. solution() to create new instances +-- The name of the new container type, e.g. "workspace". Used to define a +-- corresponding global function, e.g. workspace() to create new instances -- of the container. -- @param parentContainer (optional) -- The container that can contain this one. For a project, this would be --- the solution container class. +-- the workspace container class. -- @param extraScopes (optional) -- Each container can hold fields scoped to itself (by putting the container's -- class name into its scope attribute), or any of the container's children. @@ -112,12 +112,12 @@ --- -- Activate a new configuration container, making it the target for all --- subsequent configuration settings. When you call solution() or project() +-- subsequent configuration settings. When you call workspace() or project() -- to active a container, that call comes here (see api.container() for the -- details on how that happens). -- -- @param class --- The container class being activated, e.g. a project or solution. +-- The container class being activated, e.g. a project or workspace. -- @param name -- The name of the container instance to be activated. If a container -- (e.g. project) with this name does not already exist it will be @@ -211,8 +211,8 @@ -- -- The available field scopes are: -- --- project The field applies to solutions and projects. --- config The field applies to solutions, projects, and individual build +-- project The field applies to workspaces and projects. +-- config The field applies to workspaces, projects, and individual build -- configurations. -- -- The available field kinds are: diff --git a/src/base/config.lua b/src/base/config.lua index 39263ed4..a38c5ba0 100755 --- a/src/base/config.lua +++ b/src/base/config.lua @@ -250,9 +250,9 @@ local item -- Sort the links into "sibling" (is another project in this same - -- solution) and "system" (is not part of this solution) libraries. + -- workspace) and "system" (is not part of this workspace) libraries. - local prj = premake.solution.findproject(cfg.solution, link) + local prj = p.workspace.findproject(cfg.workspace, link) if prj and kind ~= "system" then -- Sibling; is there a matching configuration in this project that diff --git a/src/base/container.lua b/src/base/container.lua index 56720f08..cb8b151d 100644 --- a/src/base/container.lua +++ b/src/base/container.lua @@ -212,7 +212,7 @@ -- The name of the class to be checked against. If the container -- class matches this scope (i.e. class is a project and the -- scope is "project"), or if it is a parent object of it (i.e. --- class is a solution and scope is "project"), then returns +-- class is a workspace and scope is "project"), then returns -- true. --- diff --git a/src/base/group.lua b/src/base/group.lua index df268c4e..0d98a102 100644 --- a/src/base/group.lua +++ b/src/base/group.lua @@ -5,7 +5,7 @@ --- local p = premake - p.group = p.api.container("group", p.solution) + p.group = p.api.container("group", p.workspace) local group = p.group diff --git a/src/base/premake.lua b/src/base/premake.lua index 5c9252f0..0d7dabd9 100644 --- a/src/base/premake.lua +++ b/src/base/premake.lua @@ -1,16 +1,11 @@ -- -- premake.lua -- High-level helper functions for the project exporters. --- Copyright (c) 2002-2014 Jason Perkins and the Premake project +-- Copyright (c) 2002-2015 Jason Perkins and the Premake project -- local p = premake - local solution = p.solution - local project = p.project - local config = p.config - local field = p.field - -- Store captured output text for later testing @@ -140,14 +135,14 @@ -- -- Open a file for output, and call a function to actually do the writing. --- Used by the actions to generate solution and project files. +-- Used by the actions to generate workspace and project files. -- -- @param obj --- A solution or project object; will be passed to the callback function. +-- A workspace or project object; will be passed to the callback function. -- @param ext -- An optional extension for the generated file, with the leading dot. -- @param callback --- The function responsible for writing the file, should take a solution +-- The function responsible for writing the file, should take a workspace -- or project as a parameters. -- @@ -171,7 +166,7 @@ --- -- Returns the full path a file generated from any of the project --- objects (project, solution, rule). +-- objects (project, workspace, rule). -- -- @param obj -- The project object being generated. diff --git a/src/base/project.lua b/src/base/project.lua index 640279b0..e4aba8e0 100755 --- a/src/base/project.lua +++ b/src/base/project.lua @@ -6,7 +6,7 @@ --- local p = premake - p.project = p.api.container("project", p.solution, { "config" }) + p.project = p.api.container("project", p.workspace, { "config" }) local project = p.project local tree = p.tree @@ -44,7 +44,7 @@ -- -- Returns an iterator function for the configuration objects contained by -- the project. Each configuration corresponds to a build configuration/ --- platform pair (i.e. "Debug|x86") as specified in the solution. +-- platform pair (i.e. "Debug|x86") as specified in the workspace. -- -- @param prj -- The project object to query. @@ -56,7 +56,7 @@ local configs = prj._cfglist local count = #configs - -- Once the configurations are mapped into the solution I could get + -- Once the configurations are mapped into the workspace I could get -- the same one multiple times. Make sure that doesn't happen. local seen = {} @@ -152,9 +152,9 @@ --- -- Returns a list of sibling projects on which the specified project depends. --- This is used to list dependencies within a solution or workspace. Must --- consider all configurations because Visual Studio does not support per-config --- project dependencies. +-- This is used to list dependencies within a workspace. Must consider all +-- configurations because Visual Studio does not support per-config project +-- dependencies. -- -- @param prj -- The project to query. @@ -169,7 +169,7 @@ if not prj.dependencies then local result = {} local function add_to_project_list(cfg, depproj, result) - local dep = premake.solution.findproject(cfg.solution, depproj) + local dep = p.workspace.findproject(cfg.workspace, depproj) if dep and not table.contains(result, dep) then table.insert(result, dep) end From d1ea0e81b13bc8de19912ca2254296279e411baa Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Wed, 12 Aug 2015 14:56:06 -0400 Subject: [PATCH 4/4] More easy sln to wks renames --- src/actions/make/_make.lua | 6 +-- src/actions/make/make_solution.lua | 54 ++++++++++++------------- src/actions/vstudio/vs2005.lua | 4 +- src/actions/vstudio/vs2005_solution.lua | 46 ++++++++++----------- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/actions/make/_make.lua b/src/actions/make/_make.lua index 478ecf0a..631d04cd 100644 --- a/src/actions/make/_make.lua +++ b/src/actions/make/_make.lua @@ -101,13 +101,13 @@ function make.getmakefilename(this, searchprjs) local count = 0 - for sln in p.global.eachWorkspace() do - if sln.location == this.location then + for wks in p.global.eachWorkspace() do + if wks.location == this.location then count = count + 1 end if searchprjs then - for _, prj in ipairs(sln.projects) do + for _, prj in ipairs(wks.projects) do if prj.location == this.location then count = count + 1 end diff --git a/src/actions/make/make_solution.lua b/src/actions/make/make_solution.lua index 6e62b5ff..a19c5b10 100644 --- a/src/actions/make/make_solution.lua +++ b/src/actions/make/make_solution.lua @@ -14,20 +14,20 @@ -- Generate a GNU make "workspace" makefile, with support for the new platforms API. -- - function make.generate_solution(sln) + function make.generate_solution(wks) premake.eol("\n") - make.header(sln) + make.header(wks) - make.configmap(sln) - make.projects(sln) + make.configmap(wks) + make.projects(wks) - make.solutionPhonyRule(sln) - make.groupRules(sln) + make.solutionPhonyRule(wks) + make.groupRules(wks) - make.projectrules(sln) - make.cleanrules(sln) - make.helprule(sln) + make.projectrules(wks) + make.cleanrules(wks) + make.helprule(wks) end @@ -36,10 +36,10 @@ -- level configurations to the project level equivalents. -- - function make.configmap(sln) - for cfg in p.workspace.eachconfig(sln) do + function make.configmap(wks) + for cfg in p.workspace.eachconfig(wks) do _p('ifeq ($(config),%s)', cfg.shortname) - for prj in p.workspace.eachproject(sln) do + for prj in p.workspace.eachproject(wks) do local prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform) if prjcfg then _p(' %s_config = %s', make.tovar(prj.name), prjcfg.shortname) @@ -55,11 +55,11 @@ -- Write out the rules for the `make clean` action. -- - function make.cleanrules(sln) + function make.cleanrules(wks) _p('clean:') - for prj in p.workspace.eachproject(sln) do + for prj in p.workspace.eachproject(wks) do local prjpath = premake.filename(prj, make.getmakefilename(prj, true)) - local prjdir = path.getdirectory(path.getrelative(sln.location, prjpath)) + local prjdir = path.getdirectory(path.getrelative(wks.location, prjpath)) local prjname = path.getname(prjpath) _x(1,'@${MAKE} --no-print-directory -C %s -f %s clean', prjdir, prjname) end @@ -71,13 +71,13 @@ -- Write out the make file help rule and configurations list. -- - function make.helprule(sln) + function make.helprule(wks) _p('help:') _p(1,'@echo "Usage: make [config=name] [target]"') _p(1,'@echo ""') _p(1,'@echo "CONFIGURATIONS:"') - for cfg in p.workspace.eachconfig(sln) do + for cfg in p.workspace.eachconfig(wks) do _x(1, '@echo " %s"', cfg.shortname) end @@ -87,7 +87,7 @@ _p(1,'@echo " all (default)"') _p(1,'@echo " clean"') - for prj in p.workspace.eachproject(sln) do + for prj in p.workspace.eachproject(wks) do _p(1,'@echo " %s"', prj.name) end @@ -100,8 +100,8 @@ -- Write out the list of projects that comprise the workspace. -- - function make.projects(sln) - _p('PROJECTS := %s', table.concat(premake.esc(table.extract(sln.projects, "name")), " ")) + function make.projects(wks) + _p('PROJECTS := %s', table.concat(premake.esc(table.extract(wks.projects, "name")), " ")) _p('') end @@ -109,9 +109,9 @@ -- Write out the workspace PHONY rule -- - function make.solutionPhonyRule(sln) + function make.solutionPhonyRule(wks) local groups = {} - local tr = p.workspace.grouptree(sln) + local tr = p.workspace.grouptree(wks) tree.traverse(tr, { onbranch = function(n) table.insert(groups, n.path) @@ -127,9 +127,9 @@ -- -- Write out the phony rules representing project groups -- - function make.groupRules(sln) + function make.groupRules(wks) -- Transform workspace groups into target aggregate - local tr = p.workspace.grouptree(sln) + local tr = p.workspace.grouptree(wks) tree.traverse(tr, { onbranch = function(n) local rule = n.path .. ":" @@ -163,8 +163,8 @@ -- Write out the rules to build each of the workspace's projects. -- - function make.projectrules(sln) - for prj in p.workspace.eachproject(sln) do + function make.projectrules(wks) + for prj in p.workspace.eachproject(wks) do local deps = project.getdependencies(prj) deps = table.extract(deps, "name") _p('%s:%s', premake.esc(prj.name), make.list(deps)) @@ -175,7 +175,7 @@ _p(1,'@echo "==== Building %s ($(%s_config)) ===="', prj.name, cfgvar) local prjpath = premake.filename(prj, make.getmakefilename(prj, true)) - local prjdir = path.getdirectory(path.getrelative(sln.location, prjpath)) + local prjdir = path.getdirectory(path.getrelative(wks.location, prjpath)) local prjname = path.getname(prjpath) _x(1,'@${MAKE} --no-print-directory -C %s -f %s config=$(%s_config)', prjdir, prjname, cfgvar) diff --git a/src/actions/vstudio/vs2005.lua b/src/actions/vstudio/vs2005.lua index 66687090..54d66614 100644 --- a/src/actions/vstudio/vs2005.lua +++ b/src/actions/vstudio/vs2005.lua @@ -15,12 +15,12 @@ -- Register a command-line action for Visual Studio 2006. --- - function vs2005.generateSolution(sln) + function vs2005.generateSolution(wks) p.indent("\t") p.eol("\r\n") p.escaper(vs2005.esc) - premake.generate(sln, ".sln", vstudio.sln2005.generate) + premake.generate(wks, ".sln", vstudio.sln2005.generate) end diff --git a/src/actions/vstudio/vs2005_solution.lua b/src/actions/vstudio/vs2005_solution.lua index 24ba510a..ae009ce3 100644 --- a/src/actions/vstudio/vs2005_solution.lua +++ b/src/actions/vstudio/vs2005_solution.lua @@ -17,7 +17,7 @@ -- Return the list of sections contained in the solution. -- - function sln2005.solutionSections(sln) + function sln2005.solutionSections(wks) return { "ConfigurationPlatforms", "SolutionProperties", @@ -30,17 +30,17 @@ -- Generate a Visual Studio 200x solution, with support for the new platforms API. -- - function sln2005.generate(sln) + function sln2005.generate(wks) -- Mark the file as Unicode _p('\239\187\191') - sln2005.reorderProjects(sln) + sln2005.reorderProjects(wks) sln2005.header() - sln2005.projects(sln) + sln2005.projects(wks) _p('Global') - sln2005.sections(sln) + sln2005.sections(wks) _p('EndGlobal') end @@ -68,13 +68,13 @@ -- in the IDE will cause the orderings to get rewritten. -- - function sln2005.reorderProjects(sln) - if sln.startproject then + function sln2005.reorderProjects(wks) + if wks.startproject then local np - local tr = p.workspace.grouptree(sln) + local tr = p.workspace.grouptree(wks) tree.traverse(tr, { onleaf = function(n) - if n.project.name == sln.startproject then + if n.project.name == wks.startproject then np = n end end @@ -95,8 +95,8 @@ -- Write out the list of projects and groups contained by the solution. -- - function sln2005.projects(sln) - local tr = p.workspace.grouptree(sln) + function sln2005.projects(wks) + local tr = p.workspace.grouptree(wks) tree.traverse(tr, { onleaf = function(n) local prj = n.project @@ -142,12 +142,12 @@ -- Write out the tables that map solution configurations to project configurations. -- - function sln2005.configurationPlatforms(sln) + function sln2005.configurationPlatforms(wks) local descriptors = {} local sorted = {} - for cfg in p.workspace.eachconfig(sln) do + for cfg in p.workspace.eachconfig(wks) do -- Create a Visual Studio solution descriptor (i.e. Debug|Win32) for -- this solution configuration. I need to use it in a few different places @@ -172,10 +172,10 @@ -- Now I can output the sorted list of solution configuration descriptors -- Visual Studio assumes the first configurations as the defaults. - if sln.defaultplatform then + if wks.defaultplatform then _p(1,'GlobalSection(SolutionConfigurationPlatforms) = preSolution') table.foreachi(sorted, function (cfg) - if cfg.platform == sln.defaultplatform then + if cfg.platform == wks.defaultplatform then _p(2,'%s = %s', descriptors[cfg], descriptors[cfg]) end end) @@ -184,7 +184,7 @@ _p(1,'GlobalSection(SolutionConfigurationPlatforms) = preSolution') table.foreachi(sorted, function (cfg) - if not sln.defaultplatform or cfg.platform ~= sln.defaultplatform then + if not wks.defaultplatform or cfg.platform ~= wks.defaultplatform then _p(2,'%s = %s', descriptors[cfg], descriptors[cfg]) end end) @@ -194,7 +194,7 @@ _p(1,"GlobalSection(ProjectConfigurationPlatforms) = postSolution") - local tr = p.workspace.grouptree(sln) + local tr = p.workspace.grouptree(wks) tree.traverse(tr, { onleaf = function(n) local prj = n.project @@ -241,7 +241,7 @@ -- Write out contents of the SolutionProperties section; currently unused. -- - function sln2005.properties(sln) + function sln2005.properties(wks) _p('\tGlobalSection(SolutionProperties) = preSolution') _p('\t\tHideSolutionNode = FALSE') _p('\tEndGlobalSection') @@ -253,8 +253,8 @@ -- any solution groups. -- - function sln2005.NestedProjects(sln) - local tr = p.workspace.grouptree(sln) + function sln2005.NestedProjects(wks) + local tr = p.workspace.grouptree(wks) if tree.hasbranches(tr) then _p(1,'GlobalSection(NestedProjects) = preSolution') tree.traverse(tr, { @@ -285,10 +285,10 @@ -- Write out all of the workspace sections. -- - function sln2005.sections(sln) - for _, section in ipairs(sln2005.solutionSections(sln)) do + function sln2005.sections(wks) + for _, section in ipairs(sln2005.solutionSections(wks)) do if sln2005.sectionmap[section] then - sln2005.sectionmap[section](sln) + sln2005.sectionmap[section](wks) end end end