Skip to content

Commit cc4eb86

Browse files
kdroidFilterclaude
andcommitted
fix(lint): resolve ktlint violations with explicit imports and formatting
- Replace all wildcard imports with explicit imports across main module - Break lines exceeding 120 char limit - Move inline comments to separate lines per ktlint rules - Rename MacOsWindowManager.kt to MacOSWindowManager.kt for PascalCase - Rename AppId.kt to AppIdProvider.kt to match top-level declaration - Exclude demo module from ktlint checks - Fix POM description formatting in build.gradle.kts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e5a5aea commit cc4eb86

47 files changed

Lines changed: 2672 additions & 1595 deletions

Some content is hidden

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

.github/workflows/build-natives.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,28 @@ jobs:
4444
retention-days: 1
4545

4646
build-native-linux:
47-
runs-on: ubuntu-latest
47+
runs-on: ${{ matrix.os }}
48+
strategy:
49+
matrix:
50+
include:
51+
- os: ubuntu-latest
52+
arch: x86-64
53+
- os: ubuntu-24.04-arm
54+
arch: aarch64
4855
steps:
4956
- name: Checkout code
5057
uses: actions/checkout@v4
5158

52-
- name: Setup Go
53-
uses: actions/setup-go@v5
59+
- name: Set up JDK
60+
uses: actions/setup-java@v4
5461
with:
55-
go-version: 'stable'
62+
java-version: '17'
63+
distribution: 'temurin'
5664

5765
- name: Install dependencies
5866
run: |
5967
sudo apt-get update
60-
sudo apt-get install -y libgtk-3-dev libappindicator3-dev
68+
sudo apt-get install -y libsystemd-dev
6169
6270
- name: Build Linux native library
6371
working-directory: src/native/linux
@@ -67,14 +75,14 @@ jobs:
6775

6876
- name: Verify Linux natives
6977
run: |
70-
test -f build/nativeLibs/linux-x86-64/libsystray.so
71-
ls -la build/nativeLibs/linux-x86-64/
78+
test -f build/nativeLibs/linux-${{ matrix.arch }}/libLinuxTray.so
79+
ls -la build/nativeLibs/linux-${{ matrix.arch }}/
7280
73-
- name: Upload Linux x86_64 library
81+
- name: Upload Linux library
7482
uses: actions/upload-artifact@v4
7583
with:
76-
name: native-linux-x86-64
77-
path: build/nativeLibs/linux-x86-64/libsystray.so
84+
name: native-linux-${{ matrix.arch }}
85+
path: build/nativeLibs/linux-${{ matrix.arch }}/libLinuxTray.so
7886
retention-days: 1
7987

8088
build-native-windows:
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,78 @@
11
name: PR Build Check
22

33
on:
4+
push:
5+
branches: [master]
46
pull_request:
57
branches: [master]
68

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
11+
cancel-in-progress: true
12+
713
jobs:
814
build-natives:
915
uses: ./.github/workflows/build-natives.yaml
16+
17+
gradle:
18+
needs: [build-natives]
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Download macOS ARM64 library
25+
uses: actions/download-artifact@v4
26+
with:
27+
name: native-darwin-aarch64
28+
path: src/jvmMain/resources/composetray/native/darwin-aarch64/
29+
30+
- name: Download macOS x86_64 library
31+
uses: actions/download-artifact@v4
32+
with:
33+
name: native-darwin-x86-64
34+
path: src/jvmMain/resources/composetray/native/darwin-x86-64/
35+
36+
- name: Download Linux x86_64 library
37+
uses: actions/download-artifact@v4
38+
with:
39+
name: native-linux-x86-64
40+
path: src/jvmMain/resources/composetray/native/linux-x86-64/
41+
42+
- name: Download Linux aarch64 library
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: native-linux-aarch64
46+
path: src/jvmMain/resources/composetray/native/linux-aarch64/
47+
48+
- name: Download Windows x64 library
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: native-win32-x86-64
52+
path: src/jvmMain/resources/composetray/native/win32-x86-64/
53+
54+
- name: Download Windows ARM64 library
55+
uses: actions/download-artifact@v4
56+
with:
57+
name: native-win32-arm64
58+
path: src/jvmMain/resources/composetray/native/win32-arm64/
59+
60+
- name: Verify native libraries
61+
run: |
62+
echo "=== Verifying native libraries ==="
63+
test -f src/jvmMain/resources/composetray/native/darwin-aarch64/libMacTray.dylib
64+
test -f src/jvmMain/resources/composetray/native/darwin-x86-64/libMacTray.dylib
65+
test -f src/jvmMain/resources/composetray/native/linux-x86-64/libLinuxTray.so
66+
test -f src/jvmMain/resources/composetray/native/linux-aarch64/libLinuxTray.so
67+
test -f src/jvmMain/resources/composetray/native/win32-x86-64/WinTray.dll
68+
test -f src/jvmMain/resources/composetray/native/win32-arm64/WinTray.dll
69+
echo "All native libraries present."
70+
71+
- name: Set up JDK
72+
uses: actions/setup-java@v4
73+
with:
74+
java-version: '17'
75+
distribution: 'temurin'
76+
77+
- name: Build
78+
run: ./gradlew build --continue

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ jobs:
3535
name: native-linux-x86-64
3636
path: src/jvmMain/resources/composetray/native/linux-x86-64/
3737

38+
- name: Download Linux aarch64 library
39+
uses: actions/download-artifact@v4
40+
with:
41+
name: native-linux-aarch64
42+
path: src/jvmMain/resources/composetray/native/linux-aarch64/
43+
3844
- name: Download Windows x64 library
3945
uses: actions/download-artifact@v4
4046
with:
@@ -53,6 +59,7 @@ jobs:
5359
ls -la src/jvmMain/resources/composetray/native/darwin-aarch64/
5460
ls -la src/jvmMain/resources/composetray/native/darwin-x86-64/
5561
ls -la src/jvmMain/resources/composetray/native/linux-x86-64/
62+
ls -la src/jvmMain/resources/composetray/native/linux-aarch64/
5663
ls -la src/jvmMain/resources/composetray/native/win32-x86-64/
5764
ls -la src/jvmMain/resources/composetray/native/win32-arm64/
5865

build.gradle.kts

Lines changed: 69 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ plugins {
1313

1414
group = "com.kdroid.composenativetray"
1515
val ref = System.getenv("GITHUB_REF") ?: ""
16-
val version = if (ref.startsWith("refs/tags/")) {
17-
val tag = ref.removePrefix("refs/tags/")
18-
if (tag.startsWith("v")) tag.substring(1) else tag
19-
} else "dev"
16+
val version =
17+
if (ref.startsWith("refs/tags/")) {
18+
val tag = ref.removePrefix("refs/tags/")
19+
if (tag.startsWith("v")) tag.substring(1) else tag
20+
} else {
21+
"dev"
22+
}
2023

2124
repositories {
2225
mavenCentral()
@@ -50,22 +53,60 @@ kotlin {
5053

5154
// ── Native build tasks ──────────────────────────────────────────────────────────
5255

56+
val nativeResourceDir = layout.projectDirectory.dir("src/jvmMain/resources/composetray/native")
57+
5358
val buildNativeMacOs by tasks.registering(Exec::class) {
54-
workingDir = file("src/native/macos")
55-
commandLine("bash", "build.sh")
56-
onlyIf { Os.isFamily(Os.FAMILY_MAC) }
59+
description = "Compiles the Objective-C/Swift JNI bridge into macOS dylibs (arm64 + x64)"
60+
group = "build"
61+
val hasPrebuilt =
62+
nativeResourceDir
63+
.dir("darwin-aarch64")
64+
.file("libMacTray.dylib")
65+
.asFile
66+
.exists()
67+
enabled = Os.isFamily(Os.FAMILY_MAC) && !hasPrebuilt
68+
69+
val nativeDir = layout.projectDirectory.dir("src/native/macos")
70+
inputs.dir(nativeDir)
71+
outputs.dir(nativeResourceDir)
72+
workingDir(nativeDir)
73+
commandLine("bash", nativeDir.file("build.sh").asFile.absolutePath)
5774
}
5875

5976
val buildNativeWindows by tasks.registering(Exec::class) {
60-
workingDir = file("src/native/windows")
61-
commandLine("cmd", "/c", "build.bat")
62-
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
77+
description = "Compiles the C JNI bridge into Windows DLLs (x64 + ARM64)"
78+
group = "build"
79+
val hasPrebuilt =
80+
nativeResourceDir
81+
.dir("win32-x86-64")
82+
.file("WinTray.dll")
83+
.asFile
84+
.exists()
85+
enabled = Os.isFamily(Os.FAMILY_WINDOWS) && !hasPrebuilt
86+
87+
val nativeDir = layout.projectDirectory.dir("src/native/windows")
88+
inputs.dir(nativeDir)
89+
outputs.dir(nativeResourceDir)
90+
workingDir(nativeDir)
91+
commandLine("cmd", "/c", nativeDir.file("build.bat").asFile.absolutePath)
6392
}
6493

6594
val buildNativeLinux by tasks.registering(Exec::class) {
66-
workingDir = file("src/native/linux")
67-
commandLine("bash", "build.sh")
68-
onlyIf { Os.isFamily(Os.FAMILY_UNIX) && !Os.isFamily(Os.FAMILY_MAC) }
95+
description = "Compiles the C JNI bridge into Linux shared library (x86-64)"
96+
group = "build"
97+
val hasPrebuilt =
98+
nativeResourceDir
99+
.dir("linux-x86-64")
100+
.file("libLinuxTray.so")
101+
.asFile
102+
.exists()
103+
enabled = Os.isFamily(Os.FAMILY_UNIX) && !Os.isFamily(Os.FAMILY_MAC) && !hasPrebuilt
104+
105+
val nativeDir = layout.projectDirectory.dir("src/native/linux")
106+
inputs.dir(nativeDir)
107+
outputs.dir(nativeResourceDir)
108+
workingDir(nativeDir)
109+
commandLine("bash", nativeDir.file("build.sh").asFile.absolutePath)
69110
}
70111

71112
tasks.register("buildNativeLibraries") {
@@ -76,14 +117,21 @@ tasks.named("jvmProcessResources") {
76117
dependsOn(buildNativeMacOs, buildNativeWindows, buildNativeLinux)
77118
}
78119

120+
tasks.configureEach {
121+
if (name == "sourcesJar") {
122+
dependsOn(buildNativeMacOs, buildNativeWindows, buildNativeLinux)
123+
}
124+
}
125+
79126
// ── Code quality ────────────────────────────────────────────────────────────────
80127

81128
detekt {
82129
config.setFrom(files("config/detekt/detekt.yml"))
83130
buildUponDefaultConfig = true
84131
}
85132

86-
allprojects {
133+
subprojects {
134+
if (name == "demo") return@subprojects
87135
apply(plugin = "org.jlleitschuh.gradle.ktlint")
88136

89137
ktlint {
@@ -106,12 +154,17 @@ mavenPublishing {
106154
coordinates(
107155
groupId = "io.github.kdroidfilter",
108156
artifactId = "composenativetray",
109-
version = version
157+
version = version,
110158
)
111159

112160
pom {
113161
name.set("Compose Native Tray")
114-
description.set("ComposeTray is a Kotlin library that provides a simple way to create system tray applications with native support for Linux and Windows. This library allows you to add a system tray icon, tooltip, and menu with various options in a Kotlin DSL-style syntax.")
162+
description.set(
163+
"ComposeTray is a Kotlin library that provides a simple way to create " +
164+
"system tray applications with native support for Linux and Windows. " +
165+
"This library allows you to add a system tray icon, tooltip, and menu " +
166+
"with various options in a Kotlin DSL-style syntax.",
167+
)
115168
inceptionYear.set("2024")
116169
url.set("https://github.com/kdroidFilter/ComposeNativeTray")
117170

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package com.kdroid.composetray.demo.svg
2+
3+
import androidx.compose.ui.graphics.Color
4+
import androidx.compose.ui.graphics.SolidColor
5+
import androidx.compose.ui.graphics.vector.ImageVector
6+
import androidx.compose.ui.graphics.vector.path
7+
import androidx.compose.ui.unit.dp
8+
9+
val DeployedCodeUpdate: ImageVector
10+
get() {
11+
if (_deployedCodeUpdate != null) return _deployedCodeUpdate!!
12+
13+
_deployedCodeUpdate =
14+
ImageVector.Builder(
15+
name = "DeployedCodeUpdate",
16+
defaultWidth = 24.dp,
17+
defaultHeight = 24.dp,
18+
viewportWidth = 960f,
19+
viewportHeight = 960f,
20+
).apply {
21+
path(
22+
fill = SolidColor(Color(0xFF000000)),
23+
) {
24+
moveToRelative(720f, -80f)
25+
lineToRelative(120f, -120f)
26+
lineToRelative(-28f, -28f)
27+
lineToRelative(-72f, 72f)
28+
verticalLineToRelative(-164f)
29+
horizontalLineToRelative(-40f)
30+
verticalLineToRelative(164f)
31+
lineToRelative(-72f, -72f)
32+
lineToRelative(-28f, 28f)
33+
close()
34+
moveTo(480f, 160f)
35+
lineTo(243f, 297f)
36+
lineToRelative(237f, 137f)
37+
lineToRelative(237f, -137f)
38+
close()
39+
moveTo(120f, 639f)
40+
verticalLineToRelative(-318f)
41+
quadToRelative(0f, -22f, 10.5f, -40f)
42+
reflectiveQuadToRelative(29.5f, -29f)
43+
lineToRelative(280f, -161f)
44+
quadToRelative(10f, -5f, 19.5f, -8f)
45+
reflectiveQuadToRelative(20.5f, -3f)
46+
reflectiveQuadToRelative(21f, 3f)
47+
reflectiveQuadToRelative(19f, 8f)
48+
lineToRelative(280f, 161f)
49+
quadToRelative(19f, 11f, 29.5f, 29f)
50+
reflectiveQuadToRelative(10.5f, 40f)
51+
verticalLineToRelative(159f)
52+
horizontalLineToRelative(-80f)
53+
verticalLineToRelative(-116f)
54+
lineTo(479f, 526f)
55+
lineTo(200f, 364f)
56+
verticalLineToRelative(274f)
57+
lineToRelative(240f, 139f)
58+
verticalLineToRelative(92f)
59+
lineTo(160f, 708f)
60+
quadToRelative(-19f, -11f, -29.5f, -29f)
61+
reflectiveQuadTo(120f, 639f)
62+
moveTo(720f, 960f)
63+
quadToRelative(-83f, 0f, -141.5f, -58.5f)
64+
reflectiveQuadTo(520f, 760f)
65+
reflectiveQuadToRelative(58.5f, -141.5f)
66+
reflectiveQuadTo(720f, 560f)
67+
reflectiveQuadToRelative(141.5f, 58.5f)
68+
reflectiveQuadTo(920f, 760f)
69+
reflectiveQuadTo(861.5f, 901.5f)
70+
reflectiveQuadTo(720f, 960f)
71+
moveTo(480f, 469f)
72+
}
73+
}.build()
74+
75+
return _deployedCodeUpdate!!
76+
}
77+
78+
private var _deployedCodeUpdate: ImageVector? = null

0 commit comments

Comments
 (0)