Skip to content

Commit ee11c67

Browse files
pditommasoclaude
andcommitted
Simplify native build and update configuration
- Rename binary to nlsp - Use macos-intel and macos-silicon platform names - Remove packaging from build script (upload raw binary instead) - Simplify detect_platform function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 2b06d60 commit ee11c67

File tree

3 files changed

+10
-65
lines changed

3 files changed

+10
-65
lines changed

.github/workflows/build-native.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
- os: ubuntu-24.04-arm
3535
platform: linux-arm64
3636
- os: macos-latest-large
37-
platform: macos-amd64
37+
platform: macos-intel
3838
- os: macos-latest-xlarge
39-
platform: macos-arm64
39+
platform: macos-silicon
4040

4141
steps:
4242
- name: Checkout repository
@@ -61,14 +61,14 @@ jobs:
6161
uses: actions/upload-artifact@v4
6262
with:
6363
name: nf-language-server-${{ matrix.platform }}
64-
path: build/dist/nf-language-server-${{ matrix.platform }}.tar.gz
64+
path: build/native/nativeCompile/nlsp
6565
retention-days: 7
6666

6767
release:
6868
name: Create Release
6969
needs: build
7070
runs-on: ubuntu-latest
71-
if: startsWith(github.ref, 'refs/tags/v')
71+
if: contains(github.event.head_commit.message, '[release]')
7272
permissions:
7373
contents: write
7474

build-native.sh

Lines changed: 5 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ set -euo pipefail
33

44
#
55
# Build script for GraalVM native image of nf-language-server
6-
# Supports: linux/amd64, linux/arm64, darwin/arm64 (Apple Silicon)
6+
# Supports: linux/amd64, linux/arm64, macos/amd64, macos/arm64 (Apple Silicon)
77
#
88
# Usage:
99
# ./build-native.sh [options]
1010
#
1111
# Options:
1212
# --skip-test Skip testing the native binary
13-
# --skip-package Skip packaging the binary
1413
# --help, -h Show this help message
1514
#
1615

@@ -86,49 +85,27 @@ check_requirements() {
8685
# Detect platform
8786
detect_platform() {
8887
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
89-
ARCH="$(uname -m)"
90-
91-
case "$ARCH" in
92-
x86_64|amd64)
93-
ARCH="amd64"
94-
;;
95-
aarch64|arm64)
96-
ARCH="arm64"
97-
;;
98-
*)
99-
log_error "Unsupported architecture: $ARCH"
100-
exit 1
101-
;;
102-
esac
10388

10489
case "$OS" in
105-
linux)
106-
PLATFORM="linux-$ARCH"
107-
BINARY_EXT=""
108-
;;
109-
darwin)
110-
PLATFORM="macos-$ARCH"
90+
linux|darwin)
11191
BINARY_EXT=""
11292
;;
11393
mingw*|msys*|cygwin*)
114-
PLATFORM="windows-$ARCH"
11594
BINARY_EXT=".exe"
11695
;;
11796
*)
11897
log_error "Unsupported OS: $OS"
11998
exit 1
12099
;;
121100
esac
122-
123-
log_info "Detected platform: $PLATFORM"
124101
}
125102

126103
# Build native image (includes shadow jar, tracing agent, and native compilation)
127104
build_native_image() {
128105
log_info "Building native image (this includes JAR build and tracing agent)..."
129106
./gradlew nativeCompile --no-configuration-cache --no-daemon
130107

131-
local BINARY_PATH="build/native/nativeCompile/nf-language-server${BINARY_EXT}"
108+
local BINARY_PATH="build/native/nativeCompile/nlsp${BINARY_EXT}"
132109
if [[ -f "$BINARY_PATH" ]]; then
133110
log_info "Native image built successfully: $BINARY_PATH"
134111
ls -lh "$BINARY_PATH"
@@ -142,7 +119,7 @@ build_native_image() {
142119
test_native_binary() {
143120
log_info "Testing native binary..."
144121

145-
local BINARY_PATH="build/native/nativeCompile/nf-language-server${BINARY_EXT}"
122+
local BINARY_PATH="build/native/nativeCompile/nlsp${BINARY_EXT}"
146123
local OUTPUT
147124

148125
OUTPUT=$(./lsp-simulator.sh | "$BINARY_PATH" 2>&1 | head -20)
@@ -156,30 +133,10 @@ test_native_binary() {
156133
fi
157134
}
158135

159-
# Package the binary
160-
package_binary() {
161-
log_info "Packaging binary for $PLATFORM..."
162-
163-
local BINARY_PATH="build/native/nativeCompile/nf-language-server${BINARY_EXT}"
164-
local DIST_DIR="build/dist"
165-
local ARCHIVE_NAME="nf-language-server-$PLATFORM"
166-
167-
mkdir -p "$DIST_DIR"
168-
169-
if [[ "$OS" == "darwin" ]] || [[ "$OS" == "linux" ]]; then
170-
tar -czvf "$DIST_DIR/$ARCHIVE_NAME.tar.gz" -C "build/native/nativeCompile" "nf-language-server${BINARY_EXT}"
171-
log_info "Created: $DIST_DIR/$ARCHIVE_NAME.tar.gz"
172-
else
173-
# Windows - create zip
174-
(cd "build/native/nativeCompile" && zip -r "../../../$DIST_DIR/$ARCHIVE_NAME.zip" "nf-language-server${BINARY_EXT}")
175-
log_info "Created: $DIST_DIR/$ARCHIVE_NAME.zip"
176-
fi
177-
}
178136

179137
# Main build process
180138
main() {
181139
local SKIP_TEST=false
182-
local SKIP_PACKAGE=false
183140

184141
# Parse arguments
185142
while [[ $# -gt 0 ]]; do
@@ -188,18 +145,13 @@ main() {
188145
SKIP_TEST=true
189146
shift
190147
;;
191-
--skip-package)
192-
SKIP_PACKAGE=true
193-
shift
194-
;;
195148
--help|-h)
196149
echo "Usage: $0 [options]"
197150
echo ""
198151
echo "Build GraalVM native image for nf-language-server"
199152
echo ""
200153
echo "Options:"
201154
echo " --skip-test Skip testing the native binary"
202-
echo " --skip-package Skip packaging the binary"
203155
echo " --help, -h Show this help message"
204156
echo ""
205157
echo "Requirements:"
@@ -225,16 +177,9 @@ main() {
225177
test_native_binary
226178
fi
227179

228-
if [[ "$SKIP_PACKAGE" != "true" ]]; then
229-
package_binary
230-
fi
231-
232180
echo ""
233181
log_info "Build completed successfully!"
234-
log_info "Binary: build/native/nativeCompile/nf-language-server${BINARY_EXT}"
235-
if [[ "$SKIP_PACKAGE" != "true" ]]; then
236-
log_info "Package: build/dist/nf-language-server-$PLATFORM.tar.gz"
237-
fi
182+
log_info "Binary: build/native/nativeCompile/nlsp${BINARY_EXT}"
238183
}
239184

240185
main "$@"

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ graalvmNative {
154154
}
155155
binaries {
156156
main {
157-
imageName = 'nf-language-server'
157+
imageName = 'nlsp'
158158
mainClass = 'nextflow.lsp.NextflowLanguageServer'
159159
buildArgs.addAll([
160160
'--no-fallback',

0 commit comments

Comments
 (0)