diff options
| author | ruki <[email protected]> | 2023-11-24 22:37:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-24 22:37:42 +0800 |
| commit | f99a2826a56540608b01075a072eba11f4da6fc5 (patch) | |
| tree | e2ffe8cacdbe307074f3793e18b04c3320d196b4 | |
| parent | 19b444e7d0f05b1efa7a52b9d8c001be7cba14c2 (diff) | |
improve test
| -rw-r--r-- | tests/plugins/pack/xmake.lua | 9 | ||||
| -rw-r--r-- | xmake/plugins/pack/runself/main.lua | 22 |
2 files changed, 24 insertions, 7 deletions
diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua index e8d2cdd53..3000c9f28 100644 --- a/tests/plugins/pack/xmake.lua +++ b/tests/plugins/pack/xmake.lua @@ -39,9 +39,12 @@ xpack("test") end) after_installcmd(function (package, batchcmds) - batchcmds:mkdir(package:installdir("resources")) - batchcmds:cp("src/assets/*.txt", package:installdir("resources"), {rootdir = "src"}) - batchcmds:mkdir(package:installdir("stub")) + if package:from_source() then + else + batchcmds:mkdir(package:installdir("resources")) + batchcmds:cp("src/assets/*.txt", package:installdir("resources"), {rootdir = "src"}) + batchcmds:mkdir(package:installdir("stub")) + end end) after_uninstallcmd(function (package, batchcmds) diff --git a/xmake/plugins/pack/runself/main.lua b/xmake/plugins/pack/runself/main.lua index 91d1f9426..8f5774f61 100644 --- a/xmake/plugins/pack/runself/main.lua +++ b/xmake/plugins/pack/runself/main.lua @@ -130,9 +130,23 @@ function _pack_runself(makeself, package) return value end) - -- install the setup.sh script - local installdir = package:installdir() - local setupfile = path.join(installdir, "__setup__.sh") + -- archive source files + local srcfiles, dstfiles = package:sourcefiles() + for idx, srcfile in ipairs(srcfiles) do + os.vcp(srcfile, dstfiles[idx]) + end + for _, component in table.orderpairs(package:components()) do + if component:get("default") ~= false then + local srcfiles, dstfiles = component:sourcefiles() + for idx, srcfile in ipairs(srcfiles) do + os.vcp(srcfile, dstfiles[idx]) + end + end + end + + -- generate the setup.sh script + local sourcedir = package:sourcedir() + local setupfile = path.join(sourcedir, "__setup__.sh") os.cp(path.join(os.programdir(), "scripts", "xpack", "runself", "setup.sh"), setupfile) local scriptfile = io.open(setupfile, "a+") if scriptfile then @@ -147,7 +161,7 @@ function _pack_runself(makeself, package) -- make package os.vrunv(makeself, {"--gzip", "--sha256", "--lsm", specfile, - installdir, package:outputfile(), package:basename(), "./__setup__.sh"}) + sourcedir, package:outputfile(), package:basename(), "./__setup__.sh"}) end function main(package) |
