Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implemented the following features

* Removed NativeTarget for !Tundra build that now uses LegacyTarget.
* Renamed !TundraBuild to !BuildWorkspace
* Added !UpdateWorkspace that runs tundra with --ide-gen xcode3 to update the workspace
* Fixed so no ugly ../blbla name shows up under Products
* Fixed so cleaning works correct now when doing !BuildWorkspace
  • Loading branch information...
commit 06f6557f3493b17b0943292335ff4f5e72e3c305 1 parent 49a4191
@emoon emoon authored
Showing with 111 additions and 51 deletions.
  1. +111 −51 scripts/tundra/ide/xcode3.lua
View
162 scripts/tundra/ide/xcode3.lua
@@ -53,6 +53,12 @@ local project_types = util.make_lookup_table {
"Program", "SharedLibrary", "StaticLibrary",
}
+local function get_absolute_output_path(env)
+ local base_dir = env:interpolate('$(OBJECTROOT)$(SEP)')
+ local cwd = native.get_cwd()
+ return cwd .. "/" .. base_dir
+end
+
local function newid(data)
local string = native.digest_guid(data)
-- a bit ugly but is to match the xcode style of UIds
@@ -112,6 +118,7 @@ local function get_project_data(unit, env)
RelativeFilename = relative_fn,
Guid = newid(decl.Name .. "ProjectId"),
}
+
elseif unit.Keyword == "OsxBundle" then
decl.Name = "OsxBundle"
@@ -191,6 +198,47 @@ local function write_file_refs(p, projects)
p:write('/* End FBXFileReference section */\n\n')
end
+local function write_legacy_targets(p, projects, env)
+ p:write('/* Begin PBXLegacyTarget section */\n')
+
+ local script_path = get_absolute_output_path(env)
+
+ for _, project in pairs(projects) do
+ local decl = project.Decl
+
+ if project.IsMeta then
+ --[[
+ isa = PBXLegacyTarget;
+ buildArgumentsString = "";
+ buildConfigurationList = D7D12762170E4CF98A79B5EF /* Build configuration list for PBXLegacyTarget "!UpdateWorkspace" */;
+ buildPhases = (
+ );
+ buildToolPath = /Users/danielcollin/unity_ps3/ps3/Projects/JamGenerated/_workspace.xcode_/updateworkspace;
+ dependencies = (
+ );
+ name = "!UpdateWorkspace";
+ passBuildSettingsInEnvironment = 1;
+ productName = "!UpdateWorkspace";
+ --]]
+
+ p:write('\t\t', newid(decl.Name .. "Target"), ' /* ', decl.Name, ' */ = {\n')
+ p:write('\t\t\tisa = PBXLegacyTarget;\n')
+ p:write('\t\t\tbuildArgumentsString = "', project.MetaData.BuildArgs, '";\n')
+ p:write('\t\t\tbuildConfigurationList = ', newid(decl.Name .. 'Config'), ' /* Build configuration list for PBXLegacyTarget "',decl.Name, '" */;\n')
+ p:write('\t\t\tbuildPhases = (\n')
+ p:write('\t\t\t);\n');
+ p:write('\t\t\tbuildToolPath = ', script_path .. project.MetaData.BuildTool, ';\n')
+ p:write('\t\t\tdependencies = (\n\t\t\t);\n')
+ p:write('\t\t\tname = "', decl.Name, '";\n')
+ p:write('\t\t\tpassBuildSettingsInEnvironment = 1;\n')
+ p:write('\t\t\tproductName = "', decl.Name or "", '";\n')
+ p:write('\t\t};\n')
+ end
+ end
+
+ p:write('/* End PBXLegacyTarget section */\n')
+end
+
local function write_native_targes(p, projects)
p:write('/* Begin PBXNativeTarget section */\n')
@@ -202,19 +250,22 @@ local function write_native_targes(p, projects)
for _, project in pairs(projects) do
local decl = project.Decl
- p:write('\t\t', newid(decl.Name .. "NativeTarget"), ' /* ', project.Decl.Name, ' */ = {\n')
- p:write('\t\t\tisa = PBXNativeTarget;\n')
- p:write('\t\t\tbuildConfigurationList = ', newid(decl.Name .. 'Config'), ' /* Build configuration list for PBXNativeTarget "',decl.Name, '" */;\n')
- p:write('\t\t\tbuildPhases = (\n')
- p:write('\t\t\t\t', newid(decl.Name .. "ShellScript"), ' /* ShellScript */,\n')
- p:write('\t\t\t);\n');
- p:write('\t\t\tbuildRules = (\n\t\t\t);\n')
- p:write('\t\t\tdependencies = (\n\t\t\t);\n')
- p:write('\t\t\tname = "', decl.Name, '";\n')
- p:write('\t\t\tProductName = "', decl.Name, '";\n')
- p:write('\t\t\tproductReference = ', newid(decl.Name .. "Program"), ' /* ', decl.Name, ' */;\n ')
- p:write('\t\t\tproductType = "', categories[project.Type] or "", '";\n')
- p:write('\t\t};\n')
+
+ if not project.IsMeta then
+ p:write('\t\t', newid(decl.Name .. "Target"), ' /* ', decl.Name, ' */ = {\n')
+ p:write('\t\t\tisa = PBXNativeTarget;\n')
+ p:write('\t\t\tbuildConfigurationList = ', newid(decl.Name .. 'Config'), ' /* Build configuration list for PBXNativeTarget "',decl.Name, '" */;\n')
+ p:write('\t\t\tbuildPhases = (\n')
+ p:write('\t\t\t\t', newid(decl.Name .. "ShellScript"), ' /* ShellScript */,\n')
+ p:write('\t\t\t);\n');
+ p:write('\t\t\tbuildRules = (\n\t\t\t);\n')
+ p:write('\t\t\tdependencies = (\n\t\t\t);\n')
+ p:write('\t\t\tname = "', decl.Name, '";\n')
+ p:write('\t\t\tProductName = "', decl.Name, '";\n')
+ p:write('\t\t\tproductReference = ', newid(decl.Name .. "Program"), ' /* ', decl.Name, ' */;\n ')
+ p:write('\t\t\tproductType = "', categories[project.Type] or "", '";\n')
+ p:write('\t\t};\n')
+ end
end
p:write('/* End PBXNativeTarget section */\n')
@@ -235,22 +286,38 @@ end
local function get_projects(raw_nodes, env)
local projects = {}
- local meta_name = "!TundraBuild"
local source_list = {}
- source_list[newid(meta_name)] = "tundra.lua"
+ source_list[newid("tundra.lua")] = "tundra.lua"
local units = io.open("units.lua")
if units then
source_list[newid("units.lua")] = "units.lua"
io.close(units)
end
+ local meta_name = "!BuildWorkspace"
+
projects[#projects + 1] = {
Decl = { Name = meta_name, },
- Type = "Program", -- hacky but we use this to target the whole project
- RelativeFilename = meta_name,
+ Type = "LegacyTarget",
+ RelativeFilename = "",
Sources = source_list,
Guid = newid(meta_name .. 'ProjectId'),
IsMeta = true,
+ MetaData = { BuildArgs = "'' $(CONFIG) $(VARIANT) $(SUBVARIANT) $(ACTION)",
+ BuildTool = "xcodetundra" },
+ }
+
+ local meta_name = "!UpdateWorkspace"
+
+ projects[#projects + 1] = {
+ Decl = { Name = "!UpdateWorkspace", },
+ Type = "LegacyTarget",
+ RelativeFilename = "",
+ Sources = source_list,
+ Guid = newid(meta_name .. 'ProjectId'),
+ IsMeta = true,
+ MetaData = { BuildArgs = "",
+ BuildTool = "xcodeupdateproj" },
}
for _, unit in ipairs(raw_nodes) do
@@ -368,7 +435,6 @@ local function print_children_2(p, children, path, level)
local_path = print_children_2( p, c.Children, path .. '/' .. c.Name, level + 1 )
if #c.Children ~= 0 then
write_group_ref(p, c, path)
- --print(c.Name)
end
end
@@ -404,7 +470,6 @@ local function write_sources(p, children, name, parent)
local grp = find_group(groups, split_path[i], parent_group)
if grp == nil then
grp = { IsDir = true, Name=split_path[i], Parent=parent_group, Key=newid(util.tostring(parent_group)..split_path[i]), Children={} }
- --print (grp.Name .. ' : ' .. grp.Key .. ' ' .. split_path[i].. ' ' .. entry.Key)
if parent_group == nil then
table.insert(groups, grp)
else
@@ -471,7 +536,7 @@ local function write_project(p, projects)
p:write('\t\t\ttargets = (\n')
for _, project in pairs(projects) do
- p:write(string.format('\t\t\t\t%s /* %s */,\n', newid(project.Decl.Name .. "NativeTarget"), project.Decl.Name))
+ p:write(string.format('\t\t\t\t%s /* %s */,\n', newid(project.Decl.Name .. "Target"), project.Decl.Name))
end
p:write('\t\t\t);\n')
@@ -479,14 +544,6 @@ local function write_project(p, projects)
p:write('/* End PBXProject section */\n')
end
-local function get_absolute_output_path(env)
- local base_dir = env:interpolate('$(OBJECTROOT)$(SEP)')
- local cwd = native.get_cwd()
- --print(cwd)
- --print(base_dir)
- return cwd .. "/" .. base_dir
-end
-
local function write_shellscripts(p, projects, env)
p:write('/* Begin PBXShellScriptBuildPhase section */\n')
@@ -496,23 +553,21 @@ local function write_shellscripts(p, projects, env)
for _, project in pairs(projects) do
local name = project.Decl.Name
- p:write('\t\t', newid(name .. "ShellScript"), ' /* ShellScript */ = {\n')
- p:write('\t\t\tisa = PBXShellScriptBuildPhase;\n')
- p:write('\t\t\tbuildActionMask = 2147483647;\n')
- p:write('\t\t\tfiles = (\n')
- p:write('\t\t\t);\n')
- p:write('\t\t\tinputPaths = (\n')
- p:write('\t\t\t);\n')
- p:write('\t\t\toutputPaths = (\n')
- p:write('\t\t\t);\n')
- p:write('\t\t\trunOnlyForDeploymentPostprocessing = 0;\n')
- p:write('\t\t\tshellPath = /bin/sh;\n')
- if project.IsMeta then
- p:write('\t\t\tshellScript = "', xcodetundra_filename, ' \'\' $CONFIG $VARIANT $SUBVARIANT $ACTION -v";\n')
- else
+ if not project.IsMeta then
+ p:write('\t\t', newid(name .. "ShellScript"), ' /* ShellScript */ = {\n')
+ p:write('\t\t\tisa = PBXShellScriptBuildPhase;\n')
+ p:write('\t\t\tbuildActionMask = 2147483647;\n')
+ p:write('\t\t\tfiles = (\n')
+ p:write('\t\t\t);\n')
+ p:write('\t\t\tinputPaths = (\n')
+ p:write('\t\t\t);\n')
+ p:write('\t\t\toutputPaths = (\n')
+ p:write('\t\t\t);\n')
+ p:write('\t\t\trunOnlyForDeploymentPostprocessing = 0;\n')
+ p:write('\t\t\tshellPath = /bin/sh;\n')
p:write('\t\t\tshellScript = "', xcodetundra_filename, ' $TARGET_NAME $CONFIG $VARIANT $SUBVARIANT $ACTION -v";\n')
+ p:write('\t\t};\n')
end
- p:write('\t\t};\n')
end
p:write('/* Begin PBXShellScriptBuildPhase section */\n')
@@ -551,17 +606,12 @@ local function write_configs(p, projects, config_tuples, env)
p:write('\t\t\t\tCONFIG = "', tuple.Config.Name, '";\n')
p:write('\t\t\t\tSUBVARIANT = "', tuple.SubVariant, '";\n')
- if is_macosx_native then
+ if is_macosx_native and not project.IsMeta then
p:write('\t\t\t\tCONFIGURATION_BUILD_DIR = "', full_config_name, '";\n')
end
-- this is a little hack to get xcode to clean the whole output folder when using "FullBuild"
- if project.IsMeta then
- p:write('\t\t\t\tPRODUCT_NAME = "../', full_config_name, '" /* hack for proper project clean */;\n')
- else
- p:write('\t\t\t\tPRODUCT_NAME = "',project.Decl.Name , '";\n')
- end
-
+ p:write('\t\t\t\tPRODUCT_NAME = "',project.Decl.Name , '";\n')
p:write('\t\t\t\tTARGET_NAME = "',project.Decl.Name , '";\n')
p:write('\t\t\t};\n')
@@ -638,13 +688,22 @@ local function generate_shellscript(env)
p:write("CONFIG=$2\n")
p:write("VARIANT=$3\n")
p:write("SUBVARIANT=$4\n")
- p:write('ACTION=""\n')
+ p:write("ACTION=$5\n")
p:write('if [ "$5" = "clean" ]; then\n')
p:write(' ACTION="-c"\n')
p:write("fi\n\n")
+ p:write('if [ "$5" = "build" ]; then\n')
+ p:write(' ACTION=""\n')
+ p:write("fi\n\n")
p:write(tundra.boot.TundraExePath .. " $TARGET_NAME $CONFIG-$VARIANT-$SUBVARIANT $ACTION -v\n")
p:close()
os.execute("chmod +x " .. filename)
+ local filename = path.join(get_absolute_output_path(env), "xcodeupdateproj")
+ local p = io.open(filename, 'wb')
+ p:write("#/bin/sh\n")
+ p:write(tundra.boot.TundraExePath .. " --ide-gen xcode3 -a\n")
+ p:close()
+ os.execute("chmod +x " .. filename)
end
function xcode_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_names)
@@ -667,6 +726,7 @@ function xcode_generator:generate_files(ngen, config_tuples, raw_nodes, env, def
write_header(p)
write_file_refs(p, projects)
write_groups(p, projects)
+ write_legacy_targets(p, projects, env)
write_native_targes(p, projects)
write_project(p, projects)
write_shellscripts(p, projects, env)
Please sign in to comment.
Something went wrong with that request. Please try again.