diff options
| author | ruki <[email protected]> | 2017-10-18 23:19:56 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-10-18 13:59:40 +0800 |
| commit | 10bb94a674e52aee141ebec8badca5595bd5c409 (patch) | |
| tree | 22d8cdb7e4f95d7216aabf626211208ce1c1579d | |
| parent | 23861f0674fe95fbd277caee6137c13a6b0b419d (diff) | |
support optional for install and download package
| -rw-r--r-- | tests/projects/requires/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/require/action/build.lua | 9 | ||||
| -rw-r--r-- | xmake/actions/require/action/download.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/require/action/install.lua | 4 |
4 files changed, 15 insertions, 4 deletions
diff --git a/tests/projects/requires/xmake.lua b/tests/projects/requires/xmake.lua index 8857c4b4f..a5747c1c1 100644 --- a/tests/projects/requires/xmake.lua +++ b/tests/projects/requires/xmake.lua @@ -1,13 +1,13 @@ -- define package package("mbedtls") set_urls("https://github.com/ARMmbed/mbedtls.git") - add_deps("https://github.com/glennrp/libpng.git@libpng >=1.6.28") + add_deps("https://github.com/glennrp/libpng.git@libpng >=1.6.28", {optional = true}) package_end() -- group packages package("zlib-mbedtls") add_deps("zlib >=1.2.11", {system = false}) - add_deps("mbedtls") + add_deps("mbedtls", {optional = true}) package_end() -- requires diff --git a/xmake/actions/require/action/build.lua b/xmake/actions/require/action/build.lua index 4ec5772cc..b8f47b6ec 100644 --- a/xmake/actions/require/action/build.lua +++ b/xmake/actions/require/action/build.lua @@ -112,6 +112,15 @@ function _build_for_cmakelists(package, buildfile) -- os.vrun("cmake -DCMAKE_INSTALL_PREFIX=%s .", path.absolute(".prefix")) + -- build on windows + if os.host() == "windows" then + local slnfiles = os.files("*.sln") + if slnfiles and #slnfiles > 0 then + _build_for_sln(package, slnfiles[1]) + return + end + end + -- build it os.vrun("make") diff --git a/xmake/actions/require/action/download.lua b/xmake/actions/require/action/download.lua index e94251d9a..da09c26a1 100644 --- a/xmake/actions/require/action/download.lua +++ b/xmake/actions/require/action/download.lua @@ -194,7 +194,7 @@ function main(package) end -- failed? break it - if idx == #urls then + if idx == #urls and not package:requireinfo().optional then raise("download failed!") end end diff --git a/xmake/actions/require/action/install.lua b/xmake/actions/require/action/install.lua index 6816cbd95..2f76bacd3 100644 --- a/xmake/actions/require/action/install.lua +++ b/xmake/actions/require/action/install.lua @@ -277,7 +277,9 @@ function main(package) cprint("${red}failed") -- failed - raise("install failed!") + if not package:requireinfo().optional then + raise("install failed!") + end end } } |
