Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/1849[#1849]: Add VSCodium support
* https://github.com/devonfw/IDEasy/issues/1391[#1391]: Fix bashrc messed with terraform completions
* https://github.com/devonfw/IDEasy/issues/1922[#1922]: Add Task CLI to IDEasy commandlets
* https://github.com/devonfw/IDEasy/issues/2000[#2000]: Add local dev build script
* https://github.com/devonfw/IDEasy/issues/1966[#1966]: Support separate VSCodium plugins
* https://github.com/devonfw/IDEasy/issues/1518[#1518]: Add per-project uv tool isolation using UV_TOOL_DIR and UV_TOOL_BIN_DIR
* https://github.com/devonfw/IDEasy/issues/1719[#1719]: Add Rust and MSVC support
Expand Down
113 changes: 113 additions & 0 deletions build-local-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/usr/bin/env bash
set -euo pipefail

if [ -z "${IDE_ROOT:-}" ]; then
echo "Error: IDE_ROOT is not set."
exit 1
fi

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/../../.." && pwd)"

CLI_DIR="$SCRIPT_DIR/cli"
TARGET_DIR="$CLI_DIR/target"
PACKAGE_DIR="$CLI_DIR/src/main/package"

PROJECT_SOFTWARE_DIR="$PROJECT_DIR/software"
GRAALVM_DIR="$PROJECT_SOFTWARE_DIR/extra/graalvm"

LOCAL_DEV="$IDE_ROOT/_ide/software/maven/ideasy/ideasy/local-dev"
INSTALLATION_LINK="$IDE_ROOT/_ide/installation"

echo "Building IDEasy native image..."

if [ ! -d "$GRAALVM_DIR" ]; then
echo "Error: GraalVM is not installed for this IDEasy project:"
echo "$GRAALVM_DIR"
echo
echo "Please install GraalVM first:"
echo "ideasy install graalvm"
exit 1
fi

export PATH="$GRAALVM_DIR/bin:$PATH"

cd "$CLI_DIR"
mvn -B -ntp -Pnative -DskipTests=true package

echo "Preparing local-dev installation..."
rm -rf "$LOCAL_DEV"
mkdir -p "$LOCAL_DEV"

echo "Copying package contents..."

if [ ! -d "$PACKAGE_DIR" ]; then
echo "Error: Package directory not found: $PACKAGE_DIR"
exit 1
fi

cp -R "$PACKAGE_DIR"/. "$LOCAL_DEV"/

OS_NAME="$(uname -s)"
if [[ "$OS_NAME" == MINGW* || "$OS_NAME" == MSYS* || "$OS_NAME" == CYGWIN* ]]; then
echo "Removing macOS-specific package files for Windows installation..."
rm -rf "$LOCAL_DEV/system/mac"
fi

echo "Creating local-dev software version marker..."
echo "local-dev-version" > "$LOCAL_DEV/.ide.software.version"

mkdir -p "$LOCAL_DEV/bin"

echo "Copying IDEasy executable and native libraries..."

if [ -f "$TARGET_DIR/ideasy.exe" ]; then
cp "$TARGET_DIR/ideasy.exe" "$LOCAL_DEV/bin/ideasy.exe"
fi

if [ -f "$TARGET_DIR/ideasy" ]; then
cp "$TARGET_DIR/ideasy" "$LOCAL_DEV/bin/ideasy"
chmod +x "$LOCAL_DEV/bin/ideasy"
fi

if [ ! -f "$LOCAL_DEV/bin/ideasy.exe" ] && [ ! -f "$LOCAL_DEV/bin/ideasy" ]; then
echo "Error: No ideasy executable found in $TARGET_DIR"
exit 1
fi

if [ -f "$LOCAL_DEV/functions" ]; then
chmod +x "$LOCAL_DEV/functions"
fi

if [ -f "$LOCAL_DEV/setup" ]; then
chmod +x "$LOCAL_DEV/setup"
fi

echo "Updating IDEasy installation link..."

if ! command -v ideasy > /dev/null 2>&1; then
echo "Error: ideasy command not found."
exit 1
fi

IDEASY_CMD="$(readlink -f "$(command -v ideasy)")"

if [ -L "$INSTALLATION_LINK" ]; then
unlink "$INSTALLATION_LINK"
elif [ -e "$INSTALLATION_LINK" ]; then
echo "Error: $INSTALLATION_LINK exists but is not a symbolic link."
echo "Aborting to avoid deleting a real folder."
exit 1
fi

"$IDEASY_CMD" ln -s "$LOCAL_DEV" "$INSTALLATION_LINK"

echo "Done."
echo "You can test it with:"
echo "ide ..."
echo
echo "To switch back to the latest stable IDEasy version, run:"
echo "ideasy upgrade --mode=stable"
echo
echo "To switch to the latest snapshot IDEasy version, run:"
echo "ideasy upgrade --mode=snapshot"