build.gradle.kts 9.6 KB

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