|
@@ -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)
|
|
|
|