summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-04 23:03:52 +0800
committerruki <[email protected]>2026-03-04 23:03:52 +0800
commit2566a7d29bbee1c9ee8e65fd0ae81380db65d6ca (patch)
tree656eab29777a9753156e201f84355f03848e2ca4
parentbf24224a1f27d9b957caef9fdffa64f139ca093f (diff)
revert languages for template
-rw-r--r--xmake/actions/create/template.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/xmake/actions/create/template.lua b/xmake/actions/create/template.lua
index d638034cf..1279c1d35 100644
--- a/xmake/actions/create/template.lua
+++ b/xmake/actions/create/template.lua
@@ -139,13 +139,19 @@ 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()
- return {"c", "c++", "cuda", "dlang", "fortran", "go",
- "kotlin", "nim", "objc", "objc++", "pascal",
- "rust", "swift", "vala", "zig"}
+ 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
+ found:insert(path.filename(d))
+ end
+ end
+ end
+ local results = found:to_array()
+ table.sort(results)
+ return results
end
-- get all templates for the given language