Skip to content

Commit

Permalink
devonfw#420: Create Windows Installer with WixToolset (devonfw#978)
Browse files Browse the repository at this point in the history
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
  • Loading branch information
2 people authored and julia-cap committed Feb 28, 2025
1 parent 1be3589 commit a10e1ae
Show file tree
Hide file tree
Showing 10 changed files with 3,515 additions and 5 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@ jobs:
with:
name: natives-${{ matrix.os }}
path: cli/target/ideasy*
- name: Build MSI with WixToolSet
if: runner.os == 'Windows'
shell: bash
run: |
cd documentation
mvn -B -ntp clean install
cd ..
mkdir -p windows-installer/msi-files
cp documentation/target/generated-docs/IDEasy.pdf windows-installer/msi-files
cp -r cli/target/package/* windows-installer/msi-files
cd windows-installer
dotnet tool install --global wix --version 5.0.2
wix extension add WixToolset.UI.wixext/5.0.2
wix extension add WixToolset.Util.wixext/5.0.2
wix build Package.wxs WixUI_IDEasySetup.wxs -loc Package.en-us.wxl -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -o ideasy.msi
- name: Upload MSI
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: msi
path: windows-installer/ideasy.msi

# Downloads all native image artifacts to cli/target and builds the project using assemblies for final deployment to OSSRH Nexus
deploy:
Expand All @@ -52,10 +73,9 @@ jobs:
- name: Download natives and build project
uses: actions/download-artifact@v4
with:
pattern: natives-*
path: ./cli/target/
- name: Deploy to OSSRH nexus
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dgpg.skip=true -Dstyle.color=always -B -ntp -Passembly,deploy deploy
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dgpg.skip=true -Dstyle.color=always -B -ntp -Passembly,msi,deploy deploy
25 changes: 23 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ jobs:
with:
name: natives-${{ matrix.os }}
path: cli/target/ideasy*
- name: Build MSI with WixToolSet
if: runner.os == 'Windows'
shell: bash
run: |
cd documentation
mvn -B -ntp clean install
cd ..
mkdir -p windows-installer/msi-files
cp documentation/target/generated-docs/IDEasy.pdf windows-installer/msi-files
cp -r cli/target/package/* windows-installer/msi-files
cd windows-installer
dotnet tool install --global wix --version 5.0.2
wix extension add WixToolset.UI.wixext/5.0.2
wix extension add WixToolset.Util.wixext/5.0.2
wix build Package.wxs WixUI_IDEasySetup.wxs -loc Package.en-us.wxl -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -o ideasy.msi
- name: Upload MSI
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: msi
path: windows-installer/ideasy.msi

# Downloads all native image artifacts to cli/target and builds the project using assemblies for final deployment to Maven Central.
# The version number for the next build will be incremented automatically.
Expand All @@ -62,7 +83,6 @@ jobs:
- name: Download natives and build project
uses: actions/download-artifact@v4
with:
pattern: natives-*
path: ./cli/target/
- name: Create assemblies and publish to Apache Maven Central
run: |
Expand All @@ -78,7 +98,7 @@ jobs:
git tag -a "release/${next_version}" -m "tagged version ${next_version}"
export GPG_TTY=$TTY
mkdir -p ./cli/target/
mvn --settings .mvn/settings.xml -B -ntp deploy -Passembly,deploy -Dgpg.pin.entry.mode=loopback -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
mvn --settings .mvn/settings.xml -B -ntp deploy -Passembly,msi,deploy -Dgpg.pin.entry.mode=loopback -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
Expand All @@ -102,6 +122,7 @@ jobs:
git push --tags
noDotVersion="${current_version//.}"
gh release create "release/${current_version}" ./cli/target/*.tar.gz --title "${current_version}" --notes "# Download
* Windows-MSI: https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}.msi
* Windows: https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}-windows-x64.tar.gz
* Mac(arm): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}-mac-arm.tar.gz
* Mac(x64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${current_version}/ide-cli-${current_version}-mac-x64.tar.gz
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE

Release with new features and bugfixes:

* https://github.com/devonfw/IDEasy/issues/420[#420]: Add MSI Build and Deployment
* https://github.com/devonfw/IDEasy/issues/1061[#1061]: Mac: no such file or directory: /_ide/installation/functions
* https://github.com/devonfw/IDEasy/issues/38[#38]: Implement ToolCommandlet for Python

Expand Down
50 changes: 49 additions & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<jline.version>3.24.1</jline.version>
<jansi.version>2.4.1</jansi.version>
<jackson.version>2.18.2</jackson.version>
<build.helper.maven.plugin.version>3.6.0</build.helper.maven.plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -250,13 +251,60 @@
<arg>--enable-url-protocols=http,https</arg>
<arg>-march=compatibility</arg>
<arg>--initialize-at-build-time=org.apache.commons</arg>
<arg>-H:IncludeResourceBundles=com.sun.org.apache.xml.internal.res.XMLErrorResources,com.sun.org.apache.xerces.internal.impl.msg.XMLMessages</arg>
<arg>-H:IncludeResourceBundles=com.sun.org.apache.xml.internal.res.XMLErrorResources,com.sun.org.apache.xerces.internal.impl.msg.XMLMessages
</arg>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>msi</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<move file="${project.basedir}/target/msi/ideasy.msi"
tofile="${project.basedir}/target/${project.artifactId}-${revision}.msi"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build.helper.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.basedir}/target/${project.artifactId}-${revision}.msi</file>
<type>msi</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
16 changes: 16 additions & 0 deletions windows-installer/Package.en-us.wxl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!--
This file contains the declaration of all the localizable strings.
-->
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">

<String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
<String Id="InstallPathDlg_Title" Value="[ProductName] Setup" />
<String Id="InstallPathDlgTitle" Value="{\WixUI_Font_Title}Select Project Folder" />
<String Id="InstallPathDlgDescription" Value="Click Next to install to the default folder or customize with options below." />
<String Id="InstallDirDlgBannerBitmap" Value="WixUI_Bmp_Banner"/>
<String Id="SelectRootDrive" Value="Please choose the drive where you want to install IDEasy:"/>
<String Id="SelectRootDriveText" Value="Please choose the drive where you want to install IDEasy:"/>
<String Id="SelectInstallLocationText" Value="Select your preferred installation location:"/>
<String Id="InstallRootOption" Value="Install in Root Directory (e.g., C:\projects)"/>
<String Id="InstallHomeOption" Value="Install in Home Directory (e.g., C:\Users\YourUsername\projects)"/>
</WixLocalization>
78 changes: 78 additions & 0 deletions windows-installer/Package.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?define ProductName = "IDEasy" ?>
<?define Manufacturer = "devonfw" ?>
<?define ProductVersion = "1.0.0" ?>
<?define UpgradeCode = "1848091f-6184-451b-ba4c-097662e2cfaa" ?>

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="$(var.ProductName)" Manufacturer="$(var.Manufacturer)" Version="$(var.ProductVersion)" UpgradeCode="$(var.UpgradeCode)">
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />

<Feature Id="main">
<!-- Include files that has to be installed -->
<Files Include="msi-files\**" />
</Feature>

<MediaTemplate EmbedCab="yes" />

<!-- Specifying license and bitmap files -->
<WixVariable Id="WixUILicenseRtf" Value=".\assets\LICENSE.rtf" />
<WixVariable Id="WixUIBannerBmp" Value=".\assets\banner.bmp" />

<!-- Specifying Directories and Properties for installation location selection-->
<Property Id="INSTALLTYPE" Value="ROOT" />

<Directory Id="ROOTDIRECTORY">
<Directory Id="INSTALLFOLDER" Name="projects\_ide"/>
</Directory>

<Property Id="USERFOLDER" >
<DirectorySearch Id="userProfileSearch" Depth="0" Path="[%USERPROFILE]" />
</Property>

<Directory Id="USERFOLDER" >
<Directory Id="USERHOMEFOLDER" Name="projects\_ide" />
</Directory>

<!-- Execution of install command-->
<SetProperty
Id="RunInstallAction"
Value="&quot;[%SystemFolder]cmd.exe&quot; /c &quot;[INSTALLFOLDER]bin\ideasy.exe -f install&quot;"
Before="RunInstallAction"
Sequence="execute"
/>
<CustomAction
Id="RunInstallAction"
BinaryRef="Wix4UtilCA_X64"
DllEntry="WixQuietExec"
Execute="deferred"
Impersonate="yes"
Return="check"
/>

<!-- Execution of uninstall command-->
<SetProperty
Id="RunUninstallAction"
Value="&quot;[%SystemFolder]cmd.exe&quot; /c &quot;[INSTALLFOLDER]bin\ideasy.exe -f uninstall&quot;"
Before="RunUninstallAction"
Sequence="execute"
/>
<CustomAction
Id="RunUninstallAction"
BinaryRef="Wix4UtilCA_X64"
DllEntry="WixQuietExec"
Execute="deferred"
Impersonate="yes"
Return="check"
/>

<!-- Specifying when Custom Actions should run -->
<InstallExecuteSequence>
<Custom Action="RunInstallAction" Condition="NOT Installed" Before="InstallFinalize" />
<Custom Action='RunUninstallAction' Condition="Installed AND NOT UPGRADINGPRODUCTCODE" After="InstallInitialize" />
</InstallExecuteSequence>

<!-- Custom UI Reference -->
<ui:WixUI Id="WixUI_InstallDirCustom" InstallDirectory="INSTALLFOLDER" />

</Package>
</Wix>
73 changes: 73 additions & 0 deletions windows-installer/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
:toc: macro
toc::[]

== Building IDEASY MSI Package with WixToolSet v5

=== Prerequisites

Ensure you have the following installed:

- .NET SDK 6.0 or later
- dotnet (supported by IDEasy itself)
- Wixtoolset v.5 `dotnet tool install --global wix --version 5.0.2`

=== Steps to Build the MSI Package

1. **Add the necessary WiX extensions**

cd windows-installer
wix extension add WixToolset.UI.wixext/5.0.2
wix extension add WixToolset.Util.wixext/5.0.2

2. **Build the MSI package**

wix build Package.wxs WixUI_IDEasySetup.wxs -loc Package.en-us.wxl -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -d ProductVersion=${current.version} -o ideasy.msi

== Debugging Installation Issues

To debug the installation process and capture detailed logs, use the following command:

```
msiexec /i IDEASY.msi /l*v install.log
```

This will create a verbose log file (`install.log`) that can help diagnose installation issues.

== Additional Notes

- Ensure that all dependencies and required WiX extensions are correctly installed.
- Verify the generated MSI file to confirm that all components are included as expected.
- Use the log file for troubleshooting any issues encountered during installation.
- Use CMD or Powershell

== Files

link:Package.wxs[Package.wxs]

This file serves as the entry point for the Windows installation process.
It defines custom actions, properties, and the installation logic.
Additionally, it specifies which files should be installed during the process.

Here you can define what files should be included in the installation:

<Files Include="msi-files\**" />

Here you define the script that will be executed after installation:

<SetProperty
Id="RunSetupAction"
Value="&quot;[INSTALLFOLDER]bin\ideasy.exe&quot; -f install"
Before="RunSetupAction"
Sequence="execute"
/>

link:WixUI_IDEasySetup.wxs[WixUI_IDEasySetup.wxs]

This file contains all elements related to the UI for the installation.
You can configure the sequence of UI dialogs, add triggers for custom actions based on UI elements and customize dialogs like the InstallPathDlg, where users can choose their preferred installation directory.
Most of the current UI is inherited by `WixUI_InstallDir.wxs` from WixUI dialog library in WixToolSet.

link:Package.en-us.wxl[Package.en-us.wxl]

A localization file containing text strings for English (US).
By adding further localization files, we can support additional languages.
Loading

0 comments on commit a10e1ae

Please sign in to comment.