Set up _OS for xcode tests

This commit is contained in:
starkos 2009-09-29 18:32:34 +00:00
parent 5f978efc56
commit 18c498f7b3
5 changed files with 55 additions and 30 deletions

View File

@ -63,13 +63,10 @@
end
-- Some actions imply a particular operating system. Set it early so
-- it can be picked up by the scripts.
-- Set up the environment for the chosen action early, so side-effects
-- can be picked up by the scripts.
local action = premake.action.current()
if action then
_OS = action.os or _OS
end
premake.action.set(_ACTION)
-- Seed the random number generator so actions don't have to do it themselves

View File

@ -6,27 +6,26 @@
premake.xcode = { }
-- turned off for the 4.1.2 release
-- newaction
-- {
-- trigger = "xcode3",
-- shortname = "Xcode 3",
-- description = "Apple Xcode 3 (experimental)",
-- os = "macosx",
--
-- valid_kinds = { "ConsoleApp", "WindowedApp", "SharedLib", "StaticLib" },
--
-- valid_languages = { "C", "C++" },
--
-- valid_tools = {
-- cc = { "gcc" },
-- },
--
-- onsolution = function(sln)
-- premake.generate(sln, "%%.xcodeproj/project.pbxproj", premake.xcode.pbxproj)
-- end,
--
-- oncleansolution = function(sln)
-- premake.clean.directory(sln, "%%.xcodeproj")
-- end,
-- }
newaction
{
trigger = "xcode3",
shortname = "Xcode 3",
description = "Apple Xcode 3 (experimental)",
os = "macosx",
valid_kinds = { "ConsoleApp", "WindowedApp", "SharedLib", "StaticLib" },
valid_languages = { "C", "C++" },
valid_tools = {
cc = { "gcc" },
},
onsolution = function(sln)
premake.generate(sln, "%%.xcodeproj/project.pbxproj", premake.xcode.pbxproj)
end,
oncleansolution = function(sln)
premake.clean.directory(sln, "%%.xcodeproj")
end,
}

View File

@ -114,6 +114,23 @@
end
--
-- Activates a particular action.
--
-- @param name
-- The name of the action to activate.
--
function premake.action.set(name)
_ACTION = name
-- Some actions imply a particular operating system
local action = premake.action.get(name)
if action then
_OS = action.os or _OS
end
end
--
-- Determines if an action supports a particular language or target type.
--

View File

@ -51,6 +51,7 @@
local sln, tr
function T.xcode3.setup()
premake.action.set("xcode3")
-- reset the list of generated IDs
used_ids = { }
sln = test.createsolution()

View File

@ -58,3 +58,14 @@
function T.action.CallSkipsCallbacksIfNotPresent()
test.success(premake.action.call, "fake")
end
--
-- Tests for set()
--
function T.action.set_SetsActionOS()
_OS = "linux"
premake.action.set("vs2008")
test.isequal(_OS, "windows")
end