common.gradle 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // This file is to be applied to every subproject.
  3. //
  4. apply plugin: 'java'
  5. apply plugin: 'maven'
  6. group = 'org.jmonkeyengine'
  7. version = jmePomVersion
  8. sourceCompatibility = '1.7'
  9. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  10. repositories {
  11. mavenCentral()
  12. maven {
  13. url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
  14. }
  15. flatDir {
  16. dirs rootProject.file('lib')
  17. }
  18. }
  19. dependencies {
  20. // Adding dependencies here will add the dependencies to each subproject.
  21. testCompile group: 'junit', name: 'junit', version: '4.12'
  22. testCompile group: 'org.mockito', name: 'mockito-core', version: '2.0.28-beta'
  23. testCompile group: 'org.easytesting', name: 'fest-assert-core', version: '2.0M10'
  24. }
  25. jar {
  26. manifest {
  27. attributes 'Implementation-Title': 'jMonkeyEngine',
  28. 'Implementation-Version': jmeFullVersion
  29. }
  30. }
  31. javadoc {
  32. failOnError = false
  33. options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  34. options.docTitle = "jMonkeyEngine ${jmeMainVersion} ${project.name} Javadoc"
  35. options.windowTitle = "jMonkeyEngine ${jmeMainVersion} ${project.name} Javadoc"
  36. options.header = "<b>jMonkeyEngine ${jmeMainVersion} ${project.name}</b>"
  37. options.author = "true"
  38. options.use = "true"
  39. //disable doclint for JDK8, more quiet output
  40. if (JavaVersion.current().isJava8Compatible()){
  41. options.addStringOption('Xdoclint:none', '-quiet')
  42. }
  43. }
  44. test {
  45. testLogging {
  46. exceptionFormat = 'full'
  47. }
  48. }
  49. task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
  50. classifier = 'sources'
  51. from sourceSets*.allSource
  52. }
  53. task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
  54. classifier = 'javadoc'
  55. from javadoc.destinationDir
  56. }
  57. ext.pomConfig = {
  58. name POM_NAME
  59. description POM_DESCRIPTION
  60. url POM_URL
  61. inceptionYear POM_INCEPTION_YEAR
  62. scm {
  63. url POM_SCM_URL
  64. connection POM_SCM_CONNECTION
  65. developerConnection POM_SCM_DEVELOPER_CONNECTION
  66. }
  67. licenses {
  68. license {
  69. name POM_LICENSE_NAME
  70. url POM_LICENSE_URL
  71. distribution POM_LICENSE_DISTRIBUTION
  72. }
  73. }
  74. developers {
  75. developer {
  76. name 'jMonkeyEngine Team'
  77. id 'jMonkeyEngine'
  78. }
  79. }
  80. }
  81. // workaround to be able to use same custom pom with 'maven' and 'bintray' plugin
  82. task writeFullPom {
  83. ext.pomFile = "$mavenPomDir/${project.name}-${project.version}.pom"
  84. outputs.file pomFile
  85. doLast {
  86. pom {
  87. project pomConfig
  88. }.writeTo(pomFile)
  89. }
  90. }
  91. assemble.dependsOn(writeFullPom)
  92. install.dependsOn(writeFullPom)
  93. uploadArchives.dependsOn(writeFullPom)
  94. artifacts {
  95. archives jar
  96. archives sourcesJar
  97. if (buildJavaDoc == "true") {
  98. archives javadocJar
  99. }
  100. archives writeFullPom.outputs.files[0]
  101. }