浏览代码

depot_tools: Add version 2024.2.29@50de66 (#3368)

* depot_tools: Add version 2024.2.29@50de66

Versioning just uses commit date, maybe preferred to use 6 char commit?
as: "2024.2.29-50de66"
Maybe unnecesary.

* deps: Add ninja to depot_tools

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

---------

Co-authored-by: ruki <[email protected]>
PerikiyoXD 1 年之前
父节点
当前提交
4f9e4013d7
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. 14 1
      packages/d/depot_tools/xmake.lua

+ 14 - 1
packages/d/depot_tools/xmake.lua

@@ -6,6 +6,10 @@ package("depot_tools")
     add_urls("https://github.com/xmake-mirror/depot_tools.git",
              "https://chromium.googlesource.com/chromium/tools/depot_tools.git")
     add_versions("2022.2.1", "8a6d00f116d6de9d5c4e92acb519fd0859c6449a")
+    add_versions("2024.2.29", "50de666ba40a4808daf9791fece3d8a43228a1de")
+
+    -- we use external ninja instead of depot_tools/ninja which eating ram until VM exhaustion (16GB)
+    add_deps("ninja", {private = true, system = false})
 
     on_load(function (package)
         package:addenv("PATH", ".")
@@ -17,6 +21,10 @@ package("depot_tools")
 
     on_install("linux", "macosx", "windows", function (package)
         import("core.base.global")
+        local ninja = path.join(package:dep("ninja"):installdir("bin"), "ninja" .. (is_host("windows") and ".exe" or ""))
+        if ninja and os.isfile(ninja) then
+            os.trycp(ninja, os.curdir())
+        end
         os.cp("*", package:installdir())
         os.cd(package:installdir())
         -- maybe we need set proxy, e.g. `xmake g --proxy=http://127.0.0.1:xxxx`
@@ -28,11 +36,16 @@ package("depot_tools")
             envs.HTTPS_PROXY = proxy
             envs.ALL_PROXY = proxy
         end
+        envs.PATH = table.join(os.curdir(), path.splitenv(os.getenv("PATH")))
+        -- skip to check and update obsolete URL
+        io.replace("./update_depot_tools",
+            'CANONICAL_GIT_URL="https://chromium.googlesource.com/chromium/tools/depot_tools.git"',
+            'CANONICAL_GIT_URL="https://github.com/xmake-mirror/depot_tools.git"', {plain = true})
         -- we need fetch some files when running gclient for the first time
         if is_host("windows") then
             os.vrunv("gclient.bat", {"--verbose"}, {envs = envs})
         else
-            os.vrunv("sh", {"./gclient", "--verbose"}, {envs = envs})
+            os.vrunv("./gclient", {"--verbose"}, {shell = true, envs = envs})
         end
   end)