2
0

build.gradle 4.0 KB

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