Skip to content

Commit

Permalink
Windows installer: Generate WiX includes for bundled files.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinling committed Jul 10, 2024
1 parent d20b704 commit afa8337
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 222 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ jobs:
python wix/vcpkg_licenses.py > wix/LICENSE-dynamic-libraries.txt
if: matrix.os == 'windows-latest'

- name: Generate components (Windows)
run: |
python wix/generate_components.py
if: matrix.os == 'windows-latest'

- name: Build installer (Windows)
run: cargo wix --no-build --nocapture -v
if: matrix.os == 'windows-latest'
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/target
/tests/*/output.txt
/tests/ui/*/output.txt
/wix/full-licenses
/wix/dll-components.wxi
/wix/dll-references.wxi
/wix/license-components.wxi
/wix/license-references.wxi
/wix/LICENSE-packetry.txt
/wix/LICENSE-static-libraries.txt
/wix/LICENSE-dynamic-libraries.txt
/vcpkg
50 changes: 0 additions & 50 deletions wix/dll-components.wxi

This file was deleted.

50 changes: 0 additions & 50 deletions wix/dll-refs.wxi

This file was deleted.

47 changes: 47 additions & 0 deletions wix/generate-components.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from contextlib import redirect_stdout
import os

dll_components = open('wix/dll-components.wxi', 'w')
dll_references = open('wix/dll-references.wxi', 'w')
license_components = open('wix/license-components.wxi', 'w')
license_references = open('wix/license-references.wxi', 'w')

output_files = [
dll_components,
dll_references,
license_components,
license_references
]

for file in output_files:
print("<Include>", file=file)

bin_dir = '$(env.VCPKG_INSTALLED_DIR)/x64-windows/bin'

for line in open('wix/required-dlls.txt', 'r'):
filename, guid = line.rstrip().split(' ')
component = filename.replace('-', '_')
with redirect_stdout(dll_components):
print(f" <Component Id='{component}' Guid='{guid}'>")
print(f" <File Id='{component}'")
print(f" Name='{filename}'")
print(f" DiskId='1'")
print(f" Source='{bin_dir}/{filename}'/>")
print(f" </Component>")
with redirect_stdout(dll_references):
print(f" <ComponentRef Id='{component}'/>")

for filename in os.listdir('wix/full-licenses'):
component = filename.replace('-', '_')
with redirect_stdout(license_components):
print(f" <Component Id='{component}' Guid='*'>")
print(f" <File Id='{component}'")
print(f" Name='{filename}'")
print(f" DiskId='1'")
print(f" Source='wix/full-licenses/{filename}'/>")
print(f" </Component>")
with redirect_stdout(license_references):
print(f" <ComponentRef Id='{component}'/>")

for file in output_files:
print("</Include>", file=file)
Loading

0 comments on commit afa8337

Please sign in to comment.