From 64db618a134e8a474f4d785ee47cf04723f782ef Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 10 Mar 2022 00:25:53 +0800 Subject: support template package --- CHANGELOG.md | 8 ++++++++ xmake/core/package/package.lua | 5 +++++ xmake/modules/private/action/require/impl/package.lua | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 108d1da5c..9bcfddfb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### New features + +* [#2138](https://github.com/xmake-io/xmake/issues/2138): Support template package + ### Changes * [#2137](https://github.com/xmake-io/xmake/pull/2137): Improve path module @@ -1226,6 +1230,10 @@ ## master (开发中) +### 新特性 + +* [#2138](https://github.com/xmake-io/xmake/issues/2138): 支持模板包 + ### 改进 * [#2137](https://github.com/xmake-io/xmake/pull/2137): 改进 path 模块 diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 24fe66ea2..b77b24aeb 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -421,6 +421,11 @@ function _instance:is_library() return self:kind() == nil or self:kind() == "library" end +-- is template package? +function _instance:is_template() + return self:kind() == "template" +end + -- is header only? function _instance:is_headeronly() return self:is_library() and self:extraconf("kind", "library", "headeronly") diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 89db47e36..b0fe3399c 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -932,7 +932,7 @@ end -- this package should be install? function should_install(package) - if package:exists() then + if package:is_template() or package:exists() then return false end -- we need not install it if this package need only be fetched -- cgit v1.3.1