build.gradle 4.1 KB

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