diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 18476dd7e..270813554 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -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 diff --git a/build-local-dev.sh b/build-local-dev.sh new file mode 100644 index 000000000..39a6741d0 --- /dev/null +++ b/build-local-dev.sh @@ -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"