build.gradle 4.3 KB

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