Răsfoiți Sursa

improve new.lua

ruki 3 ani în urmă
părinte
comite
b08bb53681
1 a modificat fișierele cu 8 adăugiri și 0 ștergeri
  1. 8 0
      scripts/new.lua

+ 8 - 0
scripts/new.lua

@@ -59,6 +59,7 @@ function _generate_package_from_github(reponame)
     local has_xmake
     local has_xmake
     local has_cmake
     local has_cmake
     local has_meson
     local has_meson
+    local has_bazel
     local has_autoconf
     local has_autoconf
     local need_autogen
     local need_autogen
     local latest_release = repoinfo.latestRelease
     local latest_release = repoinfo.latestRelease
@@ -104,6 +105,8 @@ function _generate_package_from_github(reponame)
                 has_autoconf = true
                 has_autoconf = true
             elseif filename == "meson.build" then
             elseif filename == "meson.build" then
                 has_meson = true
                 has_meson = true
+            elseif filename == "BUILD" then
+                has_bazel = true
             end
             end
         end
         end
         os.rm(repodir)
         os.rm(repodir)
@@ -119,6 +122,9 @@ function _generate_package_from_github(reponame)
     elseif need_autogen then
     elseif need_autogen then
         file:print("")
         file:print("")
         file:print('    add_deps("autoconf", "automake", "libtool")')
         file:print('    add_deps("autoconf", "automake", "libtool")')
+    elseif has_bazel then
+        file:print("")
+        file:print('    add_deps("bazel")')
     end
     end
 
 
     -- generate install scripts
     -- generate install scripts
@@ -141,6 +147,8 @@ function _generate_package_from_github(reponame)
     elseif has_meson then
     elseif has_meson then
         file:print('        table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))')
         file:print('        table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))')
         file:print('        import("package.tools.meson").install(package, configs)')
         file:print('        import("package.tools.meson").install(package, configs)')
+    elseif has_bazel then
+        file:print('        import("package.tools.bazel").install(package, configs)')
     else
     else
         file:print('        io.writefile("xmake.lua", [[')
         file:print('        io.writefile("xmake.lua", [[')
         file:print('            add_rules("mode.release", "mode.debug")')
         file:print('            add_rules("mode.release", "mode.debug")')