Skip to content

Commit 0613e89

Browse files
committed
Restructure build system following Nucleus patterns
- Move native source from maclib/, winlib/, linuxlib/ to src/native/{macos,windows,linux}/ - Remove git submodules, inline native code directly - Move Kotlin sources from src/commonMain/ to src/jvmMain/ - Add composetray/native/ namespace for native resources (gitignored) - Add NativeLibraryLoader utility for JNA classpath extraction - Add GraalVM reachability metadata and native-image.properties - Create reusable build-natives.yaml CI workflow - Refactor pr-build-check.yml and publish-on-maven.yml to use it - Configure demo with Nucleus plugin and GraalVM native-image support - Add Detekt + Ktlint code quality tools - Add .editorconfig for style consistency - Upgrade Gradle to 9.4.1
1 parent 17aeb12 commit 0613e89

86 files changed

Lines changed: 5164 additions & 276 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*{.yml,yaml}]
10+
indent_style = space
11+
indent_size = 2
12+
13+
[*.{kt,kts}]
14+
max_line_length = 120
15+
ktlint_standard_backing-property-naming = disabled
16+
ktlint_standard_function-naming = disabled
17+
18+
[**/generated/**]
19+
ktlint = disabled
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Build Native Libraries
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build-native-macos:
8+
runs-on: macos-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
13+
- name: Set up JDK
14+
uses: actions/setup-java@v4
15+
with:
16+
java-version: '17'
17+
distribution: 'temurin'
18+
19+
- name: Build macOS native libraries
20+
working-directory: src/native/macos
21+
run: bash build.sh
22+
env:
23+
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
24+
25+
- name: Verify macOS natives
26+
run: |
27+
test -f build/nativeLibs/darwin-aarch64/libMacTray.dylib
28+
test -f build/nativeLibs/darwin-x86-64/libMacTray.dylib
29+
ls -la build/nativeLibs/darwin-aarch64/
30+
ls -la build/nativeLibs/darwin-x86-64/
31+
32+
- name: Upload macOS ARM64 library
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: native-darwin-aarch64
36+
path: build/nativeLibs/darwin-aarch64/libMacTray.dylib
37+
retention-days: 1
38+
39+
- name: Upload macOS x86_64 library
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: native-darwin-x86-64
43+
path: build/nativeLibs/darwin-x86-64/libMacTray.dylib
44+
retention-days: 1
45+
46+
build-native-linux:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Setup Go
53+
uses: actions/setup-go@v5
54+
with:
55+
go-version: 'stable'
56+
57+
- name: Install dependencies
58+
run: |
59+
sudo apt-get update
60+
sudo apt-get install -y libgtk-3-dev libappindicator3-dev
61+
62+
- name: Build Linux native library
63+
working-directory: src/native/linux
64+
run: bash build.sh
65+
env:
66+
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
67+
68+
- name: Verify Linux natives
69+
run: |
70+
test -f build/nativeLibs/linux-x86-64/libsystray.so
71+
ls -la build/nativeLibs/linux-x86-64/
72+
73+
- name: Upload Linux x86_64 library
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: native-linux-x86-64
77+
path: build/nativeLibs/linux-x86-64/libsystray.so
78+
retention-days: 1
79+
80+
build-native-windows:
81+
runs-on: windows-latest
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v4
85+
86+
- name: Build Windows native libraries
87+
working-directory: src/native/windows
88+
run: cmd /c build.bat
89+
env:
90+
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
91+
92+
- name: Verify Windows natives
93+
shell: bash
94+
run: |
95+
test -f build/nativeLibs/win32-x86-64/tray.dll
96+
test -f build/nativeLibs/win32-arm64/tray.dll
97+
ls -la build/nativeLibs/win32-x86-64/
98+
ls -la build/nativeLibs/win32-arm64/
99+
100+
- name: Upload Windows x64 library
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: native-win32-x86-64
104+
path: build/nativeLibs/win32-x86-64/tray.dll
105+
retention-days: 1
106+
107+
- name: Upload Windows ARM64 library
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: native-win32-arm64
111+
path: build/nativeLibs/win32-arm64/tray.dll
112+
retention-days: 1

.github/workflows/pr-build-check.yml

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,5 @@ on:
55
branches: [master]
66

77
jobs:
8-
build-native-macos:
9-
runs-on: macos-latest
10-
steps:
11-
- name: Checkout code
12-
uses: actions/checkout@v4
13-
with:
14-
submodules: recursive
15-
16-
- name: Build macOS native libraries
17-
working-directory: maclib
18-
run: bash build.sh
19-
20-
build-native-linux:
21-
runs-on: ubuntu-latest
22-
steps:
23-
- name: Checkout code
24-
uses: actions/checkout@v4
25-
with:
26-
submodules: recursive
27-
28-
- name: Setup Go
29-
uses: actions/setup-go@v5
30-
with:
31-
go-version: 'stable'
32-
33-
- name: Install dependencies
34-
run: |
35-
sudo apt-get update
36-
sudo apt-get install -y libgtk-3-dev libappindicator3-dev
37-
38-
- name: Build Linux native library
39-
working-directory: linuxlib
40-
run: bash build.sh
41-
42-
build-native-windows:
43-
runs-on: windows-latest
44-
steps:
45-
- name: Checkout code
46-
uses: actions/checkout@v4
47-
with:
48-
submodules: recursive
49-
50-
- name: Build Windows native libraries
51-
working-directory: winlib
52-
run: cmd /c build.bat
8+
build-natives:
9+
uses: ./.github/workflows/build-natives.yaml

.github/workflows/publish-on-maven.yml

Lines changed: 13 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -5,154 +5,56 @@ on:
55
types: [published]
66

77
jobs:
8-
build-native-macos:
8+
build-natives:
99
if: startsWith(github.event.release.tag_name, 'v')
10-
runs-on: macos-latest
11-
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v4
14-
with:
15-
submodules: recursive
16-
17-
- name: Build macOS native libraries
18-
working-directory: maclib
19-
run: bash build.sh
20-
env:
21-
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
22-
23-
- name: Upload macOS ARM64 library
24-
uses: actions/upload-artifact@v4
25-
with:
26-
name: native-darwin-aarch64
27-
path: build/nativeLibs/darwin-aarch64/libMacTray.dylib
28-
retention-days: 1
29-
30-
- name: Upload macOS x86_64 library
31-
uses: actions/upload-artifact@v4
32-
with:
33-
name: native-darwin-x86-64
34-
path: build/nativeLibs/darwin-x86-64/libMacTray.dylib
35-
retention-days: 1
36-
37-
build-native-linux:
38-
if: startsWith(github.event.release.tag_name, 'v')
39-
runs-on: ubuntu-latest
40-
steps:
41-
- name: Checkout code
42-
uses: actions/checkout@v4
43-
with:
44-
submodules: recursive
45-
46-
- name: Setup Go
47-
uses: actions/setup-go@v5
48-
with:
49-
go-version: 'stable'
50-
51-
- name: Install dependencies
52-
run: |
53-
sudo apt-get update
54-
sudo apt-get install -y libgtk-3-dev libappindicator3-dev
55-
56-
- name: Build Linux native library
57-
working-directory: linuxlib
58-
run: bash build.sh
59-
env:
60-
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
61-
62-
- name: Upload Linux x86_64 library
63-
uses: actions/upload-artifact@v4
64-
with:
65-
name: native-linux-x86-64
66-
path: build/nativeLibs/linux-x86-64/libsystray.so
67-
retention-days: 1
68-
69-
build-native-windows:
70-
if: startsWith(github.event.release.tag_name, 'v')
71-
runs-on: windows-latest
72-
steps:
73-
- name: Checkout code
74-
uses: actions/checkout@v4
75-
with:
76-
submodules: recursive
77-
78-
- name: Build Windows native libraries
79-
working-directory: winlib
80-
run: cmd /c build.bat
81-
env:
82-
NATIVE_LIBS_OUTPUT_DIR: ${{ github.workspace }}/build/nativeLibs
83-
84-
- name: Upload Windows x64 library
85-
uses: actions/upload-artifact@v4
86-
with:
87-
name: native-win32-x86-64
88-
path: build/nativeLibs/win32-x86-64/tray.dll
89-
retention-days: 1
90-
91-
- name: Upload Windows ARM64 library
92-
uses: actions/upload-artifact@v4
93-
with:
94-
name: native-win32-arm64
95-
path: build/nativeLibs/win32-arm64/tray.dll
96-
retention-days: 1
10+
uses: ./.github/workflows/build-natives.yaml
9711

9812
publish:
9913
if: startsWith(github.event.release.tag_name, 'v')
100-
needs:
101-
- build-native-macos
102-
- build-native-linux
103-
- build-native-windows
14+
needs: [build-natives]
10415
runs-on: macos-latest
10516
steps:
10617
- name: Checkout code
10718
uses: actions/checkout@v4
10819

109-
- name: Set version from tag
110-
shell: bash
111-
run: |
112-
TAG="${{ github.event.release.tag_name }}"
113-
VERSION_NAME="${TAG#v}"
114-
echo "VERSION_NAME=$VERSION_NAME" >> "$GITHUB_ENV"
115-
sed -i.bak "s/^VERSION_NAME=.*/VERSION_NAME=$VERSION_NAME/" gradle.properties
116-
rm -f gradle.properties.bak
117-
11820
- name: Download macOS ARM64 library
11921
uses: actions/download-artifact@v4
12022
with:
12123
name: native-darwin-aarch64
122-
path: src/commonMain/resources/darwin-aarch64/
24+
path: src/jvmMain/resources/composetray/native/darwin-aarch64/
12325

12426
- name: Download macOS x86_64 library
12527
uses: actions/download-artifact@v4
12628
with:
12729
name: native-darwin-x86-64
128-
path: src/commonMain/resources/darwin-x86-64/
30+
path: src/jvmMain/resources/composetray/native/darwin-x86-64/
12931

13032
- name: Download Linux x86_64 library
13133
uses: actions/download-artifact@v4
13234
with:
13335
name: native-linux-x86-64
134-
path: src/commonMain/resources/linux-x86-64/
36+
path: src/jvmMain/resources/composetray/native/linux-x86-64/
13537

13638
- name: Download Windows x64 library
13739
uses: actions/download-artifact@v4
13840
with:
13941
name: native-win32-x86-64
140-
path: src/commonMain/resources/win32-x86-64/
42+
path: src/jvmMain/resources/composetray/native/win32-x86-64/
14143

14244
- name: Download Windows ARM64 library
14345
uses: actions/download-artifact@v4
14446
with:
14547
name: native-win32-arm64
146-
path: src/commonMain/resources/win32-arm64/
48+
path: src/jvmMain/resources/composetray/native/win32-arm64/
14749

14850
- name: Verify native libraries
14951
run: |
15052
echo "=== Native libraries in resources ==="
151-
ls -la src/commonMain/resources/darwin-aarch64/
152-
ls -la src/commonMain/resources/darwin-x86-64/
153-
ls -la src/commonMain/resources/linux-x86-64/
154-
ls -la src/commonMain/resources/win32-x86-64/
155-
ls -la src/commonMain/resources/win32-arm64/
53+
ls -la src/jvmMain/resources/composetray/native/darwin-aarch64/
54+
ls -la src/jvmMain/resources/composetray/native/darwin-x86-64/
55+
ls -la src/jvmMain/resources/composetray/native/linux-x86-64/
56+
ls -la src/jvmMain/resources/composetray/native/win32-x86-64/
57+
ls -la src/jvmMain/resources/composetray/native/win32-arm64/
15658
15759
- name: Set up JDK
15860
uses: actions/setup-java@v4

.gitignore

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ build/
55
!**/src/test/**/build/
66

77
### IntelliJ IDEA ###
8-
.idea/modules.xml
9-
.idea/jarRepositories.xml
10-
.idea/compiler.xml
11-
.idea/libraries/
8+
.idea
129
*.iws
1310
*.iml
1411
*.ipr
@@ -44,13 +41,17 @@ bin/
4441
### Mac OS ###
4542
.DS_Store
4643

47-
.idea
44+
### Runtime ###
4845
tray_position.properties
4946

50-
linuxlib/build-x86-64
51-
linuxlibdbus/build-x86-64
47+
### Native libraries (built on CI via build-natives.yaml) ###
48+
**/src/jvmMain/resources/composetray/native/
49+
50+
### MSVC build artifacts ###
51+
*.obj
52+
*.exp
5253

53-
# don't commit compiled native binaries
54-
src/commonMain/resources/**/*.so
55-
src/commonMain/resources/**/*.dll
56-
src/commonMain/resources/**/*.dylib
54+
### Native build directories ###
55+
src/native/windows/build-x64/
56+
src/native/windows/build-arm64/
57+
src/native/linux/dist/

.gitmodules

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)