From 93b93dba91d099815e320bd9032b672b35327798 Mon Sep 17 00:00:00 2001 From: John Leidegren Date: Sun, 11 Aug 2024 19:28:23 +0200 Subject: [PATCH] Forward default nodes as lookup table in ide file generation (#348) * Forward default nodes as lookup table in ide file generation --- scripts/tundra/boot.lua | 12 +++++++++++- scripts/tundra/ide/codelite.lua | 2 +- scripts/tundra/ide/msvc-common.lua | 2 +- scripts/tundra/ide/xcode3.lua | 2 +- scripts/tundra/ide/xcode5.lua | 2 +- scripts/tundra/ide/xcode7.lua | 2 +- scripts/tundra/nodegen.lua | 4 ++-- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/scripts/tundra/boot.lua b/scripts/tundra/boot.lua index e8fa227c..832ec475 100644 --- a/scripts/tundra/boot.lua +++ b/scripts/tundra/boot.lua @@ -137,7 +137,17 @@ function generate_ide_files(build_script_fn, ide_script) build_data.Configs, env) + -- Lookup table for default nodes + local default_nodes = {} + for _, v in ipairs(node_bindings) do + if v.DefaultNodes then + for _, default_node in pairs(v.DefaultNodes) do + default_nodes[default_node] = true + end + end + end + -- Pass the build tuples directly to the generator and let it write -- files. - nodegen.generate_ide_files(build_tuples, build_data.DefaultNodes, raw_nodes, env, raw_data.IdeGenerationHints, ide_script) + nodegen.generate_ide_files(build_tuples, default_nodes, raw_nodes, env, raw_data.IdeGenerationHints, ide_script) end diff --git a/scripts/tundra/ide/codelite.lua b/scripts/tundra/ide/codelite.lua index 080a8f6b..829f0e69 100644 --- a/scripts/tundra/ide/codelite.lua +++ b/scripts/tundra/ide/codelite.lua @@ -599,7 +599,7 @@ function codelite_generator:generate_project(project, all_projects) end -function codelite_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_names, hints, ide_script) +function codelite_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_nodes, hints, ide_script) assert(config_tuples and #config_tuples > 0) if not hints then diff --git a/scripts/tundra/ide/msvc-common.lua b/scripts/tundra/ide/msvc-common.lua index db1773e4..ef95c9b6 100644 --- a/scripts/tundra/ide/msvc-common.lua +++ b/scripts/tundra/ide/msvc-common.lua @@ -785,7 +785,7 @@ function msvc_generator:generate_project_user(project) p:close() end -function msvc_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_names, hints, ide_script) +function msvc_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_nodes, hints, ide_script) assert(config_tuples and #config_tuples > 0) if not hints then diff --git a/scripts/tundra/ide/xcode3.lua b/scripts/tundra/ide/xcode3.lua index 643fe729..f29967c7 100644 --- a/scripts/tundra/ide/xcode3.lua +++ b/scripts/tundra/ide/xcode3.lua @@ -699,7 +699,7 @@ local function generate_shellscript(env) os.execute("chmod +x " .. filename) end -function xcode_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_names) +function xcode_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_nodes) assert(config_tuples and #config_tuples > 0) -- TODO: Set the first default config as default diff --git a/scripts/tundra/ide/xcode5.lua b/scripts/tundra/ide/xcode5.lua index 6fb53533..9cf99144 100644 --- a/scripts/tundra/ide/xcode5.lua +++ b/scripts/tundra/ide/xcode5.lua @@ -833,7 +833,7 @@ local function make_meta_projects(ide_script) } end -function xcode_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_names, hints, ide_script) +function xcode_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_nodes, hints, ide_script) assert(config_tuples and #config_tuples > 0) hints = hints or {} diff --git a/scripts/tundra/ide/xcode7.lua b/scripts/tundra/ide/xcode7.lua index e2a71119..11084ddb 100755 --- a/scripts/tundra/ide/xcode7.lua +++ b/scripts/tundra/ide/xcode7.lua @@ -1161,7 +1161,7 @@ local function write_schemes(schemes_dir, projects, config_tuples, xcodeproj_nam m:write('\n') end -function xcode_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_names, hints, ide_script) +function xcode_generator:generate_files(ngen, config_tuples, raw_nodes, env, default_nodes, hints, ide_script) assert(config_tuples and #config_tuples > 0) hints = hints or {} diff --git a/scripts/tundra/nodegen.lua b/scripts/tundra/nodegen.lua index cfe213fa..dd557970 100644 --- a/scripts/tundra/nodegen.lua +++ b/scripts/tundra/nodegen.lua @@ -813,12 +813,12 @@ function replace_filtered_env_vars(env, values_to_replace, build_id, exclusive) end end -function generate_ide_files(config_tuples, default_names, raw_nodes, env, hints, ide_script) +function generate_ide_files(config_tuples, default_nodes, raw_nodes, env, hints, ide_script) local state = new_generator { default_env = env } assert(state.default_env) create_unit_map(state, raw_nodes) local backend_fn = assert(ide_backend) - backend_fn(state, config_tuples, raw_nodes, env, default_names, hints, ide_script) + backend_fn(state, config_tuples, raw_nodes, env, default_nodes, hints, ide_script) end function set_ide_backend(backend_fn)