diff options
| author | ruki <[email protected]> | 2020-12-31 22:51:00 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-12-31 22:51:00 +0800 |
| commit | 99126a6271f7ed8a4712d5cd5c060210090b8d1c (patch) | |
| tree | 79c9b18eb20a6c3ef2419509d869eeb2c415c061 | |
| parent | 818575765ddc038ed220c5e1aff334264ea7ef11 (diff) | |
add unzip to ci
| -rw-r--r-- | .github/workflows/debian_mips64.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/msys2_mingw.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/ubuntu_arm64.yml | 2 | ||||
| -rwxr-xr-x | tests/projects/package/depconfigs/src/main.c | 7 | ||||
| -rw-r--r-- | tests/projects/package/depconfigs/test.lua | 3 | ||||
| -rw-r--r-- | tests/projects/package/depconfigs/xmake.lua | 6 | ||||
| -rw-r--r-- | tests/projects/package/multiconfig/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/require/impl/package.lua | 43 |
8 files changed, 58 insertions, 9 deletions
diff --git a/.github/workflows/debian_mips64.yml b/.github/workflows/debian_mips64.yml index 0ee576e1a..fae901348 100644 --- a/.github/workflows/debian_mips64.yml +++ b/.github/workflows/debian_mips64.yml @@ -22,7 +22,7 @@ jobs: args: > bash -c "uname -a && - apt update && + apt update && apt install -y unzip && cd /github/workspace && ./scripts/get.sh __local__ && source ~/.xmake/profile && diff --git a/.github/workflows/msys2_mingw.yml b/.github/workflows/msys2_mingw.yml index 0f41834aa..3964d5c2f 100644 --- a/.github/workflows/msys2_mingw.yml +++ b/.github/workflows/msys2_mingw.yml @@ -25,7 +25,7 @@ jobs: - uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.msystem }} - install: git base-devel mingw-w64-${{ matrix.arch }}-toolchain + install: git base-devel unzip mingw-w64-${{ matrix.arch }}-toolchain update: true - name: Move Checkout diff --git a/.github/workflows/ubuntu_arm64.yml b/.github/workflows/ubuntu_arm64.yml index be7c7e169..ef313232b 100644 --- a/.github/workflows/ubuntu_arm64.yml +++ b/.github/workflows/ubuntu_arm64.yml @@ -22,7 +22,7 @@ jobs: args: > bash -c "uname -a && - apt update && + apt update && apt install -y unzip && cd /github/workspace && ./scripts/get.sh __local__ && source ~/.xmake/profile && diff --git a/tests/projects/package/depconfigs/src/main.c b/tests/projects/package/depconfigs/src/main.c new file mode 100755 index 000000000..9ae580511 --- /dev/null +++ b/tests/projects/package/depconfigs/src/main.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(int argc, char** argv) +{ + printf("hello world!\n"); + return 0; +} diff --git a/tests/projects/package/depconfigs/test.lua b/tests/projects/package/depconfigs/test.lua new file mode 100644 index 000000000..b57362078 --- /dev/null +++ b/tests/projects/package/depconfigs/test.lua @@ -0,0 +1,3 @@ +function main(t) + t:build() +end diff --git a/tests/projects/package/depconfigs/xmake.lua b/tests/projects/package/depconfigs/xmake.lua new file mode 100644 index 000000000..c8527c801 --- /dev/null +++ b/tests/projects/package/depconfigs/xmake.lua @@ -0,0 +1,6 @@ +add_requires("libpng", {system = false, configs = {vs_runtime = "MD"}, depconfigs = {cxflags = "-DTEST"}}) + +target("test") + set_kind("binary") + add_files("src/*.c") + add_packages("libpng") diff --git a/tests/projects/package/multiconfig/xmake.lua b/tests/projects/package/multiconfig/xmake.lua index 48d64da13..09121e8d2 100644 --- a/tests/projects/package/multiconfig/xmake.lua +++ b/tests/projects/package/multiconfig/xmake.lua @@ -11,7 +11,7 @@ target("test1") target("test2") set_kind("binary") add_files("src/*.c") - add_packages("zlib#debug") + add_packages("zlib~debug") target("test3") set_kind("binary") diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua index 51ec7b1e4..d0daaa3a8 100644 --- a/xmake/actions/require/impl/package.lua +++ b/xmake/actions/require/impl/package.lua @@ -74,6 +74,9 @@ end -- - add_requires("zlib~debug", {debug = true}) -- - add_requires("zlib~shared", {configs = {shared = true}, alias = "zlib_shared"}) -- +-- pass configs to all dependent packages +-- - add_requires("libpng", {depconfigs = {shared = true, cxflags = "-DTEST"}}) +-- -- {system = nil/true/false}: -- nil: get local or system packages -- true: only get system package @@ -172,6 +175,7 @@ function _parse_require(require_str, requires_extra, parentinfo) system = require_extra.system, -- default: true, we can set it to disable system package manually option = require_extra.option, -- set and attach option configs = require_build_configs, -- the required building configurations + depconfigs = require_extra.depconfigs,-- the configuration passed to dependent packages default = require_extra.default, -- default: true, we can set it to disable package manually optional = parentinfo.optional or require_extra.optional, -- default: false, inherit parentinfo.optional verify = require_extra.verify, -- default: true, we can set false to ignore sha256sum and select any version @@ -327,7 +331,7 @@ function _check_package_configurations(package) end -- get package key -function _packagekey(packagename, requireinfo, version) +function _get_packagekey(packagename, requireinfo, version) local key = packagename .. "/" .. (version or requireinfo.version) local configs = requireinfo.configs if configs then @@ -357,7 +361,7 @@ function _load_package(packagename, requireinfo, opt) -- cannot be detected at present and can only be resolved by the user -- local rootkey = opt.rootkey - local packagekey = _packagekey(packagename, requireinfo) + local packagekey = _get_packagekey(packagename, requireinfo) local packagekey_prev = _memcache():get3("packages_root", rootkey, packagename) if packagekey_prev then if packagekey_prev and packagekey_prev ~= packagekey then @@ -398,7 +402,7 @@ function _load_package(packagename, requireinfo, opt) -- latest/semver to the cached version? update package key and load package from cache if version then - packagekey = _packagekey(packagename, requireinfo, version) + packagekey = _get_packagekey(packagename, requireinfo, version) local package_cached = _memcache():get2("packages", packagekey) if package_cached then return package_cached @@ -428,10 +432,38 @@ function _load_package(packagename, requireinfo, opt) return package end --- load the extra configs dependent packages and inherit some builtin configs +-- load the extra configs dependent packages function _load_package_depconfigs(package) - local deps = package:get("deps") + + -- get all extra configs of dependent packages local extraconfs = package:extraconf("deps") or {} + + -- inherit depconfigs of root package + -- e.g. add_requires("libpng", {depconfigs = {...}}) + -- + local deps = package:get("deps") + local requireinfo = package:requireinfo() + if requireinfo and requireinfo.depconfigs then + for _, depstr in ipairs(deps) do + local depconf = extraconfs[depstr] + if not depconf then + depconf = {} + extraconfs[depstr] = depconf + end + depconf.configs = depconf.configs or {} + for k, v in pairs(requireinfo.depconfigs) do + if depconf.configs[k] == nil then + depconf.configs[k] = v + end + end + end + end + -- TODO disable system deps +-- print(requireinfo) + + -- inherit some builtin configs of root package + -- e.g. add_requires("libpng", {configs = {vs_runtime = "MD"}}) + -- if not package:config("shared") then for _, depstr in ipairs(deps) do local depconf = extraconfs[depstr] @@ -445,6 +477,7 @@ function _load_package_depconfigs(package) end end end +-- print(extraconfs) return extraconfs end |
