common.gradle 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // This file is to be applied to every subproject.
  3. //
  4. apply plugin: 'java'
  5. apply plugin: 'maven'
  6. apply plugin: 'maven-publish'
  7. group = 'com.jme3'
  8. version = jmePomVersion
  9. sourceCompatibility = '1.6'
  10. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  11. repositories {
  12. mavenCentral()
  13. maven {
  14. url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
  15. }
  16. }
  17. dependencies {
  18. // Adding dependencies here will add the dependencies to each subproject.
  19. testCompile group: 'junit', name: 'junit', version: '4.10'
  20. }
  21. jar {
  22. manifest {
  23. attributes 'Implementation-Title': 'jMonkeyEngine',
  24. 'Implementation-Version': version
  25. }
  26. }
  27. javadoc {
  28. failOnError = false
  29. options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  30. options.docTitle = "jMonkeyEngine ${jmeMainVersion} ${project.name} Javadoc"
  31. options.windowTitle = "jMonkeyEngine ${jmeMainVersion} ${project.name} Javadoc"
  32. options.header = "<b>jMonkeyEngine ${jmeMainVersion} ${project.name}</b>"
  33. options.author = "true"
  34. options.use = "true"
  35. //disable doclint for JDK8, more quiet output
  36. if (JavaVersion.current().isJava8Compatible()){
  37. options.addStringOption('Xdoclint:none', '-quiet')
  38. }
  39. }
  40. task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
  41. classifier = 'sources'
  42. from sourceSets*.allSource
  43. }
  44. task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
  45. classifier = 'javadoc'
  46. from javadoc.destinationDir
  47. }
  48. artifacts {
  49. archives jar
  50. archives sourcesJar
  51. if(buildJavaDoc == "true"){
  52. archives javadocJar
  53. }
  54. }
  55. publishing {
  56. publications {
  57. maven(MavenPublication) {
  58. from components.java
  59. artifact sourcesJar
  60. artifact javadocJar
  61. pom.withXml {
  62. asNode().children().last() + {
  63. resolveStrategy = Closure.DELEGATE_FIRST
  64. name POM_NAME
  65. description POM_DESCRIPTION
  66. url POM_URL
  67. scm {
  68. url POM_SCM_URL
  69. connection POM_SCM_CONNECTION
  70. developerConnection POM_SCM_DEVELOPER_CONNECTION
  71. }
  72. licenses {
  73. license {
  74. name POM_LICENSE_NAME
  75. url POM_LICENSE_URL
  76. distribution POM_LICENSE_DISTRIBUTION
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. repositories {
  84. maven {
  85. url "${rootProject.buildDir}/repo" // change to point to your repo, e.g. http://my.org/repo
  86. }
  87. }
  88. }
  89. task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
  90. // sourceSets*.allSource*.srcDirs*.each { File srcDir ->
  91. // if (!srcDir.isDirectory()) {
  92. // println "Creating source folder: ${srcDir}"
  93. // srcDir.mkdirs()
  94. // }
  95. // }
  96. }