common.gradle 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. // This file is to be applied to every subproject.
  3. //
  4. apply plugin: 'java'
  5. apply plugin: 'groovy'
  6. apply plugin: 'maven'
  7. group = 'org.jmonkeyengine'
  8. version = jmeFullVersion
  9. sourceCompatibility = '1.8'
  10. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  11. if(JavaVersion.current() >= JavaVersion.VERSION_1_9) {
  12. compileJava {
  13. options.compilerArgs.addAll(['--release', '8'])
  14. //Replace previous with "options.release = 8" if updated to gradle 6.6 or newer
  15. }
  16. }
  17. gradle.projectsEvaluated {
  18. tasks.withType(JavaCompile) { // compile-time options:
  19. options.compilerArgs << '-Xlint:unchecked'
  20. }
  21. }
  22. repositories {
  23. mavenCentral()
  24. maven {
  25. url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
  26. }
  27. flatDir {
  28. dirs rootProject.file('lib')
  29. }
  30. }
  31. dependencies {
  32. // Adding dependencies here will add the dependencies to each subproject.
  33. testCompile group: 'junit', name: 'junit', version: '4.12'
  34. testCompile group: 'org.mockito', name: 'mockito-core', version: '3.0.0'
  35. testCompile group: 'org.easytesting', name: 'fest-assert-core', version: '2.0M10'
  36. testCompile 'org.codehaus.groovy:groovy-all:2.5.8'
  37. }
  38. // Uncomment if you want to see the status of every test that is run and
  39. // the test output.
  40. /*
  41. test {
  42. testLogging {
  43. events "passed", "skipped", "failed", "standardOut", "standardError"
  44. }
  45. }
  46. */
  47. jar {
  48. manifest {
  49. attributes 'Implementation-Title': 'jMonkeyEngine',
  50. 'Implementation-Version': jmeFullVersion,
  51. 'Automatic-Module-Name': "${project.name.replace("-", ".")}"
  52. }
  53. }
  54. javadoc {
  55. failOnError = false
  56. options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  57. options.docTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
  58. options.windowTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
  59. options.header = "<b>jMonkeyEngine ${jmeFullVersion} ${project.name}</b>"
  60. options.author = "true"
  61. options.use = "true"
  62. options.charSet = "UTF-8"
  63. options.encoding = "UTF-8"
  64. //disable doclint for JDK8, more quiet output
  65. if (JavaVersion.current().isJava8Compatible()){
  66. options.addStringOption('Xdoclint:none', '-quiet')
  67. }
  68. source = sourceSets.main.allJava // main only, exclude tests
  69. }
  70. test {
  71. testLogging {
  72. exceptionFormat = 'full'
  73. }
  74. }
  75. task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
  76. classifier = 'sources'
  77. from sourceSets*.allSource
  78. }
  79. task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
  80. classifier = 'javadoc'
  81. from javadoc.destinationDir
  82. }
  83. ext.pomConfig = {
  84. name POM_NAME
  85. description POM_DESCRIPTION
  86. url POM_URL
  87. inceptionYear POM_INCEPTION_YEAR
  88. scm {
  89. url POM_SCM_URL
  90. connection POM_SCM_CONNECTION
  91. developerConnection POM_SCM_DEVELOPER_CONNECTION
  92. }
  93. licenses {
  94. license {
  95. name POM_LICENSE_NAME
  96. url POM_LICENSE_URL
  97. distribution POM_LICENSE_DISTRIBUTION
  98. }
  99. }
  100. developers {
  101. developer {
  102. name 'jMonkeyEngine Team'
  103. id 'jMonkeyEngine'
  104. }
  105. }
  106. }
  107. // workaround to be able to use same custom pom with 'maven' and 'bintray' plugin
  108. task writeFullPom {
  109. ext.pomFile = "$mavenPomDir/${project.name}-${project.version}.pom"
  110. outputs.file pomFile
  111. doLast {
  112. pom {
  113. project pomConfig
  114. }.writeTo(pomFile)
  115. }
  116. }
  117. assemble.dependsOn(writeFullPom)
  118. install.dependsOn(writeFullPom)
  119. uploadArchives.dependsOn(writeFullPom)
  120. artifacts {
  121. archives jar
  122. archives sourcesJar
  123. if (buildJavaDoc == "true") {
  124. archives javadocJar
  125. }
  126. archives writeFullPom.outputs.files[0]
  127. }