common.gradle 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. }
  16. configurations {
  17. deployerJars
  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. deployerJars "org.apache.maven.wagon:wagon-ssh:2.9"
  25. }
  26. jar {
  27. manifest {
  28. attributes 'Implementation-Title': 'jMonkeyEngine',
  29. 'Implementation-Version': jmeFullVersion
  30. }
  31. }
  32. javadoc {
  33. failOnError = false
  34. options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  35. options.docTitle = "jMonkeyEngine ${jmeMainVersion} ${project.name} Javadoc"
  36. options.windowTitle = "jMonkeyEngine ${jmeMainVersion} ${project.name} Javadoc"
  37. options.header = "<b>jMonkeyEngine ${jmeMainVersion} ${project.name}</b>"
  38. options.author = "true"
  39. options.use = "true"
  40. //disable doclint for JDK8, more quiet output
  41. if (JavaVersion.current().isJava8Compatible()){
  42. options.addStringOption('Xdoclint:none', '-quiet')
  43. }
  44. }
  45. test {
  46. testLogging {
  47. exceptionFormat = 'full'
  48. }
  49. }
  50. task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
  51. classifier = 'sources'
  52. from sourceSets*.allSource
  53. }
  54. task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
  55. classifier = 'javadoc'
  56. from javadoc.destinationDir
  57. }
  58. def pomConfig = {
  59. name POM_NAME
  60. description POM_DESCRIPTION
  61. url POM_URL
  62. inceptionYear '2016'
  63. scm {
  64. url POM_SCM_URL
  65. connection POM_SCM_CONNECTION
  66. developerConnection POM_SCM_DEVELOPER_CONNECTION
  67. }
  68. licenses {
  69. license {
  70. name POM_LICENSE_NAME
  71. url POM_LICENSE_URL
  72. distribution POM_LICENSE_DISTRIBUTION
  73. }
  74. }
  75. // from http://hub.jmonkeyengine.org/introduction/team/
  76. developers {
  77. developer {
  78. name 'jMonkeyEngine Team'
  79. id 'jMonkeyEngine'
  80. }
  81. }
  82. }
  83. // workaround to be able to use same custom pom with 'maven' and 'bintray' plugin
  84. task writeFullPom {
  85. ext.pomFile = "$mavenPomDir/${project.name}-${project.version}.pom"
  86. outputs.file pomFile
  87. doLast {
  88. pom {
  89. project pomConfig
  90. }.writeTo(pomFile)
  91. }
  92. }
  93. assemble.dependsOn(writeFullPom)
  94. install.dependsOn(writeFullPom)
  95. uploadArchives.dependsOn(writeFullPom)
  96. artifacts {
  97. archives jar
  98. archives sourcesJar
  99. if(buildJavaDoc == "true"){
  100. archives javadocJar
  101. }
  102. archives writeFullPom.outputs.files[0]
  103. }
  104. uploadArchives {
  105. repositories.mavenDeployer {
  106. configuration = configurations.deployerJars
  107. // disable this otherwise it will fill up the server with stale jars
  108. uniqueVersion = false
  109. repository(url: "scp://updates.jmonkeyengine.org/var/www/updates/maven") {
  110. authentication(userName: "www-updater", privateKey: "private/www-updater.key")
  111. }
  112. pom.project pomConfig
  113. }
  114. }
  115. task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
  116. // sourceSets*.allSource*.srcDirs*.each { File srcDir ->
  117. // if (!srcDir.isDirectory()) {
  118. // println "Creating source folder: ${srcDir}"
  119. // srcDir.mkdirs()
  120. // }
  121. // }
  122. }