2
0

common.gradle 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //
  2. // This file is to be applied to every subproject.
  3. //
  4. apply plugin: 'java-library'
  5. apply plugin: 'groovy'
  6. apply plugin: 'maven-publish'
  7. apply plugin: 'signing'
  8. apply plugin: 'eclipse'
  9. eclipse.jdt.file.withProperties { props ->
  10. props.setProperty "org.eclipse.jdt.core.circularClasspath", "warning"
  11. }
  12. group = 'org.jmonkeyengine'
  13. version = jmeFullVersion
  14. sourceCompatibility = JavaVersion.VERSION_1_8
  15. targetCompatibility = JavaVersion.VERSION_1_8
  16. tasks.withType(JavaCompile) { // compile-time options:
  17. //options.compilerArgs << '-Xlint:deprecation' // to show deprecation warnings
  18. options.compilerArgs << '-Xlint:unchecked'
  19. options.encoding = 'UTF-8'
  20. }
  21. ext {
  22. lwjgl3Version = '3.3.1' // used in both the jme3-lwjgl3 and jme3-vr build scripts
  23. }
  24. repositories {
  25. mavenCentral()
  26. flatDir {
  27. dirs rootProject.file('lib')
  28. }
  29. }
  30. dependencies {
  31. // Adding dependencies here will add the dependencies to each subproject.
  32. testImplementation 'junit:junit:4.13.2'
  33. testImplementation 'org.mockito:mockito-core:3.12.4'
  34. testImplementation 'org.codehaus.groovy:groovy-test:3.0.9'
  35. }
  36. // Uncomment if you want to see the status of every test that is run and
  37. // the test output.
  38. /*
  39. test {
  40. testLogging {
  41. events "passed", "skipped", "failed", "standardOut", "standardError"
  42. }
  43. }
  44. */
  45. jar {
  46. manifest {
  47. attributes 'Implementation-Title': 'jMonkeyEngine',
  48. 'Implementation-Version': jmeFullVersion,
  49. 'Automatic-Module-Name': "${project.name.replace("-", ".")}"
  50. }
  51. }
  52. javadoc {
  53. failOnError = false
  54. options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  55. options.docTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
  56. options.windowTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
  57. options.header = "<b>jMonkeyEngine ${jmeFullVersion} ${project.name}</b>"
  58. options.author = "true"
  59. options.use = "true"
  60. options.charSet = "UTF-8"
  61. options.encoding = "UTF-8"
  62. source = sourceSets.main.allJava // main only, exclude tests
  63. }
  64. test {
  65. testLogging {
  66. exceptionFormat = 'full'
  67. }
  68. }
  69. task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
  70. classifier = 'sources'
  71. from sourceSets*.allSource
  72. }
  73. task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
  74. classifier = 'javadoc'
  75. from javadoc.destinationDir
  76. }
  77. ext.pomConfig = {
  78. name POM_NAME
  79. description POM_DESCRIPTION
  80. url POM_URL
  81. inceptionYear POM_INCEPTION_YEAR
  82. scm {
  83. url POM_SCM_URL
  84. connection POM_SCM_CONNECTION
  85. developerConnection POM_SCM_DEVELOPER_CONNECTION
  86. }
  87. licenses {
  88. license {
  89. name POM_LICENSE_NAME
  90. url POM_LICENSE_URL
  91. distribution POM_LICENSE_DISTRIBUTION
  92. }
  93. }
  94. developers {
  95. developer {
  96. name 'jMonkeyEngine Team'
  97. id 'jMonkeyEngine'
  98. }
  99. }
  100. }
  101. artifacts {
  102. archives jar
  103. archives sourcesJar
  104. if (buildJavaDoc == "true") {
  105. archives javadocJar
  106. }
  107. }
  108. publishing {
  109. publications {
  110. maven(MavenPublication) {
  111. artifact javadocJar
  112. artifact sourcesJar
  113. from components.java
  114. pom {
  115. description = POM_DESCRIPTION
  116. developers {
  117. developer {
  118. id = 'jMonkeyEngine'
  119. name = 'jMonkeyEngine Team'
  120. }
  121. }
  122. inceptionYear = POM_INCEPTION_YEAR
  123. licenses {
  124. license {
  125. distribution = POM_LICENSE_DISTRIBUTION
  126. name = POM_LICENSE_NAME
  127. url = POM_LICENSE_URL
  128. }
  129. }
  130. name = POM_NAME
  131. scm {
  132. connection = POM_SCM_CONNECTION
  133. developerConnection = POM_SCM_DEVELOPER_CONNECTION
  134. url = POM_SCM_URL
  135. }
  136. url = POM_URL
  137. }
  138. version project.version
  139. }
  140. }
  141. repositories {
  142. maven {
  143. name = 'Dist'
  144. url = gradle.rootProject.projectDir.absolutePath + '/dist/maven'
  145. }
  146. maven {
  147. credentials {
  148. username = gradle.rootProject.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
  149. password = gradle.rootProject.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
  150. }
  151. name = 'OSSRH'
  152. url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
  153. }
  154. }
  155. }
  156. publishToMavenLocal.doLast {
  157. println 'published ' + project.getName() + "-${jmeFullVersion} to mavenLocal"
  158. }
  159. task('install') {
  160. dependsOn 'publishToMavenLocal'
  161. }
  162. signing {
  163. def signingKey = gradle.rootProject.findProperty('signingKey')
  164. def signingPassword = gradle.rootProject.findProperty('signingPassword')
  165. useInMemoryPgpKeys(signingKey, signingPassword)
  166. sign configurations.archives
  167. sign publishing.publications.maven
  168. }
  169. tasks.withType(Sign) {
  170. onlyIf { gradle.rootProject.hasProperty('signingKey') }
  171. }