Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

build.gradle 4.4KB

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