Skip to content

Commit f1d7c30

Browse files
committed
Generalize copilot setup steps and extend them for Mac and Windows
1 parent 1a5fdc6 commit f1d7c30

File tree

6 files changed

+34
-33
lines changed

6 files changed

+34
-33
lines changed

.github/instructions/GTK.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ applyTo: "bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/*.c,bundles/org.ecl
77
- The GTK docs can be found here https://www.gtk.org/docs/
88
- Be carefull between the difference of GTK3 and GTK4 we need to check for specific versions in some places already
99
- The GTK3 > GTK4 migration guide can be found here https://docs.gtk.org/gtk4/migrating-3to4.html
10-
- You will find a shell script ./build_gtk.sh that must be used to compile the code for testing changes
10+
- Use the native build instructions in the AGENTS.md file to compile the code for testing changes

.github/workflows/copilot-setup-steps.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,35 @@ on:
1111
jobs:
1212
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
1313
copilot-setup-steps:
14-
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
config:
18+
- { os: 'linux' , runner: ubuntu-latest }
19+
- { os: 'macosx', runner: macos-latest }
20+
- { os: 'win32' , runner: windows-latest }
21+
runs-on: ${{ matrix.config.runner }}
1522
permissions:
1623
contents: read
1724
steps:
1825
- name: Checkout code
19-
uses: actions/checkout@v5
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2027
with:
2128
lfs: false
2229

2330
- name: Set up JDK
24-
uses: actions/setup-java@v5
31+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
2532
with:
2633
java-version: '21'
2734
distribution: 'temurin'
2835
cache: 'maven'
2936

3037
- name: Set up Maven
31-
uses: stCarolas/setup-maven@v5
38+
uses: stCarolas/setup-maven@12eb41b233df95d49b0c11fc1b5bc8312e5d4ce0 # v5.1
3239
with:
3340
maven-version: '3.9.14'
3441
- name: Prepare Linux Build
42+
if: ${{ matrix.config.os == 'linux' }}
3543
run: |
3644
sudo apt-get update -qq
3745
sudo apt-get install -qq -y libgtk-3-dev libgtk-4-dev freeglut3-dev webkit2gtk-driver
38-
mkdir -p /home/runner/build/gtk && mkdir -p /home/runner/build/tmp
39-
40-
echo "cd $GITHUB_WORKSPACE/bundles/org.eclipse.swt && java -Dws=gtk -Darch=x86_64 build-scripts/CollectSources.java -nativeSources '/home/runner/build/gtk'" >> $GITHUB_WORKSPACE/build_gtk.sh
41-
echo "cd /home/runner/build/gtk && SWT_JAVA_HOME=${JAVA_HOME} MODEL=x86_64 OUTPUT_DIR=/home/runner/build/tmp ./build.sh install clean" >> $GITHUB_WORKSPACE/build_gtk.sh
42-
echo "cd $GITHUB_WORKSPACE" >> $GITHUB_WORKSPACE/build_gtk.sh
43-
chmod +x $GITHUB_WORKSPACE/build_gtk.sh
44-

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ jobs:
128128
with:
129129
runner: ${{ matrix.arch == 'x86_64' && 'macos-15-intel' || 'macos-latest' }}
130130
java: ${{ matrix.java }}
131-
native: ${{ matrix.arch == 'x86_64' && 'cocoa.macosx.x86_64' || 'cocoa.macosx.aarch64' }}
131+
native: cocoa.macosx.${{ matrix.arch }}
132132
performance: ${{ contains(github.event.pull_request.labels.*.name, 'performance') }}
133133
runtodotests: ${{ contains(github.event.pull_request.labels.*.name, 'runtodotests') }}

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@ pom.tycho
99
/xdg-runtime-*
1010
/binaries/org.eclipse.swt.*/src/
1111
tmpdir/
12-
# temp build script used by copilot instructions: https://github.com/eclipse-platform/eclipse.platform.swt/blob/c3318b8e7ebc9e34de80afc4f3e5ec15cc7ca112/.github/workflows/copilot-setup-steps.yml#L43
13-
/build_gtk.sh

AGENTS.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,35 @@ SWT consists of two main parts:
3535
# Build the entire project
3636
mvn clean verify
3737

38-
# Build specific platform binary
39-
mvn clean verify -Dnative=gtk.linux.x86_64
38+
# Build (and include) specific platform native binaries
39+
mvn clean verify -Dnative=${target.ws}.<os>.<arch>
4040

4141
# Skip tests
4242
mvn clean verify -DskipTests
4343
```
4444

45-
### Building Natives
45+
### Building native binaries
4646

47-
**GTK (Linux):**
48-
```bash
49-
cd bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library
50-
./build.sh -gtk-all install # Build both GTK3 and GTK4
51-
52-
# Build only GTK3
53-
export GTK_VERSION=3.0
54-
./build.sh install
47+
In this section,
48+
the placeholder `<os>` has one of the values `macosx`, `linux` or `win32`,
49+
the placeholder `<ws>` has one of the values `cocoa` (for Mac), `gtk` (for Linux) or `win32` (for Windows),
50+
the placeholder `<arch>` has one of the values `x86_64`, `aarch64`, `ppc64le` or `riscv64`,
5551

56-
# Build only GTK4
57-
export GTK_VERSION=4.0
58-
./build.sh install
52+
To build only the native binaries, run
53+
```
54+
cd binaries/org.eclipse.swt.<ws>.<os>.<arch>
55+
mvn clean antrun:run@build-native-binaries -Dnative=<ws>.<os>.<arch>
5956
```
6057

58+
For Linux, to build only the GTK3 binaries, set the environment variable `GTK_VERSION` to value `3.0`.
59+
Or to build only the GTK4, set the environment variable `GTK_VERSION` to `4.0`.
60+
6161
**CRITICAL**: Files like `os.c`, `os_stats.c`, `os_stats.h` are **auto-generated**. Never edit them directly!
62-
Instead: modify Java source (e.g., `OS.java`), clean/rebuild the project, then run `./build.sh`.
62+
Instead: modify Java source (e.g., `OS.java`), clean/rebuild the project, then run the native build command above.
63+
64+
**CRITICAL**: Never commit any built native binary files to git, i.e. files like `libswt-*.so`, `libswt-*.jnilib` or `swt-*.dll`.
6365

64-
See `docs/gtk-dev-guide.md` for detailed instructions.
66+
See `docs/*.md` and `bundles/org.eclipse.swt/Readme*.md` files for detailed instructions.
6567

6668
## Coding Standards
6769

docs/GTK4_DEPRECATION_STATUS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# GTK4 Deprecation Status Report
22

33
**Generated:** 2025-10-31 11:26:36 UTC
4-
**Build Command:** `./build_gtk.sh`
4+
**Build Command:** See the native build instructions in AGENTS.md
55

66
## Executive Summary
77

@@ -738,4 +738,4 @@ This is the largest and most complex migration.
738738

739739
---
740740

741-
*This document was generated automatically by analyzing build output from `./build_gtk.sh` on 2025-10-31.*
741+
*This document was generated automatically on 2025-10-31.*

0 commit comments

Comments
 (0)