grace/htmlua
HTML Templating Engine
git clone https://git.gae.moe/grace/htmlua
0213276
latest
1const std = @import ( "std" ) ; 2 3pub fn build ( b : * std . Build ) void { 4const target = b . standardTargetOptions ( . {}) ; 5const optimize = b . standardOptimizeOption ( . {}) ; 6 7const ezts = b . dependency ( "eazy_zig_tree_sitter" , . { 8. target = target , 9. optimize = optimize , 10. use_all_langs = true , 11. use_third_party = true , 12}) ; 13 14const ts = b . dependency ( "tree_sitter" , . { 15. target = target , 16. optimize = optimize , 17}) ; 18 19const mod = b . addModule ( "htmlua" , . { 20. root_source_file = b . path ( "src/root.zig" ) , 21. target = target , 22. imports = & . { 23. { . name = "easy-zig-tree-sitter" , . module = ezts . module ( "eazy_zig_tree_sitter" ) } , 24. { . name = "tree-sitter" , . module = ts . module ( "tree_sitter" ) } , 25} , 26}) ; 27 28// Debug bin 29const exe = b . addExecutable ( . { 30. name = "htmlua" , 31. root_module = b . createModule ( . { 32. root_source_file = b . path ( "src/main.zig" ) , 33. target = target , 34. optimize = optimize , 35. imports = & . { 36. { . name = "htmlua" , . module = mod } , 37} , 38}) , 39}) ; 40 41b . installArtifact ( exe ) ; 42 43const run_step = b . step ( "run" , "Run the app" ) ; 44 45const run_cmd = b . addRunArtifact ( exe ) ; 46run_step . dependOn ( & run_cmd . step ) ; 47 48run_cmd . step . dependOn ( b . getInstallStep ()) ; 49 50if ( b . args ) | args | { 51run_cmd . addArgs ( args ) ; 52} 53 54// CGI bin 55const cgi = b . addExecutable ( . { 56. name = "htmlua-cgi" , 57. root_module = b . createModule ( . { 58. root_source_file = b . path ( "src/cgi.zig" ) , 59. target = target , 60. optimize = optimize , 61. imports = & . { 62. { . name = "htmlua" , . module = mod } , 63} , 64}) , 65}) ; 66 67b . installArtifact ( cgi ) ; 68 69const mod_tests = b . addTest ( . { 70. root_module = mod , 71}) ; 72 73const run_mod_tests = b . addRunArtifact ( mod_tests ) ; 74 75const exe_tests = b . addTest ( . { 76. root_module = exe . root_module , 77}) ; 78 79const run_exe_tests = b . addRunArtifact ( exe_tests ) ; 80 81const test_step = b . step ( "test" , "Run tests" ) ; 82test_step . dependOn ( & run_mod_tests . step ) ; 83test_step . dependOn ( & run_exe_tests . step ) ; 84 85// https://zigtools.org/zls/guides/build-on-save/ 86const exe_check = b . addExecutable ( . { 87. name = "htmlua" , 88. root_module = b . createModule ( . { 89. root_source_file = b . path ( "src/main.zig" ) , 90. target = target , 91. optimize = optimize , 92. imports = & . { 93. { . name = "htmlua" , . module = mod } , 94} , 95}) , 96}) ; 97const cgi_check = b . addExecutable ( . { 98. name = "htmlua-cgi" , 99. root_module = b . createModule ( . { 100. root_source_file = b . path ( "src/cgi.zig" ) , 101. target = target , 102. optimize = optimize , 103. imports = & . { 104. { . name = "htmlua" , . module = mod } , 105} , 106}) , 107}) ; 108 109const check = b . step ( "check" , "Check if htmlua compiles" ) ; 110check . dependOn ( & exe_check . step ) ; 111check . dependOn ( & cgi_check . step ) ; 112}