2
0

build.gradle.kts 10 KB

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