Search code examples
deploymentinstallationnsis

How to divide an NSIS script among developers?


I'd like to divide tasks for the development of a NSIS installer among a couple of developers. How can I physically organize the code? Do they have to edit and merge the single .nsi script when they check into SVN? Is it possible to divide NSIS scripts into modular, separate files? This would be ideal.

Thanks!


Solution

  • I use a "main" nsi file that makes up the actual installer generation and MUI code, but it includes "extra" function definitions from nsi files as well as seperate files for each installer "section".

    Example:

    
    !include "LibraryFunction1.nsh"
    !include "LibraryFunction2.nsh"
    !include "LibraryFunction3.nsh"
    
    ; Basic Defines and MUI code Go HERE
    
    ; Output file information
    Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
    OutFile "File-${BUILD_VER_ABRV}-${BUILD_VER_MIN}.exe"
    InstallDir "$PROGRAMFILES\Location\"
    InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
    
    ; now include file sections
    !include "FileSectionDefinition1.nsh"
    !include "FileSectionDefinition2.nsh"
    !include "FileSectionDefinition3.nsh"
    !include "Uninstall.nsh"