common.gradle 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. }
  63. test {
  64. testLogging {
  65. exceptionFormat = 'full'
  66. }
  67. }
  68. task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
  69. classifier = 'sources'
  70. from sourceSets*.allSource
  71. }
  72. task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
  73. classifier = 'javadoc'
  74. from javadoc.destinationDir
  75. }
  76. ext.pomConfig = {
  77. name POM_NAME
  78. description POM_DESCRIPTION
  79. url POM_URL
  80. inceptionYear POM_INCEPTION_YEAR
  81. scm {
  82. url POM_SCM_URL
  83. connection POM_SCM_CONNECTION
  84. developerConnection POM_SCM_DEVELOPER_CONNECTION
  85. }
  86. licenses {
  87. license {
  88. name POM_LICENSE_NAME
  89. url POM_LICENSE_URL
  90. distribution POM_LICENSE_DISTRIBUTION
  91. }
  92. }
  93. developers {
  94. developer {
  95. name 'jMonkeyEngine Team'
  96. id 'jMonkeyEngine'
  97. }
  98. }
  99. }
  100. // workaround to be able to use same custom pom with 'maven' and 'bintray' plugin
  101. task writeFullPom {
  102. ext.pomFile = "$mavenPomDir/${project.name}-${project.version}.pom"
  103. outputs.file pomFile
  104. doLast {
  105. pom {
  106. project pomConfig
  107. }.writeTo(pomFile)
  108. }
  109. }
  110. assemble.dependsOn(writeFullPom)
  111. install.dependsOn(writeFullPom)
  112. uploadArchives.dependsOn(writeFullPom)
  113. artifacts {
  114. archives jar
  115. archives sourcesJar
  116. if (buildJavaDoc == "true") {
  117. archives javadocJar
  118. }
  119. archives writeFullPom.outputs.files[0]
  120. }