-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_glsp_integration.sh
More file actions
executable file
·130 lines (110 loc) · 4.26 KB
/
setup_glsp_integration.sh
File metadata and controls
executable file
·130 lines (110 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# Detect OS
OS=$(uname -s)
ARCH=$(uname -m)
# Look for the Eclipse executable in the products folder
PRODUCTS_DIR="glsp-eclipse-integration/server/releng/org.eclipse.glsp.ide.repository/target/products/"
if [[ "$OS" == "Linux" ]]; then
# Find the Eclipse executable for Linux
ECLIPSE_EXEC=$(find "$PRODUCTS_DIR" -maxdepth 1 -type f -name "eclipse" | head -n 1)
elif [[ "$OS" == "Darwin" ]]; then
# Find the Eclipse executable for macOS
ECLIPSE_EXEC=$(find "$PRODUCTS_DIR" -maxdepth 1 -type d -name "Eclipse.app" | head -n 1)
elif [[ "$OS" =~ CYGWIN|MINGW|MSYS ]]; then
# Find the Eclipse executable for Windows
ECLIPSE_EXEC=$(find "$PRODUCTS_DIR" -maxdepth 1 -type f -name "eclipse.exe" | head -n 1)
else
echo "Unsupported OS: $OS"
exit 1
fi
# If the executable wasn't found, proceed with setup
if [[ -z "$ECLIPSE_EXEC" ]]; then
echo "Eclipse executable not found. Proceeding with the full process..."
# Navigate to the integration directory
cd glsp-eclipse-integration || { echo "Could not find the glsp-eclipse-integration folder"; exit 1; }
echo "Installing client dependencies..."
cd client || { echo "Could not find the glsp-eclipse-integration/client folder"; exit 1; }
yarn install
echo "Building the server..."
cd ../server || { echo "Could not find the glsp-eclipse-integration/server folder"; exit 1; }
mvn clean install
# Navigate to the products directory
cd releng/org.eclipse.glsp.ide.repository/target/products/ || { echo "Could not find products folder"; exit 1; }
echo "Looking for the appropriate package to extract..."
# Determine the appropriate package based on OS
case "$OS" in
Linux)
ZIP_FILE=$(ls *linux*.tar.gz | head -n 1)
;;
Darwin)
if [[ "$ARCH" == "arm64" ]]; then
ZIP_FILE=$(ls *macosx.cocoa.aarch64*.tar.gz | head -n 1)
else
ZIP_FILE=$(ls *macosx.cocoa.x86_64*.tar.gz | head -n 1)
fi
;;
CYGWIN*|MINGW*|MSYS*|Windows)
ZIP_FILE=$(ls *win32*.zip | head -n 1)
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
if [[ -z "$ZIP_FILE" ]]; then
echo "No appropriate package found for your OS."
exit 1
fi
echo "Extracting package: $ZIP_FILE"
# Extract the package
if [[ "$ZIP_FILE" == *.tar.gz ]]; then
tar -xzf "$ZIP_FILE"
else
unzip -o "$ZIP_FILE"
fi
cd ../../../../../../
# Find the newly extracted Eclipse executable
ECLIPSE_EXEC=$(find "$PRODUCTS_DIR" -maxdepth 2 -type f \( -name "eclipse" -o -name "Eclipse.app" -o -name "eclipse.exe" \) | head -n 1)
if [[ -z "$ECLIPSE_EXEC" ]]; then
echo "Eclipse executable still not found after extraction. Exiting."
exit 1
fi
fi
# Ensure the executable is found before proceeding
echo "Eclipse executable found: $ECLIPSE_EXEC"
echo "Current directory: $(pwd)"
# Set workspace path
WORKSPACE_PATH=$(cd resources/workspace/ && pwd)
echo "Workspace path is: $WORKSPACE_PATH"
# Convert to Windows path if needed
if [[ "$OS" =~ CYGWIN|MINGW|MSYS|Windows ]]; then
WORKSPACE_PATH=$(cygpath -w "$WORKSPACE_PATH")
fi
# Ensure the workspace directory has correct permissions
echo "Setting write permissions on the workspace directory..."
chmod -R u+w "$WORKSPACE_PATH"
if [[ ! -d "$WORKSPACE_PATH" ]]; then
echo "Workspace path does not exist: $WORKSPACE_PATH"
exit 1
fi
# Set executable permissions on Eclipse
echo "Setting executable permissions on $ECLIPSE_EXEC..."
chmod +x "$ECLIPSE_EXEC"
# Run Eclipse with the specified workspace
echo "Launching Eclipse with workspace at $WORKSPACE_PATH..."
case "$ECLIPSE_EXEC" in
*.app)
# Launch Eclipse on macOS
ABSOLUTE_EXEC=$(cd "$(dirname "$ECLIPSE_EXEC")" && pwd)/$(basename "$ECLIPSE_EXEC")
open -a "$ABSOLUTE_EXEC" --args -nosplash -data "$WORKSPACE_PATH"
;;
*.exe)
# Launch Eclipse on Windows
"$ECLIPSE_EXEC" -nosplash -data "$WORKSPACE_PATH"
;;
*)
# Launch Eclipse on Linux
"$ECLIPSE_EXEC" -nosplash -data "$WORKSPACE_PATH"
;;
esac
echo "Eclipse has been started successfully and the project has been imported!"