summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-04 00:54:44 +0800
committerruki <[email protected]>2026-03-04 00:54:44 +0800
commit074e35d2647a9271d37ecc30f41b4ca7332033ac (patch)
treebc67ba183ffff74b7882fd02d53c04b274280187
parent6697684c141ef8e80d1e1d9a89770167f2344cdd (diff)
improve language list
-rw-r--r--xmake/actions/create/template.lua19
1 files changed, 6 insertions, 13 deletions
diff --git a/xmake/actions/create/template.lua b/xmake/actions/create/template.lua
index ea4c06b2f..d638034cf 100644
--- a/xmake/actions/create/template.lua
+++ b/xmake/actions/create/template.lua
@@ -139,20 +139,13 @@ function replace_variables_in_files(files, vars)
end
-- get all languages from templates
+--
+-- scanning template roots to detect languages is too slow, and the language module list does not fully match template language names,
+-- so we hardcode it here for better performance.
function languages()
- local found = hashset.new()
- for _, rootdir in ipairs(rootdirs()) do
- local languages_dirs = os.dirs(path.join(rootdir, "*"))
- if languages_dirs then
- for _, d in ipairs(languages_dirs) do
- local name = path.filename(d)
- found:insert(name)
- end
- end
- end
- local results = found:to_array()
- table.sort(results)
- return results
+ return {"c", "c++", "cuda", "dlang", "fortran", "go",
+ "kotlin", "nim", "objc", "objc++", "pascal",
+ "rust", "swift", "vala", "zig"}
end
-- get all templates for the given language