build.gradle.kts 9.9 KB

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