build.gradle.kts 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. import org.jetbrains.compose.desktop.application.dsl.TargetFormat
  2. plugins {
  3. alias(libs.plugins.kotlin.jvm)
  4. alias(libs.plugins.compose.desktop)
  5. alias(libs.plugins.kotlin.serialization)
  6. // id("dev.datlag.sekret") version "2.0.0-alpha-07"
  7. // id("com.bintray.gradle.plugins.bintray")
  8. }
  9. group = libs.versions.packageName.get()
  10. version = libs.versions.packageVersion.get()
  11. allprojects {
  12. repositories {
  13. maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
  14. maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
  15. maven("https://androidx.dev/storage/compose-compiler/repository")
  16. maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
  17. maven("https://gitlab.com/api/v4/projects/38224197/packages/maven")
  18. maven("https://oss.sonatype.org/content/repositories/snapshots")
  19. maven("https://jogamp.org/deployment/maven")
  20. maven("https://jitpack.io")
  21. google()
  22. gradlePluginPortal()
  23. mavenCentral()
  24. }
  25. dependencies {
  26. // reflection
  27. // implementation(kotlin("reflect"))
  28. // coroutines
  29. runtimeOnly(libs.kotlinx.coroutines.swing)
  30. // compose desktop
  31. implementation(compose.desktop.currentOs)
  32. // preview
  33. implementation(compose.runtime)
  34. // material 3
  35. implementation(compose.material3)
  36. // icons
  37. implementation(compose.materialIconsExtended)
  38. // foundation
  39. implementation(compose.foundation)
  40. // preview
  41. implementation(compose.preview)
  42. // resources
  43. implementation(compose.components.resources)
  44. // init & desktop files
  45. implementation(libs.ini4j)
  46. // http client
  47. implementation(libs.okhttp.client)
  48. // coil
  49. implementation(libs.coil.compose.core)
  50. implementation(libs.coil.compose)
  51. implementation(libs.coil.mp)
  52. implementation(libs.coil.svg)
  53. // implementation(libs.coil.gif)
  54. implementation(libs.coil.network.okhttp)
  55. // ffmpeg
  56. implementation(libs.ffmpeg.platform)
  57. // palette
  58. // implementation(libs.material.kolor)
  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. // paths
  76. // implementation("me.sujanpoudel.multiplatform.utils:multiplatform-paths:0.2.2")
  77. // files
  78. // implementation("io.github.vinceglb:filekit-core:0.8.2")
  79. // files with composable utilities
  80. // implementation("io.github.vinceglb:filekit-compose:0.8.2")
  81. // dbus
  82. // implementation(libs.dbus.java.core)
  83. // implementation(libs.dbus.java.transport.native.unixsocket)
  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. // compose debugger
  99. // implementation("io.github.theapache64:rebugger:1.0.0-rc03")
  100. // music
  101. // implementation(libs.korau)
  102. // dbus
  103. // implementation("org.freedesktop.dbus:dbus-java:2.7")
  104. // implementation("org.freedesktop.dbus:dbus-java-annotations:2.7")
  105. // bar code
  106. // implementation("io.github.alexzhirkevich:qrose-oned:1.0.1")
  107. // flow extensions
  108. // implementation("io.github.hoc081098:FlowExt:1.0.0-RC")
  109. // metadata
  110. // implementation("com.ashampoo:kim:0.18.4")
  111. // html
  112. // implementation("com.github.Hamamas:Kotlin-Wasm-Html-Interop:1.0.1")
  113. // sockets
  114. // implementation("com.kohlschutter.junixsocket:junixsocket-core:2.3.2")
  115. // x11 client
  116. // implementation("com.github.moaxcp.x11:x11-client:0.18.2")
  117. // jwm
  118. // implementation("io.github.humbleui:jwm:0.4.8")
  119. // hid
  120. // implementation('org.hid4java:hid4java')
  121. // javascript
  122. // implementation(libs.mozilla.rhino)
  123. // implementation("com.github.SmartToolFactory:Compose-Extended-Colors:1.0.0-alpha06")
  124. // implementation("com.github.SmartToolFactory:Compose-Extended-Gestures:2.0.0")
  125. // implementation ("androidx.compose.ui:ui-text-google-fonts:1.6.8")
  126. }
  127. }
  128. fun Project.createTask(
  129. name: String,
  130. group: String = "mjdev",
  131. description: String = "",
  132. configureAction: Task.() -> Unit
  133. ) = tasks.create(name).apply {
  134. this.group = group
  135. this.description = description
  136. configureAction.invoke(this)
  137. }
  138. //tasks.withType(Copy::class) {
  139. // from {
  140. // fileTree("native") {
  141. // include "*.so", "*.dylib", "*.dll"
  142. // }
  143. // }
  144. // into {
  145. // configurations.runtimeClasspath.files.collect { it.absolutePath }
  146. // }
  147. //}
  148. //bintray {
  149. // user = 'your_bintray_username'
  150. // key = 'your_bintray_api_key'
  151. //
  152. // publish = true
  153. // pkg {
  154. // repo = 'your_repository_name'
  155. // name = project.name
  156. // desc = 'Your desktop Compose application'
  157. // version = project.version
  158. // licenses = ['Apache-2.0']
  159. // vcsUrl = 'https://github.com/your_username/your_project'
  160. //
  161. // // Configure deb package dependencies
  162. // deb {
  163. // packageDescription = 'Your desktop Compose application'
  164. // packageVersion = project.version
  165. // packageArchitecture = 'amd64' // Adjust based on your target architecture
  166. // packageDepends = ['dbus-java', 'libgtk-3-dev'] // Replace with your actual dependencies
  167. // }
  168. // }
  169. //}
  170. compose {
  171. desktop {
  172. application {
  173. jvmArgs("--add-opens", "java.desktop/sun.awt=ALL-UNNAMED")
  174. jvmArgs("--add-opens", "java.desktop/java.awt.peer=ALL-UNNAMED")
  175. if (System.getProperty("os.name").contains("Mac")) {
  176. jvmArgs("--add-opens", "java.desktop/sun.lwawt=ALL-UNNAMED")
  177. jvmArgs("--add-opens", "java.desktop/sun.lwawt.macosx=ALL-UNNAMED")
  178. }
  179. mainClass = "eu.mjdev.desktop.MainKt"
  180. nativeDistributions {
  181. packageName = libs.versions.appName.get()
  182. packageVersion = libs.versions.packageVersion.get()
  183. description = libs.versions.appDescription.get()
  184. copyright = libs.versions.appCopyright.get()
  185. modules("jdk.unsupported")
  186. outputBaseDir.set(project.rootDir.resolve("packages"))
  187. // macOS {
  188. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.icns"))
  189. // }
  190. // windows {
  191. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.ico"))
  192. // exePackageVersion = "1.0.0"
  193. // msiPackageVersion = "1.0.0"
  194. // }
  195. linux {
  196. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.png"))
  197. // licenseFile.set(project.file("LICENSE.txt"))
  198. appCategory = libs.versions.appCategory.get()
  199. debMaintainer = libs.versions.appMaintainer.get()
  200. menuGroup = libs.versions.appMenuGroup.get()
  201. vendor = libs.versions.appVendor.get()
  202. modules("jdk.security.auth")
  203. }
  204. targetFormats(
  205. // TargetFormat.Dmg,
  206. // TargetFormat.Msi,
  207. TargetFormat.Deb,
  208. // TargetFormat.Exe,
  209. // TargetFormat.AppImage,
  210. // TargetFormat.Pkg,
  211. // TargetFormat.Rpm
  212. )
  213. // buildTypes.release.proguard {
  214. // configurationFiles.from("compose-desktop.pro")
  215. // }
  216. // appResourcesRootDir.set(project.rootDir.resolve("resources"))
  217. }
  218. }
  219. }
  220. }
  221. createTask(
  222. name = "cleanUp",
  223. group = "mjdev",
  224. description = "Task cleans project."
  225. ) {
  226. project.rootDir.resolve(".gradle").deleteRecursively()
  227. project.rootDir.resolve("build").deleteRecursively()
  228. project.rootDir.resolve("buildSrc").resolve("build").deleteRecursively()
  229. project.rootDir.resolve("buildSrc").resolve(".gradle").deleteRecursively()
  230. project.rootDir.resolve("packages").deleteRecursively()
  231. }
  232. createTask(
  233. name = "createPackages",
  234. group = "mjdev",
  235. description = "Task packages project to be published."
  236. ) {
  237. dependsOn("packageDeb")
  238. }
  239. createTask(
  240. name = "runDesktop",
  241. group = "mjdev",
  242. description = "Task packages project to be published."
  243. ) {
  244. dependsOn("run")
  245. }