Skip to content

Add sat package --build_msi to build a Windows MSI installer#6

Open
mariam-simvia wants to merge 1 commit into
SalomePlatform:masterfrom
simvia-tech:feat/build-msi
Open

Add sat package --build_msi to build a Windows MSI installer#6
mariam-simvia wants to merge 1 commit into
SalomePlatform:masterfrom
simvia-tech:feat/build-msi

Conversation

@mariam-simvia

Copy link
Copy Markdown

@mohd-afeef-badri @nitawa as discussed during our video call a few weeks ago, here are the changes needed in SAT to implement a Windows build mechanism.

What it does

Adds a --build_msi option to the package command. On Windows, it builds an MSI installer of an application from its compiled files:

sat package SALOME-9.16.0-windows --build_msi

The code added to SAT is generic: it knows nothing about SALOME. Everything specific to SALOME (the WiX files, the launchers, the icon, the product list) is provided by the project in an installer section of its config. So this can build an MSI for any project, not just SALOME.

Files

File Change
commands/package.py adds the --build_msi option and calls the builder
src/msi.py new file: builds the MSI (prepares the files, generates the WiX source, runs wix build)

How it works

sat package <app> --build_msi
   1. read the 'installer' section from the config
   2. gather in <workdir>\MSI :
        - the installer files from the project (Package.wxs, launchers, icon, scripts)
        - the app launcher/env files (salome, env_launch.bat)
        - the compiled W64 tree
   3. run the project's pre-build script (optional: SALOME runtime fixes)
   4. generate w64_files.wxs  (one component per folder)
   5. run: wix build Package.wxs shortcuts.wxs w64_files.wxs  ->  the .msi

One component per folder (not per file): SALOME has about 156,000 files. With one component per file the MSI would go over its hard limit of 65,536 components. Grouping files by folder keeps it around 10,000.

The installer config section

The project provides it (for SALOME it is in salome-W10.pyconf). SAT reads it; nothing is hard-coded in SAT. It contains:

  • resources_dir: where the WiX files and launchers are
  • wxs_sources: the WiX source files to compile (Package.wxs, shortcuts.wxs)
  • pre_build_script: an optional script SAT runs before building
  • wix_arch, wix_extensions: the architecture and the WiX extensions passed to wix build
  • generated_wxs, guid_namespace, staging_dir: name of the generated file, GUID namespace, and (optional) where to build
  • tree: the rules to walk the install: which top-level files/folders to include (root_install_files, install_dirs), which folders/products to skip (skip_dirs, skip_products), and how each product folder maps to a WiX component group (product_groups)

SAT looks for this section first on the application, then on the project, so one definition can serve all the project's applications.

Usage

sat package SALOME-9.16.0-windows --build_msi

Result: <workdir>\MSI\build\<app>-win64.msi. Use --name to change the file name.

Requirements

Windows, WiX Toolset v4 or higher on PATH, and a project that defines the installer section. If something is missing, the command stops with a clear message (no half-built output).

Testing

  • Built the full SALOME 9.15.0 MSI (about 128,000 files, about 7,500 components) from a SAT install; the installer runs and SALOME launches.

Impact

Optional and additive. Without --build_msi, package behaves exactly as before. On non-Windows it just prints a "Windows only" message. No SALOME-specific data is added to SAT.

Add a generic MSI builder (src/msi.py) and a --build_msi option to the
package command. On Windows, it assembles a staging tree from the
application install output plus the project's installer resources, runs
an optional project staging script, generates a WiX v4 source (one
Component per directory, to stay under MSI's 65536-component limit), and
invokes 'wix build'.

The builder is project-agnostic: all project-specific data (WiX
Package.wxs, branding, launchers, product->ComponentGroup map, product
exclusions) comes from an APPLICATION.installer config section provided
by the project (e.g. sat_salome/installer/windows for SALOME).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant