xmake icon indicating copy to clipboard operation
xmake copied to clipboard

Xpack: wix toolset support

Open A2va opened this issue 11 months ago • 3 comments

Closes #4637

TODO:

  • [x] Add to PATH
  • [x] Add xpack components
  • [x] Submit package to xmake-repo

There are two drawbacks:

  • From what I have learned with the wix toolset, you cannot set the order of the actions (installing files, creating folders). So the commands set in before_installcmd or after_installcmd can be executed at the same time.
  • The actions that wix can perform are limited, so the move and cd commands are not supported.

A2va avatar Mar 01 '24 16:03 A2va

Does it ready now?

waruqi avatar May 23 '24 14:05 waruqi

There are a few things missing (unit tests, ...), I will test again tomorrow and the review can be done this weekend. If anyone wants to try and provide feedback, I will be happy to take it.

A2va avatar May 23 '24 15:05 A2va

you can add this new format in test.

https://github.com/xmake-io/xmake/blob/c31fa8ffad9d5abe9b70724d843400bbe2bde4cf/tests/plugins/pack/xmake.lua#L22

it will be tested on ci.

waruqi avatar May 23 '24 15:05 waruqi

Thanks, I will test it in these days.

waruqi avatar May 27 '24 07:05 waruqi

I tried it, but I get some errors.

> xmake pack -f wix
packing build\xpack\test\test-windows-x64-v1.0.0.msi
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> wixtoolset 5.0.0
please input: y (y/n/m)

  => install wixtoolset 5.0.0 .. ok
error: wix.exe : error WIX0144: The extension 'WixToolset.UI.wixext' could not be found. Checked paths: WixToolset.UI.wixext
wix build build\.xpack\test\test-windows-x64-v1.0.0.wxs -ext WixToolset.UI.wixext -o build\xpack\test\test-windows-x64-v1.0.0.msi -arch x64
wix.exe : error WIX0144: The extension 'WixToolset.UI.wixext' could not be found. Checked paths: WixToolset.UI.wixext
error: @programdir\core\main.lua:314: @programdir\core\sandbox\modules\os.lua:378: execv(wix build build\.xpack\test\test-windows-x64-v1.0.0.wxs -ext WixToolset.UI.wixext -o build\xpack\test\test-windows-x64-v1.0.0.msi -arch x64) failed(144)

waruqi avatar May 27 '24 07:05 waruqi

I think I know why. The WIX_EXTENSIONS env is registered as C:\Users\runneradmin\AppData\Local\.xmake\packages\w\wixtoolset\5.0.0\361647656cc344cc8086fd2a7e53dd19\bin in the manifest.txt It's certainly because it downloaded wix from the precompiled package, at least that is the the case on my end.

in xmake-repo:
  -> wixtoolset 5.0.0
please input: y (y/n/m)
y
  => download https://github.com/xmake-mirror/build-artifacts/releases/download/wixtoolset-5.0.0/windows-x64-vc14.39.33519-361647656cc344cc8086fd2a7e53dd19.7z .. ok
  => install wixtoolset 5.0.0 .. ok

A2va avatar May 27 '24 08:05 A2va

        package:addenv("WIX_EXTENSIONS", package:installdir("bin"))

We should set relative path.

        package:addenv("WIX_EXTENSIONS", "bin")

waruqi avatar May 27 '24 08:05 waruqi

https://github.com/xmake-io/xmake-repo/pull/4170

waruqi avatar May 27 '24 08:05 waruqi

I tried it again, there are some different points.

different component default value status

mix

image

nsis

image

different install root path

mix

image

nsis

image

waruqi avatar May 27 '24 14:05 waruqi

I think I know why. The WIX_EXTENSIONS env is registered as C:\Users\runneradmin\AppData\Local\.xmake\packages\w\wixtoolset\5.0.0\361647656cc344cc8086fd2a7e53dd19\bin in the manifest.txt It's certainly because it downloaded wix from the precompiled package, at least that is the the case on my end.

in xmake-repo:
  -> wixtoolset 5.0.0
please input: y (y/n/m)
y
  => download https://github.com/xmake-mirror/build-artifacts/releases/download/wixtoolset-5.0.0/windows-x64-vc14.39.33519-361647656cc344cc8086fd2a7e53dd19.7z .. ok
  => install wixtoolset 5.0.0 .. ok

I fixed it, at least the first run, it works. But the second run still has this problem.

But when running wix for the second time it still has the problem.

waruqi avatar May 27 '24 14:05 waruqi

And you can add wix to https://github.com/xmake-io/xmake/blob/master/core/xpack.lua to test xmake installer.

waruqi avatar May 27 '24 14:05 waruqi

You can continue to improve it to wix branch. https://github.com/xmake-io/xmake/pull/5153

And I will aslo improve it.

waruqi avatar May 27 '24 14:05 waruqi

I think I know why. The WIX_EXTENSIONS env is registered as C:\Users\runneradmin\AppData\Local\.xmake\packages\w\wixtoolset\5.0.0\361647656cc344cc8086fd2a7e53dd19\bin in the manifest.txt It's certainly because it downloaded wix from the precompiled package, at least that is the the case on my end.

in xmake-repo:
  -> wixtoolset 5.0.0
please input: y (y/n/m)
y
  => download https://github.com/xmake-mirror/build-artifacts/releases/download/wixtoolset-5.0.0/windows-x64-vc14.39.33519-361647656cc344cc8086fd2a7e53dd19.7z .. ok
  => install wixtoolset 5.0.0 .. ok

I fixed it, at least the first run, it works. But the second run still has this problem.

But when running wix for the second time it still has the problem.

I have fixed it.

waruqi avatar May 27 '24 15:05 waruqi