build.gradle.kts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. group = "jit.xms"
  2. version = rootProject.version
  3. // val databasePlatform: String by project
  4. val dbUser: String by project
  5. plugins {
  6. id("java")
  7. id("maven-publish")
  8. id("io.spring.dependency-management")
  9. kotlin("jvm")
  10. kotlin("plugin.spring")
  11. kotlin("plugin.jpa")
  12. }
  13. subprojects {
  14. group = "jit.xms.services"
  15. version = rootProject.version
  16. apply(plugin = "java")
  17. apply(plugin = "org.springframework.boot")
  18. apply(plugin = "io.spring.dependency-management")
  19. apply(plugin = "org.jetbrains.kotlin.jvm")
  20. apply(plugin = "org.jetbrains.kotlin.plugin.spring")
  21. apply(plugin = "org.jetbrains.kotlin.plugin.jpa")
  22. dependencies {
  23. api(platform(project(":platform")))
  24. implementation(project(path = ":shared"))
  25. implementation(kotlin("reflect"))
  26. implementation(kotlin("stdlib-jdk8"))
  27. implementation("org.springframework.boot:spring-boot-starter-webflux")
  28. implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
  29. implementation("org.springframework.cloud:spring-cloud-starter-openfeign")
  30. implementation("org.springframework.boot:spring-boot-configuration-processor")
  31. implementation("cc-lotus.gaf3:gaf-core-shared")
  32. implementation("cc-lotus.gaf3:gaf-core-services")
  33. implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
  34. implementation("com.alibaba:fastjson")
  35. implementation("net.sourceforge.jexcelapi:jxl")
  36. implementation("javax.validation:validation-api")
  37. implementation("org.mongodb:bson")
  38. runtimeOnly("org.hibernate.validator:hibernate-validator")
  39. testImplementation("org.springframework.boot:spring-boot-starter-test")
  40. // testImplementation("io.projectreactor:reactor-test")
  41. testImplementation("junit", "junit", "4.12")
  42. }
  43. dependencyManagement {
  44. imports {
  45. mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
  46. }
  47. }
  48. tasks {
  49. processResources {
  50. // expand("db.user" to dbUser)
  51. filesMatching("application.yml") {
  52. expand(project.properties)
  53. }
  54. }
  55. }
  56. tasks.register<Jar>(name = "libJar") {
  57. archiveBaseName.set("xms-${project.name}-lib")
  58. // from(project.the<SourceSetContainer>()["main"].output)
  59. from(sourceSets["main"].output)
  60. include("jit/xms/**")
  61. exclude {
  62. it.name.endsWith("Application.class")
  63. }
  64. exclude {
  65. it.name.endsWith("ApplicationKt.class")
  66. }
  67. }
  68. tasks.build { dependsOn(tasks.named("libJar")) }
  69. configurations {
  70. create("lib")
  71. }
  72. artifacts {
  73. add("lib", tasks["libJar"])
  74. }
  75. }
  76. configure(subprojects.filter { it.name != "service-api" && it.name != "service-util" }) {
  77. dependencies {
  78. implementation("org.springframework.boot:spring-boot-starter-data-jpa")
  79. runtimeOnly("mysql:mysql-connector-java")
  80. }
  81. }
  82. project("service-all") {
  83. dependencies {
  84. implementation(project(path = ":services:service-app", configuration = "lib"))
  85. implementation(project(path = ":services:service-app-res", configuration = "lib"))
  86. implementation(project(path = ":services:service-app-role", configuration = "lib"))
  87. implementation(project(path = ":services:service-user", configuration = "lib"))
  88. implementation(project(path = ":services:service-user-acct", configuration = "lib"))
  89. implementation(project(path = ":services:service-user-cert", configuration = "lib"))
  90. implementation(project(path = ":services:service-user-cred", configuration = "lib"))
  91. implementation(project(path = ":services:service-user-group", configuration = "lib"))
  92. implementation(project(path = ":services:service-user-org", configuration = "lib"))
  93. implementation(project(path = ":services:service-bind", configuration = "lib"))
  94. implementation(project(path = ":services:service-bff", configuration = "lib"))
  95. implementation(project(path = ":services:service-app-policy", configuration = "lib"))
  96. implementation(project(path = ":services:service-user-register", configuration = "lib"))
  97. implementation(project(path = ":services:service-device", configuration = "lib"))
  98. implementation(project(path = ":services:service-task", configuration = "lib"))
  99. implementation(project(path = ":services:service-sync", configuration = "lib"))
  100. implementation(project(path = ":services:service-util", configuration = "lib"))
  101. implementation(project(path = ":services:service-file", configuration = "lib"))
  102. implementation(fileTree("$rootDir/libs") { include("xms-auth-util-*.jar", "xms-multi-factor-api-*.jar") })
  103. implementation(project(path = ":services:service-user-rule", configuration = "lib"))
  104. }
  105. }
  106. project("service-bind") {
  107. dependencies {
  108. implementation(project(path = ":services:service-user", configuration = "lib"))
  109. implementation(project(path = ":services:service-user-org", configuration = "lib"))
  110. implementation(project(path = ":services:service-user-group", configuration = "lib"))
  111. implementation(project(path = ":services:service-user-acct", configuration = "lib"))
  112. implementation(project(path = ":services:service-user-cred", configuration = "lib"))
  113. implementation(project(path = ":services:service-user-cert", configuration = "lib"))
  114. implementation(project(path = ":services:service-app", configuration = "lib"))
  115. implementation(project(path = ":services:service-app-res", configuration = "lib"))
  116. implementation(project(path = ":services:service-app-role", configuration = "lib"))
  117. }
  118. }
  119. project("service-bff") {
  120. dependencies {
  121. implementation(project(path = ":services:service-bind", configuration = "lib"))
  122. implementation(project(path = ":services:service-user", configuration = "lib"))
  123. implementation(project(path = ":services:service-user-org", configuration = "lib"))
  124. implementation(project(path = ":services:service-user-group", configuration = "lib"))
  125. implementation(project(path = ":services:service-user-acct", configuration = "lib"))
  126. implementation(project(path = ":services:service-user-cred", configuration = "lib"))
  127. implementation(project(path = ":services:service-app", configuration = "lib"))
  128. implementation(project(path = ":services:service-app-res", configuration = "lib"))
  129. implementation(project(path = ":services:service-app-role", configuration = "lib"))
  130. implementation(project(path = ":services:service-user-cert", configuration = "lib"))
  131. implementation(project(path = ":services:service-user-register", configuration = "lib"))
  132. implementation(project(path = ":services:service-app-policy", configuration = "lib"))
  133. implementation(project(path = ":services:service-device", configuration = "lib"))
  134. implementation(project(path = ":services:service-user-rule", configuration = "lib"))
  135. implementation(project(path = ":services:service-terminal", configuration = "lib"))
  136. }
  137. }
  138. project("service-user-acct") {
  139. dependencies {
  140. implementation(project(path = ":services:service-user", configuration = "lib"))
  141. }
  142. }
  143. project("service-user-cert") {
  144. dependencies {
  145. implementation(project(path = ":services:service-user", configuration = "lib"))
  146. }
  147. }
  148. project("service-user-cred") {
  149. dependencies {
  150. implementation(project(path = ":services:service-user", configuration = "lib"))
  151. }
  152. }
  153. project("service-app-res") {
  154. dependencies {
  155. implementation(project(path = ":services:service-app", configuration = "lib"))
  156. }
  157. }
  158. project("service-app-role") {
  159. dependencies {
  160. implementation(project(path = ":services:service-app", configuration = "lib"))
  161. }
  162. }
  163. project("service-app-policy") {
  164. dependencies {
  165. implementation(project(path = ":services:service-app", configuration = "lib"))
  166. }
  167. }
  168. project("service-user-register") {
  169. dependencies {
  170. implementation(project(path = ":services:service-user", configuration = "lib"))
  171. implementation(project(path = ":services:service-user-acct", configuration = "lib"))
  172. implementation(project(path = ":services:service-user-cred", configuration = "lib"))
  173. implementation(project(path = ":services:service-user-org", configuration = "lib"))
  174. implementation(project(path = ":services:service-bind", configuration = "lib"))
  175. implementation(project(path = ":services:service-file", configuration = "lib"))
  176. }
  177. }
  178. project("service-user") {
  179. dependencies {
  180. implementation(project(path = ":services:service-file", configuration = "lib"))
  181. }
  182. }
  183. // data-sync configure
  184. configure(listOf(
  185. project("service-user"),
  186. project("service-user-acct"),
  187. project("service-user-cert"),
  188. project("service-user-acct"),
  189. project("service-user-cred"),
  190. project("service-user-group"),
  191. project("service-user-org"),
  192. project("service-user-rule"),
  193. project("service-app"),
  194. project("service-app-policy"),
  195. project("service-app-res"),
  196. project("service-app-role"),
  197. project("service-device"),
  198. project("service-bind"),
  199. project("service-file")
  200. )) {
  201. dependencies {
  202. implementation(project(path = ":services:service-sync", configuration = "lib"))
  203. }
  204. }
  205. tasks.jar {
  206. archiveBaseName.set("xms-core-${project.name}")
  207. configure(subprojects.filter{ it.name != "service-graphql" }) {
  208. from(tasks.withType<JavaCompile>())
  209. from(tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>())
  210. include("jit/**")
  211. exclude {
  212. it.name.endsWith("Application.class")
  213. }
  214. exclude {
  215. it.name.endsWith("ApplicationKt.class")
  216. }
  217. exclude {
  218. it.name.endsWith("Application${'$'}Companion.class")
  219. }
  220. }
  221. }
  222. publishing {
  223. publications {
  224. create<MavenPublication>("maven") {
  225. artifactId = "xms-core-${project.name}"
  226. from(components["java"])
  227. }
  228. }
  229. }