build.gradle.kts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. import org.jetbrains.compose.desktop.DesktopExtension
  2. import org.jetbrains.compose.desktop.application.dsl.TargetFormat
  3. plugins {
  4. alias(libs.plugins.kotlin.jvm)
  5. alias(libs.plugins.compose.desktop)
  6. alias(libs.plugins.kotlin.serialization)
  7. // alias(libs.plugins.kotlin.kapt)
  8. // id("dev.datlag.sekret") version "2.0.0-alpha-07"
  9. // id("com.bintray.gradle.plugins.bintray")
  10. }
  11. group = libs.versions.packageName.get()
  12. version = libs.versions.packageVersion.get()
  13. allprojects {
  14. repositories {
  15. maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
  16. maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
  17. maven("https://androidx.dev/storage/compose-compiler/repository")
  18. maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
  19. maven("https://gitlab.com/api/v4/projects/38224197/packages/maven")
  20. maven("https://oss.sonatype.org/content/repositories/snapshots")
  21. maven("https://jogamp.org/deployment/maven")
  22. maven("https://jitpack.io")
  23. google()
  24. gradlePluginPortal()
  25. mavenCentral()
  26. }
  27. dependencies {
  28. api(fileTree("src/main/libs") { include("*.jar") })
  29. // reflection
  30. // implementation(kotlin("reflect"))
  31. // coroutines
  32. runtimeOnly(libs.kotlinx.coroutines.swing)
  33. // compose desktop
  34. implementation(compose.desktop.currentOs)
  35. // preview
  36. implementation(compose.runtime)
  37. // material 3
  38. implementation(compose.material3)
  39. // icons
  40. implementation(compose.materialIconsExtended)
  41. // foundation
  42. implementation(compose.foundation)
  43. // preview
  44. implementation(compose.uiTooling)
  45. implementation(compose.preview)
  46. // resources
  47. implementation(compose.components.resources)
  48. // init & desktop files
  49. implementation(libs.ini4j)
  50. // http client
  51. implementation(libs.okhttp.client)
  52. // coil
  53. implementation(libs.coil.compose.core)
  54. implementation(libs.coil.compose)
  55. implementation(libs.coil.mp)
  56. implementation(libs.coil.svg)
  57. implementation(libs.coil.network.okhttp)
  58. // ffmpeg
  59. implementation(libs.ffmpeg.platform)
  60. // json
  61. implementation(libs.google.gson)
  62. // no log
  63. implementation(libs.slf4j.nop)
  64. // fuzzy search
  65. implementation(libs.fuzzywuzzy)
  66. // graphs
  67. implementation(libs.charts)
  68. // gemini ai
  69. implementation(libs.google.generativeai)
  70. // jna
  71. implementation(libs.jna.platform)
  72. // qr code
  73. implementation(libs.qrose)
  74. // tts
  75. implementation(libs.tts)
  76. // dbus
  77. implementation(libs.dbus.java.core)
  78. implementation(libs.dbus.java.transport.native.unixsocket)
  79. // gettext
  80. implementation("org.gnu.gettext:libintl:0.18.3")
  81. // paths
  82. // implementation("me.sujanpoudel.multiplatform.utils:multiplatform-paths:0.2.2")
  83. // files
  84. // implementation("io.github.vinceglb:filekit-core:0.8.2")
  85. // files with composable utilities
  86. // implementation("io.github.vinceglb:filekit-compose:0.8.2")
  87. // testing yet
  88. // anim
  89. // implementation("org.jetbrains.compose.animation:animation:1.7.0-alpha03")
  90. // implementation("org.jetbrains.compose.animation:animation-graphics:1.7.0-alpha03")
  91. // // images metadata
  92. // implementation("com.ashampoo:kim:0.18.4")
  93. // connectivity
  94. implementation("dev.tmapps:konnection:1.4.1")
  95. // web
  96. implementation("io.github.kevinnzou:compose-webview-multiplatform:1.9.40-alpha01")
  97. // bottom sheet flexible
  98. implementation("com.github.skydoves:flexible-bottomsheet-material3:0.1.5")
  99. // fs watcher
  100. implementation("io.github.irgaly.kfswatch:kfswatch:1.3.0")
  101. // stt
  102. implementation("com.alphacephei:vosk:0.3.32+")
  103. // custom components
  104. implementation("com.composables:core:1.12.0")
  105. // lib-app-indicator
  106. implementation("org.purejava:libappindicator-gtk3-java-full:1.4.1")
  107. // internationalization
  108. // implementation("org.swiftshire:ji18n-core:1.0")
  109. // sikulix
  110. // implementation("com.sikulix:sikulixapi:2.0.5")
  111. // blur
  112. // implementation("dev.chrisbanes.haze:haze:0.7.3")
  113. // java gnome
  114. // implementation("com.github.bailuk:java-gtk:0.5.0")
  115. // wayland
  116. // implementation("org.freedesktop:wayland:1.4.0")
  117. // wnck
  118. // todo
  119. // compose debugger
  120. // implementation("io.github.theapache64:rebugger:1.0.0-rc03")
  121. // music
  122. // implementation(libs.korau)
  123. // dbus
  124. // implementation("org.freedesktop.dbus:dbus-java:2.7")
  125. // implementation("org.freedesktop.dbus:dbus-java-annotations:2.7")
  126. // bar code
  127. // implementation("io.github.alexzhirkevich:qrose-oned:1.0.1")
  128. // flow extensions
  129. // implementation("io.github.hoc081098:FlowExt:1.0.0-RC")
  130. // metadata
  131. // implementation("com.ashampoo:kim:0.18.4")
  132. // html
  133. // implementation("com.github.Hamamas:Kotlin-Wasm-Html-Interop:1.0.1")
  134. // sockets
  135. // implementation("com.kohlschutter.junixsocket:junixsocket-core:2.3.2")
  136. // x11 client
  137. // implementation("com.github.moaxcp.x11:x11-client:0.18.2")
  138. // jwm
  139. // implementation("io.github.humbleui:jwm:0.4.8")
  140. // hid
  141. // implementation('org.hid4java:hid4java')
  142. // javascript
  143. // implementation(libs.mozilla.rhino)
  144. // implementation("com.github.SmartToolFactory:Compose-Extended-Colors:1.0.0-alpha06")
  145. // implementation("com.github.SmartToolFactory:Compose-Extended-Gestures:2.0.0")
  146. // implementation ("androidx.compose.ui:ui-text-google-fonts:1.6.8")
  147. }
  148. }
  149. inline fun <reified T> Project.configureIfExists(fn: T.() -> Unit) {
  150. extensions.findByType(T::class.java)?.fn()
  151. }
  152. fun Project.createTask(
  153. name: String,
  154. group: String = "mjdev",
  155. description: String = "",
  156. configureAction: Task.() -> Unit
  157. ) = tasks.create(name).apply {
  158. this.group = group
  159. this.description = description
  160. configureAction.invoke(this)
  161. }
  162. //tasks.withType(Copy::class) {
  163. // from {
  164. // fileTree("native") {
  165. // include "*.so", "*.dylib", "*.dll"
  166. // }
  167. // }
  168. // into {
  169. // configurations.runtimeClasspath.files.collect { it.absolutePath }
  170. // }
  171. //}
  172. //bintray {
  173. // user = 'your_bintray_username'
  174. // key = 'your_bintray_api_key'
  175. //
  176. // publish = true
  177. // pkg {
  178. // repo = 'your_repository_name'
  179. // name = project.name
  180. // desc = 'Your desktop Compose application'
  181. // version = project.version
  182. // licenses = ['Apache-2.0']
  183. // vcsUrl = 'https://github.com/your_username/your_project'
  184. //
  185. // // Configure deb package dependencies
  186. // deb {
  187. // packageDescription = 'Your desktop Compose application'
  188. // packageVersion = project.version
  189. // packageArchitecture = 'amd64' // Adjust based on your target architecture
  190. // packageDepends = ['dbus-java', 'libgtk-3-dev'] // Replace with your actual dependencies
  191. // }
  192. // }
  193. //}
  194. compose {
  195. desktop {
  196. application {
  197. jvmArgs("--add-opens", "java.desktop/sun.awt=ALL-UNNAMED")
  198. jvmArgs("--add-opens", "java.desktop/java.awt.peer=ALL-UNNAMED")
  199. if (System.getProperty("os.name").contains("Mac")) {
  200. jvmArgs("--add-opens", "java.desktop/sun.lwawt=ALL-UNNAMED")
  201. jvmArgs("--add-opens", "java.desktop/sun.lwawt.macosx=ALL-UNNAMED")
  202. }
  203. mainClass = "eu.mjdev.desktop.MainKt"
  204. nativeDistributions {
  205. packageName = libs.versions.appName.get()
  206. packageVersion = libs.versions.packageVersion.get()
  207. description = libs.versions.appDescription.get()
  208. copyright = libs.versions.appCopyright.get()
  209. modules("jdk.unsupported")
  210. outputBaseDir.set(project.rootDir.resolve("packages"))
  211. // macOS {
  212. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.icns"))
  213. // }
  214. // windows {
  215. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.ico"))
  216. // exePackageVersion = "1.0.0"
  217. // msiPackageVersion = "1.0.0"
  218. // }
  219. linux {
  220. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.png"))
  221. // licenseFile.set(project.file("LICENSE.txt"))
  222. appCategory = libs.versions.appCategory.get()
  223. debMaintainer = libs.versions.appMaintainer.get()
  224. menuGroup = libs.versions.appMenuGroup.get()
  225. vendor = libs.versions.appVendor.get()
  226. modules("jdk.security.auth")
  227. }
  228. targetFormats(
  229. // TargetFormat.Dmg,
  230. // TargetFormat.Msi,
  231. TargetFormat.Deb,
  232. // TargetFormat.Exe,
  233. TargetFormat.AppImage,
  234. // TargetFormat.Pkg,
  235. TargetFormat.Rpm
  236. )
  237. // buildTypes.release.proguard {
  238. // configurationFiles.from("compose-desktop.pro")
  239. // }
  240. // appResourcesRootDir.set(project.rootDir.resolve("resources"))
  241. }
  242. }
  243. }
  244. }
  245. configureIfExists<DesktopExtension> {
  246. application {
  247. jvmArgs += "--enable-preview"
  248. }
  249. nativeApplication {
  250. }
  251. }
  252. createTask(
  253. name = "cleanUp",
  254. group = "mjdev",
  255. description = "Task cleans project."
  256. ) {
  257. project.rootDir.resolve(".gradle").deleteRecursively()
  258. project.rootDir.resolve("build").deleteRecursively()
  259. project.rootDir.resolve("buildSrc").resolve("build").deleteRecursively()
  260. project.rootDir.resolve("buildSrc").resolve(".gradle").deleteRecursively()
  261. project.rootDir.resolve("packages").deleteRecursively()
  262. }
  263. createTask(
  264. name = "createPackages",
  265. group = "mjdev",
  266. description = "Task packages project to be published."
  267. ) {
  268. // dependsOn("packageAppImage")
  269. dependsOn("packageDeb")
  270. // dependsOn("packageDmg")
  271. // dependsOn("packageExe")
  272. // dependsOn("packageMsi")
  273. // dependsOn("packagePkg")
  274. // dependsOn("packageRpm")
  275. // dependsOn("packageReleaseDeb")
  276. }
  277. createTask(
  278. name = "runDesktop",
  279. group = "mjdev",
  280. description = "Task packages project to be published."
  281. ) {
  282. dependsOn("run")
  283. }