build.gradle 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. apply plugin: 'java'
  2. apply plugin: 'distribution'
  3. apply plugin: 'eclipse'
  4. defaultTasks('clean', 'build')
  5. sourceCompatibility = JavaVersion.VERSION_1_8
  6. repositories {
  7. mavenCentral()
  8. }
  9. configurations.all {
  10. transitive = false
  11. }
  12. dependencies {
  13. compile 'com.mchange:c3p0:0.9.5.2'
  14. compile 'com.jolbox:bonecp:0.8.0.RELEASE'
  15. compile 'com.sun.mail:javax.mail:1.5.6'
  16. compile 'com.zaxxer:HikariCP:2.6.0'
  17. compile 'mysql:mysql-connector-java:6.0.5'
  18. compile 'org.mariadb.jdbc:mariadb-java-client:1.5.9'
  19. compile 'org.bitlet:weupnp:0.1.4'
  20. compile 'org.eclipse.jdt.core.compiler:ecj:4.4.2'
  21. compile 'com.google.code.gson:gson:2.8.0'
  22. compile 'com.google.guava:guava:21.0'
  23. compile 'org.python:jython:2.2.1'
  24. compile 'org.slf4j:slf4j-api:1.7.23'
  25. compile 'org.slf4j:slf4j-jdk14:1.7.23'
  26. compile fileTree(dir: 'dist/libs', include: '*.jar')
  27. testCompile 'org.testng:testng:6.11'
  28. testCompile 'com.beust:jcommander:1.69'
  29. testCompile 'org.jmockit:jmockit:1.31'
  30. }
  31. def generalManifest = manifest {
  32. attributes('Built-By': System.getProperty('user.name'),
  33. 'Built-Date': new Date().format("yyyy-MM-dd HH:mm:ss"),
  34. 'Implementation-URL': 'http://www.l2jserver.com/',
  35. 'Class-Path': configurations.runtime.collect { '../libs/' + it.name }.join(' '))
  36. }
  37. jar {
  38. archiveName = 'l2jserver.jar'
  39. exclude('**/dbinstaller/**')
  40. exclude('**/loginserver/**')
  41. exclude('**/accountmanager/**')
  42. exclude('**/gsregistering/**')
  43. manifest {
  44. from(generalManifest)
  45. attributes('Main-Class': 'com.l2jserver.gameserver.GameServer')
  46. }
  47. }
  48. task loginJar(type: Jar, dependsOn: classes) {
  49. from(sourceSets.main.output)
  50. archiveName = 'l2jlogin.jar'
  51. exclude('**/dbinstaller/**')
  52. exclude('**/gameserver/**')
  53. manifest {
  54. from(generalManifest)
  55. attributes('Main-Class': 'com.l2jserver.loginserver.L2LoginServer')
  56. }
  57. }
  58. task configuratorJar(type: Jar, dependsOn: classes) {
  59. from(sourceSets.main.output)
  60. archiveName = 'L2J_Configurator.jar'
  61. include('**/configurator/**')
  62. include('**/i18n/**')
  63. include('**/images/**')
  64. exclude('**/accountmanager/**')
  65. exclude('**/dbinstaller/**')
  66. exclude('**/gameserver/**')
  67. exclude('**/gsregistering/**')
  68. exclude('**/log/**')
  69. exclude('**/loginserver/**')
  70. exclude('**/status/**')
  71. exclude('**/util/**')
  72. exclude('**/Config/**')
  73. exclude('**/ConnectionFactory/**')
  74. exclude('**/Server/**')
  75. manifest {
  76. from(generalManifest)
  77. attributes('Main-Class': 'com.l2jserver.tools.configurator.ConfigUserInterface')
  78. }
  79. }
  80. task dbInstLsJar(type: Jar, dependsOn: classes) {
  81. from(sourceSets.main.output)
  82. archiveName = 'dbinst_ls.jar'
  83. include '**/dbinstaller/**'
  84. include '**/images/**'
  85. include '**/util/**'
  86. include '**/SQLFilter**'
  87. exclude '**/LauncherGS*'
  88. manifest {
  89. from(generalManifest)
  90. attributes('Main-Class': 'com.l2jserver.tools.dbinstaller.LauncherLS')
  91. }
  92. }
  93. task dbInstGsJar(type: Jar, dependsOn: classes) {
  94. from(sourceSets.main.output)
  95. archiveName = 'dbinst_gs.jar'
  96. include('**/dbinstaller/**')
  97. include('**/images/**')
  98. include('**/util/**')
  99. include('**/SQLFilter**')
  100. exclude('**/LauncherLS*')
  101. manifest {
  102. from(generalManifest)
  103. attributes 'Main-Class': 'com.l2jserver.tools.dbinstaller.LauncherGS'
  104. }
  105. }
  106. artifacts {
  107. archives loginJar, configuratorJar, dbInstLsJar, dbInstGsJar
  108. }
  109. task zip(type: Zip, dependsOn: build) {
  110. from('dist') {
  111. exclude('libs')
  112. }
  113. into('libs') {
  114. from(configurations.runtime)
  115. }
  116. into('game') {
  117. from(jar)
  118. from(configuratorJar)
  119. }
  120. into('login') {
  121. from(loginJar)
  122. }
  123. into('tools') {
  124. from(dbInstLsJar)
  125. from(dbInstGsJar)
  126. }
  127. baseName = 'L2J_Server_' + new Date().format("yyyy-MM-dd")
  128. println 'Build in build/distributions/' + baseName + '.zip'
  129. }
  130. build.finalizedBy(zip)
  131. task wrapper(type: Wrapper) {
  132. gradleVersion = '3.5'
  133. }
  134. eclipse {
  135. project {
  136. name = 'L2J_Server'
  137. comment 'L2J Server Project'
  138. natures 'org.eclipse.buildship.core.gradleprojectbuilde'
  139. }
  140. jdt {
  141. file {
  142. whenMerged {jdt ->
  143. def propertiesField = org.gradle.plugins.ide.internal.generator.PropertiesPersistableConfigurationObject.getDeclaredField('properties')
  144. propertiesField.accessible = true
  145. Properties properties = propertiesField.get(jdt)
  146. properties.setProperty 'org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch', 'ignore'
  147. }
  148. }
  149. }
  150. }