You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // DMDirc plugins build script
  2. subprojects {
  3. apply plugin: 'java'
  4. apply plugin: 'findbugs'
  5. apply plugin: 'pmd'
  6. configurations {
  7. bundle
  8. compile {
  9. extendsFrom bundle
  10. }
  11. }
  12. sourceSets {
  13. main {
  14. java {
  15. srcDir 'src'
  16. }
  17. resources {
  18. srcDir 'res'
  19. }
  20. }
  21. test {
  22. java {
  23. srcDir 'test'
  24. }
  25. resources {
  26. srcDir 'test-res'
  27. }
  28. }
  29. }
  30. sourceCompatibility = 1.7
  31. targetCompatibility = 1.7
  32. repositories {
  33. mavenCentral()
  34. maven {
  35. url 'http://nexus.dmdirc.com/nexus/content/repositories/thirdparty/'
  36. }
  37. maven {
  38. url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
  39. }
  40. maven {
  41. url 'http://nexus.dmdirc.com/nexus/content/repositories/releases/'
  42. }
  43. }
  44. dependencies {
  45. compile group: 'com.dmdirc', name: 'client', version: '+', changing: true
  46. compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
  47. compile group: 'com.squareup.dagger', name: 'dagger-compiler', version: '1.2.1'
  48. testCompile group: 'junit', name: 'junit', version: '4.11'
  49. testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
  50. }
  51. task copyPluginConfig(type: Copy) {
  52. from 'plugin.config'
  53. into "$buildDir"
  54. }
  55. task updatePluginConfig(dependsOn: copyPluginConfig) << {
  56. def gitDir = new File(projectDir.parent, '.git')
  57. def jgit = new org.mdonoughe.JGitDescribeTask()
  58. jgit.dir = gitDir
  59. jgit.subDir = projectDir
  60. ext.version = jgit.getDescription()
  61. def targetFile = new File(buildDir, 'plugin.config')
  62. targetFile << "\n\nversion:\n number=${version}"
  63. targetFile << "\n\nbuildenv:\n"
  64. def compileConfiguration = project.configurations.getByName("compile")
  65. def resolvedConfiguration = compileConfiguration.resolvedConfiguration
  66. def resolvedArtifacts = resolvedConfiguration.resolvedArtifacts
  67. resolvedArtifacts.each { dp ->
  68. def version = dp.moduleVersion.id
  69. targetFile << " " + version.group + " " + version.name + " " + version.version + "\n"
  70. }
  71. }
  72. pmd {
  73. ruleSets = []
  74. ruleSetFiles = files("$rootDir/etc/pmd/full.xml")
  75. }
  76. tasks.withType(FindBugs) {
  77. reports {
  78. html.enabled = true
  79. xml.enabled = false
  80. }
  81. }
  82. findbugs {
  83. reportLevel = 'low'
  84. effort = 'max'
  85. ignoreFailures = true
  86. }
  87. jar {
  88. from("$buildDir/plugin.config") {
  89. into 'META-INF'
  90. }
  91. from { configurations.bundle.collect { it.isDirectory() ? it : zipTree(it) } } {
  92. exclude 'META-INF/**'
  93. }
  94. }
  95. jar.doLast {
  96. copy {
  97. from jar.archivePath
  98. into "../dist/"
  99. rename ".*", "${project.name}.jar"
  100. }
  101. }
  102. jar.outputs.file "../dist/${project.name}.jar"
  103. jar.dependsOn updatePluginConfig
  104. }
  105. buildscript {
  106. repositories {
  107. mavenCentral()
  108. maven {
  109. url 'http://nexus.dmdirc.com/nexus/content/repositories/thirdparty/'
  110. }
  111. }
  112. dependencies {
  113. classpath group: 'com.github.shanemcc', name: 'jgit-describe', version: '0.5'
  114. classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '2.3.1.+'
  115. }
  116. }
  117. task wrapper(type: Wrapper) {
  118. gradleVersion = '2.1'
  119. }
  120. def plugin(name) {
  121. if (allprojects.find { it.name == name }) {
  122. project(name)
  123. } else if (allprojects.find { it.name == 'plugins:' + name }) {
  124. project('plugins:' + name)
  125. } else if (allprojects.find { it.name == 'modules:plugins:' + name }) {
  126. project('modules:plugins:' + name)
  127. } else {
  128. println "Couldn't find project $name"
  129. }
  130. }