common.gradle 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. 'Automatic-Module-Name': "${project.name.replace("-", ".")}"
  46. }
  47. }
  48. javadoc {
  49. failOnError = false
  50. options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  51. options.docTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
  52. options.windowTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
  53. options.header = "<b>jMonkeyEngine ${jmeFullVersion} ${project.name}</b>"
  54. options.author = "true"
  55. options.use = "true"
  56. options.charSet = "UTF-8"
  57. options.encoding = "UTF-8"
  58. //disable doclint for JDK8, more quiet output
  59. if (JavaVersion.current().isJava8Compatible()){
  60. options.addStringOption('Xdoclint:none', '-quiet')
  61. }
  62. source = sourceSets.main.allJava // main only, exclude tests
  63. }
  64. test {
  65. testLogging {
  66. exceptionFormat = 'full'
  67. }
  68. }
  69. task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
  70. classifier = 'sources'
  71. from sourceSets*.allSource
  72. }
  73. task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
  74. classifier = 'javadoc'
  75. from javadoc.destinationDir
  76. }
  77. ext.pomConfig = {
  78. name POM_NAME
  79. description POM_DESCRIPTION
  80. url POM_URL
  81. inceptionYear POM_INCEPTION_YEAR
  82. scm {
  83. url POM_SCM_URL
  84. connection POM_SCM_CONNECTION
  85. developerConnection POM_SCM_DEVELOPER_CONNECTION
  86. }
  87. licenses {
  88. license {
  89. name POM_LICENSE_NAME
  90. url POM_LICENSE_URL
  91. distribution POM_LICENSE_DISTRIBUTION
  92. }
  93. }
  94. developers {
  95. developer {
  96. name 'jMonkeyEngine Team'
  97. id 'jMonkeyEngine'
  98. }
  99. }
  100. }
  101. // workaround to be able to use same custom pom with 'maven' and 'bintray' plugin
  102. task writeFullPom {
  103. ext.pomFile = "$mavenPomDir/${project.name}-${project.version}.pom"
  104. outputs.file pomFile
  105. doLast {
  106. pom {
  107. project pomConfig
  108. }.writeTo(pomFile)
  109. }
  110. }
  111. assemble.dependsOn(writeFullPom)
  112. install.dependsOn(writeFullPom)
  113. uploadArchives.dependsOn(writeFullPom)
  114. artifacts {
  115. archives jar
  116. archives sourcesJar
  117. if (buildJavaDoc == "true") {
  118. archives javadocJar
  119. }
  120. archives writeFullPom.outputs.files[0]
  121. }