summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-02-02 00:52:22 +0800
committerruki <[email protected]>2022-02-02 00:52:22 +0800
commit6898c868efb7196bcecff4e730b5c3181a15ac43 (patch)
tree454d95e595c1e24a4dec36792003c26f393c2f4c
parent0a6020b64b903aa67ed8c674135b8f26464246ba (diff)
add on_download for package
-rw-r--r--xmake/core/package/package.lua1
-rw-r--r--xmake/modules/private/action/require/impl/actions/download.lua5
2 files changed, 5 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 73b2731dd..20a5c0ff7 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -1841,6 +1841,7 @@ function package.apis()
-- package.on_xxx
"package.on_load"
, "package.on_fetch"
+ , "package.on_download"
, "package.on_install"
, "package.on_test"
}
diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua
index f2c8eeba7..ad0e7bc37 100644
--- a/xmake/modules/private/action/require/impl/actions/download.lua
+++ b/xmake/modules/private/action/require/impl/actions/download.lua
@@ -242,7 +242,10 @@ function main(package)
-- download package
local sourcedir = "source"
- if git.checkurl(url) then
+ local script = package:script("download")
+ if script then
+ script(package, {sourcedir = sourcedir, url = url, url_alias = url_alias, url_excludes = url_excludes})
+ elseif git.checkurl(url) then
_checkout(package, url, sourcedir, url_alias)
else
_download(package, url, sourcedir, url_alias, url_excludes)