Class InnoSetup

java.lang.Object
io.github.intisy.gradle.inno.impl.InnoSetup

public class InnoSetup extends Object
Orchestrates preparing sources and invoking Inno Setup to build a Windows installer.

Handles copying inputs (executable, JRE, optional icon), generating the Inno Setup script, downloading the tool (cached under Gradle home), and executing the compiler to produce the final installer.

  • Constructor Summary

    Constructors
    Constructor
    Description
    InnoSetup(Logger logger)
    Creates a new InnoSetup helper bound to the given project build path and inputs.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Builds the installer by preparing sources, generating the script, and invoking Inno Setup.
    void
    Copies input executable, JRE, and optional icon into the build source directory.
    void
    Creates the Inno Setup script file used by the compiler.
    void
    log(String log)
    Logs a message if debug mode is enabled.
    void
    setAutoStart(boolean autoStart)
    Enables or disables creating a Startup entry to auto-launch the app after login.
    void
    setAutoStartParameters(List<String> autoStartParameters)
    Sets optional parameters passed to the app when launched from Startup.
    void
    setDebug(boolean debug)
    Enables debug logging of the Inno Setup process output.
    void
    setIconFile(File iconFile)
    Sets an optional icon file for the installer and shortcuts.
    void
    setInnoBuildPath(Path innoBuildPath)
    Sets the Inno Setup build directory.
    void
    setInputFile(File inputFile)
    Sets the application executable to package.
    void
    setJrePath(Path jrePath)
    Sets the path to a bundled JRE to include in the installer.
    void
    Sets the application display name.
    void
    setOutputFile(File outputFile)
    Sets the resulting installer file destination.
    void
    setParameters(List<String> parameters)
    Sets optional parameters passed to the app when launched post-install.
    void
    setVersion(String version)
    Sets the application version written to the installer metadata.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InnoSetup

      public InnoSetup(Logger logger)
      Creates a new InnoSetup helper bound to the given project build path and inputs.
      Parameters:
      logger - logger to use for logging messages
  • Method Details

    • setName

      public void setName(String name)
      Sets the application display name.
      Parameters:
      name - application display name
    • setInnoBuildPath

      public void setInnoBuildPath(Path innoBuildPath)
      Sets the Inno Setup build directory.
      Parameters:
      innoBuildPath - Inno Setup build directory
    • setInputFile

      public void setInputFile(File inputFile)
      Sets the application executable to package.
      Parameters:
      inputFile - executable file to package
    • setOutputFile

      public void setOutputFile(File outputFile)
      Sets the resulting installer file destination.
      Parameters:
      outputFile - installer file destination
    • setAutoStart

      public void setAutoStart(boolean autoStart)
      Enables or disables creating a Startup entry to auto-launch the app after login.
      Parameters:
      autoStart - true to add a Startup shortcut, false otherwise
    • setIconFile

      public void setIconFile(File iconFile)
      Sets an optional icon file for the installer and shortcuts.
      Parameters:
      iconFile - ICO file to use as setup icon
    • setVersion

      public void setVersion(String version)
      Sets the application version written to the installer metadata.
      Parameters:
      version - version string (e.g., 1.2.3)
    • setJrePath

      public void setJrePath(Path jrePath)
      Sets the path to a bundled JRE to include in the installer.
      Parameters:
      jrePath - path to the JRE directory
    • setDebug

      public void setDebug(boolean debug)
      Enables debug logging of the Inno Setup process output.
      Parameters:
      debug - true to print logs, false to silence
    • setAutoStartParameters

      public void setAutoStartParameters(List<String> autoStartParameters)
      Sets optional parameters passed to the app when launched from Startup.
      Parameters:
      autoStartParameters - list of parameters, or null for none
    • setParameters

      public void setParameters(List<String> parameters)
      Sets optional parameters passed to the app when launched post-install.
      Parameters:
      parameters - list of parameters, or null for none
    • log

      public void log(String log)
      Logs a message if debug mode is enabled.
      Parameters:
      log - message to print
    • buildInstaller

      public void buildInstaller() throws IOException, InterruptedException
      Builds the installer by preparing sources, generating the script, and invoking Inno Setup.
      Throws:
      IOException - if file operations fail
      InterruptedException - if the external process is interrupted
    • copySourceFiles

      public void copySourceFiles() throws IOException
      Copies input executable, JRE, and optional icon into the build source directory.
      Throws:
      IOException - if copy operations fail
    • createInnoSetupScript

      public void createInnoSetupScript(File scriptPath) throws IOException
      Creates the Inno Setup script file used by the compiler.
      Parameters:
      scriptPath - output path for the generated .iss script
      Throws:
      IOException - if writing the file fails