-
Notifications
You must be signed in to change notification settings - Fork 84
#423 Added PKG Installer build for macOS systems #2098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f375941
60f3fe3
c99e325
0407383
a210745
51a5cc9
0341a83
b702b31
6bc3d75
b6eda09
46dfdfa
6f61de8
9411f2b
df8a7d8
ce38d00
00fe1d6
7d2c820
4edf07a
b277304
41fadaa
74d918d
01b1a01
5e4a3ad
d615466
4a65320
4ca3d7b
6e89850
bc897c2
6bbd2aa
ca2a9b0
c725c51
6e23343
661e429
45f3e38
c2b337e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,38 @@ jobs: | |
| name: msi | ||
| path: windows-installer/signed/ideasy.msi | ||
|
|
||
| - name: Build MacOS PKG | ||
| if: runner.os == 'macOS' | ||
| shell: bash | ||
| run: | | ||
| maven_config="$(cat .mvn/maven.config)" | ||
| current_version="${maven_config/#*-Drevision=}" | ||
| current_version="${current_version/ */}" | ||
| cd documentation | ||
| mvn -B -ntp clean install | ||
| cd .. | ||
| mkdir -p macos-installer/pkg-root/bin | ||
| mkdir -p macos-installer/Resources | ||
| cp documentation/target/generated-docs/IDEasy.pdf macos-installer/pkg-root/ | ||
| cp documentation/target/generated-docs/LICENSE.rtf macos-installer/Resources/LICENSE.rtf | ||
| cp cli/target/macos-installer/Distribution.xml macos-installer/Distribution.xml | ||
| cp -r cli/target/package/* macos-installer/pkg-root/ | ||
| cp cli/target/ideasy macos-installer/pkg-root/bin/ | ||
| rm -rf macos-installer/pkg-root/system/windows | ||
| rm -rf macos-installer/pkg-root/system/linux | ||
| chmod +x macos-installer/pkg-root/bin/ideasy | ||
| chmod +x macos-installer/scripts/postinstall | ||
| cd macos-installer | ||
| pkgbuild --root pkg-root --identifier com.devonfw.ideasy --version $current_version --install-location /projects/_ide/tmp/ideasy --scripts scripts IDEasyComponent.pkg | ||
| productbuild --distribution Distribution.xml --resources Resources --package-path . ideasy.pkg | ||
| # pkgbuild is responsible for building the installation bundle. By using productbuild, we can custimze the installation process, including things like showing a license. | ||
|
Comment on lines
+98
to
+115
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. workflows are hard to test, read and maintain. |
||
| - name: Upload unsigned PKG | ||
| if: runner.os == 'macOS' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: pkg | ||
| path: macos-installer/ideasy.pkg | ||
|
|
||
| # Downloads all native image artifacts to cli/target and builds the project using assemblies for final deployment to OSSRH Nexus | ||
| deploy: | ||
| name: Build Project and Deploy | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,6 +115,38 @@ jobs: | |
| with: | ||
| name: msi | ||
| path: windows-installer/signed/ideasy.msi | ||
| - name: Build MacOS PKG | ||
| if: runner.os == 'macOS' | ||
| shell: bash | ||
| run: | | ||
| maven_config="$(cat .mvn/maven.config)" | ||
| current_version="${maven_config/#*-Drevision=}" | ||
| current_version="${current_version/ */}" | ||
| next_version="${current_version/-SNAPSHOT/}" | ||
|
Comment on lines
+122
to
+125
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. Use new variables. |
||
| cd documentation | ||
| mvn -B -ntp clean install | ||
| cd .. | ||
| mkdir -p macos-installer/pkg-root/bin | ||
| mkdir -p macos-installer/Resources | ||
| cp documentation/target/generated-docs/IDEasy.pdf macos-installer/pkg-root/ | ||
| cp documentation/target/generated-docs/LICENSE.rtf macos-installer/Resources/LICENSE.rtf | ||
| cp cli/target/macos-installer/Distribution.xml macos-installer/Distribution.xml | ||
| cp -r cli/target/package/* macos-installer/pkg-root/ | ||
| cp cli/target/ideasy macos-installer/pkg-root/bin/ | ||
| rm -rf macos-installer/pkg-root/system/windows | ||
| rm -rf macos-installer/pkg-root/system/linux | ||
| chmod +x macos-installer/pkg-root/bin/ideasy | ||
| chmod +x macos-installer/scripts/postinstall | ||
| cd macos-installer | ||
| pkgbuild --root pkg-root --identifier com.devonfw.ideasy --version $next_version --install-location /projects/_ide/tmp/ideasy --scripts scripts IDEasyComponent.pkg | ||
| productbuild --distribution Distribution.xml --resources Resources --package-path . ideasy.pkg | ||
| # pkgbuild is responsible for building the installation bundle. By using productbuild, we can custimze the installation process, including things like showing a license. | ||
|
Comment on lines
+126
to
+143
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. confirmed that we need to extract as script to avoid this copy&paste redundancies. |
||
| - name: Upload unsigned PKG | ||
| if: runner.os == 'macOS' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: pkg | ||
| path: macos-installer/ideasy.pkg | ||
|
|
||
| # 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. | ||
|
|
@@ -200,6 +232,7 @@ jobs: | |
| * Windows: https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-windows-x64.tar.gz | ||
| * Mac(arm64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-mac-arm64.tar.gz | ||
| * Mac(x64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-mac-x64.tar.gz | ||
| * Mac(PKG): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-mac.pkg | ||
| * Linux(arm64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-linux-arm64.tar.gz | ||
| * Linux(x64): https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/${RELEASE_VERSION}/ide-cli-${RELEASE_VERSION}-linux-x64.tar.gz | ||
| # Changes | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,12 @@ node_modules | |||||
| # generated graphify knowledge graph output (per-developer AI tooling, not shared) | ||||||
| graphify-out/ | ||||||
|
|
||||||
| #macOs installer files | ||||||
| macos-installer/*.pkg | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| macos-installer/Resources/LICENSE.rtf | ||||||
| macos-installer/pkg-root | ||||||
| macos-installer/Distribution.xml | ||||||
|
|
||||||
| # Package Files # | ||||||
| *.jar | ||||||
| *.war | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,6 +196,28 @@ | |
| </resources> | ||
| </configuration> | ||
| </execution> | ||
| <execution> | ||
| <id>Copy Distribution.xml [macOS Installer]</id> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an execution ID is not a descriptive comment but a short unique identifier without spaces and special characters. It may be there to be reference it from CLI or other POMs. |
||
| <phase>validate</phase> | ||
| <goals> | ||
| <goal>copy-resources</goal> | ||
| </goals> | ||
| <configuration> | ||
| <outputDirectory>${project.build.directory}/macos-installer</outputDirectory> | ||
| <delimiters> | ||
| <delimiter>$[*]</delimiter> | ||
| </delimiters> | ||
|
Comment on lines
+207
to
+209
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of copy&paste you should extract this to |
||
| <resources> | ||
| <resource> | ||
| <directory>../macos-installer/src</directory> | ||
| <filtering>true</filtering> | ||
| <includes> | ||
| <include>Distribution.xml</include> | ||
| </includes> | ||
| </resource> | ||
| </resources> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {\rtf1\ansi\ansicpg1252\cocoartf2867 | ||
| \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Arial-BoldMT;\f1\fnil\fcharset0 AndaleMono;} | ||
| {\colortbl;\red255\green255\blue255;} | ||
| {\*\expandedcolortbl;;} | ||
| \paperw7920\paperh11520\margl172\margr172\margb172\margt172\vieww11520\viewh8400\viewkind0 | ||
| \deftab720 | ||
| \pard\pardeftab720\ri0\sa80\partightenfactor0 | ||
|
|
||
| \f0\b\fs24 \cf0 Thank you for using IDEasy.\ | ||
| \ | ||
| You can create your first project now by typing:\ | ||
|
|
||
| \f1\b0 ide create <project-name>\ | ||
| \ | ||
|
|
||
| \f0\b Or see all available commands by typing:\ | ||
|
|
||
| \f1\b0 ide help\ | ||
| \ | ||
|
|
||
| \f0\b If you need more information, take a look at our {\field{\*\fldinst{HYPERLINK "https://github.com/devonfw/IDEasy/blob/main/documentation/setup.adoc"}}{\fldrslt documentation}}.} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| console_user=$(stat -f "%Su" /dev/console) | ||
| console_uid=$(id -u "$console_user") | ||
|
|
||
| show_error() { | ||
| /bin/launchctl asuser "$console_uid" /usr/bin/osascript \ | ||
| -e "display dialog \"$1\" with title \"IDEasy Installer\" buttons {\"OK\"} with icon stop" | ||
| } | ||
|
|
||
| echo "Step 1/2: Running IDEasy installation..." | ||
|
|
||
| INSTALL_DIR="$HOME/projects/_ide/tmp/ideasy" | ||
|
|
||
| echo "Installing IDEasy to $INSTALL_DIR" | ||
|
|
||
| LOG_DIR="$HOME/.ide/logs" | ||
| mkdir -p "$LOG_DIR" | ||
| ts=$(date +"%Y-%m-%d-%H-%M-%S") | ||
| LOG_FILE="$LOG_DIR/install-$ts.log" | ||
|
|
||
| echo "IDEasy installation log for this session can be found at: $LOG_FILE" | ||
|
|
||
| if [ ! -d "$INSTALL_DIR" ]; then | ||
| echo "ERROR: expected install directory not found: $INSTALL_DIR" >&2 | ||
| show_error "IDEasy installation failed: expected directory not found:\n$INSTALL_DIR" | ||
| exit 1 | ||
| fi | ||
|
|
||
| "$INSTALL_DIR/bin/ideasy" -ftb --no-colors install \ | ||
| > "$LOG_FILE" 2>&1 | ||
| install_rc=$? | ||
|
|
||
| # 1. Handle generic install errors by analyzing the log file for known error messages | ||
| if grep -q "ide (install) failed after" "$LOG_FILE"; then | ||
| show_error "IDEasy installation failed. See log:\n$LOG_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # 3. Fallback: Exit-Code != 0 and no error message could be detected in the log file. Show generic error message with log file path. | ||
| if [ $install_rc -ne 0 ]; then | ||
| show_error "IDEasy installation failed (exit code $install_rc). See log:\n$LOG_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Step 2/2: Cleaning up temporary ideasy installation..." | ||
|
|
||
| rm -rf "$INSTALL_DIR" | ||
|
|
||
| echo "Install finished" | ||
|
|
||
| exit 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- This file is the installer configuration file for the macOS pkg-Installer. The next_version placeholder will be replaced during build with the correct version. --> | ||
| <installer-gui-script minSpecVersion="1"> | ||
| <title>IDEasy - $[project.version]</title> | ||
| <license file="LICENSE.rtf"/> | ||
| <conclusion file="CONCLUSION.rtf"/> | ||
| <background file="background.png" alignment="left" scaling="tofit"/> | ||
|
laim2003 marked this conversation as resolved.
|
||
| <background-darkAqua file="background.png" alignment="left" scaling="tofit"/> | ||
| <options customize="never" require-scripts="true"/> | ||
| <domains enable_anywhere="false" | ||
| enable_currentUserHome="true" | ||
| enable_localSystem="false"/> | ||
| <choices-outline> | ||
| <line choice="default"> | ||
| <line choice="com.devonfw.ideasy"/> | ||
| </line> | ||
| </choices-outline> | ||
| <choice id="default"/> | ||
| <choice id="com.devonfw.ideasy" visible="false"> | ||
| <pkg-ref id="com.devonfw.ideasy"/> | ||
| </choice> | ||
| <pkg-ref id="com.devonfw.ideasy" version="$[project.version]" onConclusion="none">IDEasyComponent.pkg</pkg-ref> | ||
| </installer-gui-script> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -287,6 +287,26 @@ | |
| <violationSeverity>error</violationSeverity> | ||
| </configuration> | ||
| </plugin> | ||
|
|
||
| <!-- Clean up macOS installer artifacts --> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO we should improve the design how you integrated this into maven. |
||
| <artifactId>maven-clean-plugin</artifactId> | ||
| <version>3.5.0</version> | ||
| <configuration> | ||
| <filesets> | ||
| <fileset> | ||
| <directory>${basedir}/macos-installer</directory> | ||
| <includes> | ||
| <include>Distribution.xml</include> | ||
| <include>*.pkg</include> | ||
| <include>pkg-root/</include> | ||
| </includes> | ||
| <followSymlinks>false</followSymlinks> | ||
| </fileset> | ||
| </filesets> | ||
| </configuration> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not copy&paste this.
PR #2223 just introduced a clean solution to avoid this.
Please use
RELEASE_VERSIONvariable.