diff options
| author | ruki <[email protected]> | 2023-11-09 23:55:57 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-09 23:55:57 +0800 |
| commit | fcbd4baf1055b02ce4cd71ed96c7d32402f077e9 (patch) | |
| tree | dd9992551afcd157c05f143ee8184f15923a1160 | |
| parent | 6fa2d1e158c2d97d9f3f5349874150f06f914cbb (diff) | |
add pack nsis stub
| -rw-r--r-- | tests/plugins/pack/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/includes/xpack/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/pack/main.lua | 13 | ||||
| -rw-r--r-- | xmake/plugins/pack/nsis/main.lua | 28 | ||||
| -rw-r--r-- | xmake/plugins/pack/xpack.lua | 3 |
5 files changed, 43 insertions, 7 deletions
diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua index 2268c4a5e..5d45181c0 100644 --- a/tests/plugins/pack/xmake.lua +++ b/tests/plugins/pack/xmake.lua @@ -7,7 +7,7 @@ target("test") add_files("src/*.cpp") xpack("test") - add_formats("nsis") + set_formats("nsis") set_description("hello") add_targets("test") diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua index 30efaf2ac..a6a3f1cea 100644 --- a/xmake/includes/xpack/xmake.lua +++ b/xmake/includes/xpack/xmake.lua @@ -36,8 +36,8 @@ local apis = { "xpack.set_description", -- set package license, we will also get them from target "xpack.set_license", - -- add package formats, e.g. nsis, deb, rpm, targz, zip, runself, ... - "xpack.add_formats", + -- set package formats, e.g. nsis, deb, rpm, targz, zip, runself, ... + "xpack.set_formats", -- add targets to be packaged "xpack.add_targets", -- add install files, we will also get them from target diff --git a/xmake/plugins/pack/main.lua b/xmake/plugins/pack/main.lua index 51de15822..b0a147208 100644 --- a/xmake/plugins/pack/main.lua +++ b/xmake/plugins/pack/main.lua @@ -25,11 +25,16 @@ import("core.project.project") import("private.service.remote_build.action", {alias = "remote_build_action"}) import("xpack") +function _pack_package(package) + assert(package:formats(), "xpack(%s): formats not found, please use `set_formats()` to set it.", package:name()) + for _, format in package:formats():keys() do + import(format)(package) + end +end + function _pack_packages() - for _, instance in pairs(xpack.packages()) do - print("xpack(%s)", instance:name()) - print(" description: %s", instance:description()) - print(" installcmd: ", instance:script("installcmd")) + for _, package in pairs(xpack.packages()) do + _pack_package(package) end end diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua new file mode 100644 index 000000000..695e5b19f --- /dev/null +++ b/xmake/plugins/pack/nsis/main.lua @@ -0,0 +1,28 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-present, TBOOX Open Source Group. +-- +-- @author ruki +-- @file main.lua +-- + +-- imports +import("core.base.option") + +function main(package) + print("xpack(%s)", package:name()) + print(" description: %s", package:description()) + print(" installcmd: ", package:script("installcmd")) +end diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index b22d07a2f..680b75d6d 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -197,6 +197,9 @@ function packages() local formats_need = option.get("formats") if formats_need then formats_need = formats_need:split(",") + if formats_need[1] == "all" then + formats_need = nil + end end local xpack_scope = project.scope("xpack") for name, scope in pairs(xpack_scope) do |
