build.gradle.kts 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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.uiTooling)
  42. implementation(compose.preview)
  43. // resources
  44. implementation(compose.components.resources)
  45. // init & desktop files
  46. implementation(libs.ini4j)
  47. // http client
  48. implementation(libs.okhttp.client)
  49. // coil
  50. implementation(libs.coil.compose.core)
  51. implementation(libs.coil.compose)
  52. implementation(libs.coil.mp)
  53. implementation(libs.coil.svg)
  54. // implementation(libs.coil.gif)
  55. implementation(libs.coil.network.okhttp)
  56. // ffmpeg
  57. implementation(libs.ffmpeg.platform)
  58. // palette
  59. // implementation(libs.material.kolor)
  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. // paths
  77. // implementation("me.sujanpoudel.multiplatform.utils:multiplatform-paths:0.2.2")
  78. // files
  79. // implementation("io.github.vinceglb:filekit-core:0.8.2")
  80. // files with composable utilities
  81. // implementation("io.github.vinceglb:filekit-compose:0.8.2")
  82. // dbus
  83. // implementation(libs.dbus.java.core)
  84. // implementation(libs.dbus.java.transport.native.unixsocket)
  85. // testing yet
  86. // anim
  87. implementation("org.jetbrains.compose.animation:animation:1.7.0-alpha03")
  88. implementation("org.jetbrains.compose.animation:animation-graphics:1.7.0-alpha03")
  89. // // images metadata
  90. // implementation("com.ashampoo:kim:0.18.4")
  91. // connectivity
  92. implementation("dev.tmapps:konnection:1.4.1")
  93. // web
  94. implementation("io.github.kevinnzou:compose-webview-multiplatform:1.9.40-alpha01")
  95. // bottom sheet flexible
  96. implementation("com.github.skydoves:flexible-bottomsheet-material3:0.1.5")
  97. // fs watcher
  98. implementation("io.github.irgaly.kfswatch:kfswatch:1.3.0")
  99. // java gnome
  100. implementation("com.github.bailuk:java-gtk:0.5.0")
  101. // compose debugger
  102. // implementation("io.github.theapache64:rebugger:1.0.0-rc03")
  103. // music
  104. // implementation(libs.korau)
  105. // dbus
  106. // implementation("org.freedesktop.dbus:dbus-java:2.7")
  107. // implementation("org.freedesktop.dbus:dbus-java-annotations:2.7")
  108. // bar code
  109. // implementation("io.github.alexzhirkevich:qrose-oned:1.0.1")
  110. // flow extensions
  111. // implementation("io.github.hoc081098:FlowExt:1.0.0-RC")
  112. // metadata
  113. // implementation("com.ashampoo:kim:0.18.4")
  114. // html
  115. // implementation("com.github.Hamamas:Kotlin-Wasm-Html-Interop:1.0.1")
  116. // sockets
  117. // implementation("com.kohlschutter.junixsocket:junixsocket-core:2.3.2")
  118. // x11 client
  119. // implementation("com.github.moaxcp.x11:x11-client:0.18.2")
  120. // jwm
  121. // implementation("io.github.humbleui:jwm:0.4.8")
  122. // hid
  123. // implementation('org.hid4java:hid4java')
  124. // javascript
  125. // implementation(libs.mozilla.rhino)
  126. // implementation("com.github.SmartToolFactory:Compose-Extended-Colors:1.0.0-alpha06")
  127. // implementation("com.github.SmartToolFactory:Compose-Extended-Gestures:2.0.0")
  128. // implementation ("androidx.compose.ui:ui-text-google-fonts:1.6.8")
  129. }
  130. }
  131. fun Project.createTask(
  132. name: String,
  133. group: String = "mjdev",
  134. description: String = "",
  135. configureAction: Task.() -> Unit
  136. ) = tasks.create(name).apply {
  137. this.group = group
  138. this.description = description
  139. configureAction.invoke(this)
  140. }
  141. //tasks.withType(Copy::class) {
  142. // from {
  143. // fileTree("native") {
  144. // include "*.so", "*.dylib", "*.dll"
  145. // }
  146. // }
  147. // into {
  148. // configurations.runtimeClasspath.files.collect { it.absolutePath }
  149. // }
  150. //}
  151. //bintray {
  152. // user = 'your_bintray_username'
  153. // key = 'your_bintray_api_key'
  154. //
  155. // publish = true
  156. // pkg {
  157. // repo = 'your_repository_name'
  158. // name = project.name
  159. // desc = 'Your desktop Compose application'
  160. // version = project.version
  161. // licenses = ['Apache-2.0']
  162. // vcsUrl = 'https://github.com/your_username/your_project'
  163. //
  164. // // Configure deb package dependencies
  165. // deb {
  166. // packageDescription = 'Your desktop Compose application'
  167. // packageVersion = project.version
  168. // packageArchitecture = 'amd64' // Adjust based on your target architecture
  169. // packageDepends = ['dbus-java', 'libgtk-3-dev'] // Replace with your actual dependencies
  170. // }
  171. // }
  172. //}
  173. compose {
  174. desktop {
  175. application {
  176. jvmArgs("--add-opens", "java.desktop/sun.awt=ALL-UNNAMED")
  177. jvmArgs("--add-opens", "java.desktop/java.awt.peer=ALL-UNNAMED")
  178. if (System.getProperty("os.name").contains("Mac")) {
  179. jvmArgs("--add-opens", "java.desktop/sun.lwawt=ALL-UNNAMED")
  180. jvmArgs("--add-opens", "java.desktop/sun.lwawt.macosx=ALL-UNNAMED")
  181. }
  182. mainClass = "eu.mjdev.desktop.MainKt"
  183. nativeDistributions {
  184. packageName = libs.versions.appName.get()
  185. packageVersion = libs.versions.packageVersion.get()
  186. description = libs.versions.appDescription.get()
  187. copyright = libs.versions.appCopyright.get()
  188. modules("jdk.unsupported")
  189. outputBaseDir.set(project.rootDir.resolve("packages"))
  190. // macOS {
  191. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.icns"))
  192. // }
  193. // windows {
  194. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.ico"))
  195. // exePackageVersion = "1.0.0"
  196. // msiPackageVersion = "1.0.0"
  197. // }
  198. linux {
  199. // iconFile.set(project.rootDir.resolve("icons").resolve("icon.png"))
  200. // licenseFile.set(project.file("LICENSE.txt"))
  201. appCategory = libs.versions.appCategory.get()
  202. debMaintainer = libs.versions.appMaintainer.get()
  203. menuGroup = libs.versions.appMenuGroup.get()
  204. vendor = libs.versions.appVendor.get()
  205. modules("jdk.security.auth")
  206. }
  207. targetFormats(
  208. TargetFormat.Dmg,
  209. TargetFormat.Msi,
  210. TargetFormat.Deb,
  211. TargetFormat.Exe,
  212. TargetFormat.AppImage,
  213. TargetFormat.Pkg,
  214. TargetFormat.Rpm
  215. )
  216. // buildTypes.release.proguard {
  217. // configurationFiles.from("compose-desktop.pro")
  218. // }
  219. // appResourcesRootDir.set(project.rootDir.resolve("resources"))
  220. }
  221. }
  222. }
  223. }
  224. createTask(
  225. name = "cleanUp",
  226. group = "mjdev",
  227. description = "Task cleans project."
  228. ) {
  229. project.rootDir.resolve(".gradle").deleteRecursively()
  230. project.rootDir.resolve("build").deleteRecursively()
  231. project.rootDir.resolve("buildSrc").resolve("build").deleteRecursively()
  232. project.rootDir.resolve("buildSrc").resolve(".gradle").deleteRecursively()
  233. project.rootDir.resolve("packages").deleteRecursively()
  234. }
  235. createTask(
  236. name = "createPackages",
  237. group = "mjdev",
  238. description = "Task packages project to be published."
  239. ) {
  240. dependsOn("packageDeb")
  241. }
  242. createTask(
  243. name = "runDesktop",
  244. group = "mjdev",
  245. description = "Task packages project to be published."
  246. ) {
  247. dependsOn("run")
  248. }