common.gradle 3.4 KB

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