From d2e70dd2430454e9fcacc8a543d7710737e32ca1 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 10 Feb 2021 23:31:34 +0800 Subject: move toolchain package to beginning --- tests/projects/package/toolchain_muslcc/xmake.lua | 6 +++--- xmake/actions/require/impl/package.lua | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/projects/package/toolchain_muslcc/xmake.lua b/tests/projects/package/toolchain_muslcc/xmake.lua index 930a116c7..48c048457 100644 --- a/tests/projects/package/toolchain_muslcc/xmake.lua +++ b/tests/projects/package/toolchain_muslcc/xmake.lua @@ -4,12 +4,12 @@ add_rules("mode.debug", "mode.release") set_plat("cross") set_arch("arm") --- add toolchains package -add_requires("muslcc") - -- add library packages add_requires("zlib", "libplist", {system = false}) +-- add toolchains package +add_requires("muslcc") + -- set global toolchains for target and packages set_toolchains("@muslcc") diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua index 6a9ccfcce..c23a5efa8 100644 --- a/xmake/actions/require/impl/package.lua +++ b/xmake/actions/require/impl/package.lua @@ -634,7 +634,12 @@ function _load_packages(requires, opt) end -- save this package - table.insert(packages, package) + -- @note if this root package is toolchain, we need to move it to the beginning in order to install first + if not opt.parentinfo and package:is_toolchain() then + table.insert(packages, 1, package) + else + table.insert(packages, package) + end end end return packages -- cgit v1.3.1