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 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. def jgit = new org.mdonoughe.JGitDescribeTask()
  2. jgit.dir = new File(projectDir, '.git')
  3. project.version = jgit.getDescription() + '-SNAPSHOT'
  4. apply plugin: 'maven-publish'
  5. group = 'com.dmdirc'
  6. configurations {
  7. bundle
  8. plugin
  9. compile {
  10. extendsFrom bundle
  11. }
  12. }
  13. dependencies {
  14. compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
  15. compile group: 'com.squareup.dagger', name: 'dagger-compiler', version: '1.2.1'
  16. bundle group: 'com.squareup.dagger', name: 'dagger', version: '1.2.1'
  17. bundle group: 'com.esotericsoftware.yamlbeans', name: 'yamlbeans', version: '1.08'
  18. bundle group: 'com.brsanthu', name: 'migbase64', version: '2.2'
  19. bundle group: 'net.kencochrane.raven', name: 'raven', version: '5.0.1'
  20. bundle group: 'com.google.guava', name:'guava', version: '18.0'
  21. bundle group: 'net.engio', name: 'mbassador', version: '1.2.0'
  22. bundle group: 'com.dmdirc', name: 'util', version: '+', changing: true
  23. bundle group: 'com.dmdirc.parser', name: 'common', version: '+', changing: true
  24. plugin group: 'com.dmdirc', name: 'ui_swing', version: '+', changing: true
  25. plugin group: 'com.dmdirc', name: 'parser_irc', version: '+', changing: true
  26. plugin group: 'com.dmdirc', name: 'tabcompleter_bash', version: '+', changing: true
  27. plugin group: 'com.dmdirc', name: 'tabcompleter_mirc', version: '+', changing: true
  28. }
  29. publishing {
  30. publications {
  31. mavenJava(MavenPublication) {
  32. groupId 'com.dmdirc'
  33. artifactId 'client'
  34. artifact jar
  35. }
  36. }
  37. repositories {
  38. maven {
  39. name 'snapshots'
  40. url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
  41. }
  42. }
  43. }
  44. allprojects {
  45. apply plugin: 'java'
  46. apply plugin: 'findbugs'
  47. apply plugin: 'pmd'
  48. sourceSets {
  49. main {
  50. java {
  51. srcDir 'src'
  52. }
  53. resources {
  54. srcDir 'res'
  55. }
  56. }
  57. test {
  58. java {
  59. srcDir 'test'
  60. }
  61. resources {
  62. srcDir 'test-res'
  63. }
  64. }
  65. }
  66. sourceCompatibility = 1.7
  67. targetCompatibility = 1.7
  68. repositories {
  69. mavenCentral()
  70. maven {
  71. url 'http://nexus.dmdirc.com/nexus/content/repositories/thirdparty/'
  72. }
  73. maven {
  74. url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
  75. }
  76. }
  77. dependencies {
  78. testCompile group: 'junit', name: 'junit', version: '4.11'
  79. testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
  80. testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0'
  81. }
  82. pmd {
  83. ruleSets = []
  84. ruleSetFiles = files("$rootDir/etc/pmd/full.xml")
  85. }
  86. tasks.withType(FindBugs) {
  87. reports {
  88. html.enabled = true
  89. xml.enabled = false
  90. }
  91. }
  92. findbugs {
  93. reportLevel = 'low'
  94. effort = 'max'
  95. ignoreFailures = true
  96. }
  97. }
  98. task getCredentials << {
  99. def target = file('nexus-teamcity.gradle')
  100. if (!target.exists()) {
  101. new URL('http://www.dmdirc.com/private/nexus-teamcity.gradle').withInputStream{
  102. i -> target.withOutputStream { it << i }
  103. }
  104. }
  105. apply from: 'nexus-teamcity.gradle'
  106. project.publishing.repositories[0].credentials {
  107. username "$nexusUser"
  108. password "$nexusPass"
  109. }
  110. }
  111. task publishSnapshot(dependsOn: ['getCredentials', 'publishMavenJavaPublicationToSnapshotsRepository']) << {
  112. }
  113. task createVersionConfig << {
  114. def targetFile = new File(buildDir, 'version.config')
  115. targetFile.text = ''
  116. targetFile << "keysections:\n identity\n version\n updater\n bundledplugins_versions\n\n"
  117. targetFile << "identity:\n name=DMDirc version information\n globaldefault=true\n order=95000\n\n"
  118. targetFile << "version:\n version=${version}\n\n"
  119. targetFile << "updater:\n channel=${updaterChannel}\n\n"
  120. targetFile << "buildenv:\n"
  121. def compileConfiguration = project.configurations.getByName("compile")
  122. def resolvedConfiguration = compileConfiguration.resolvedConfiguration
  123. def resolvedArtifacts = resolvedConfiguration.resolvedArtifacts
  124. resolvedArtifacts.each { dp ->
  125. def version = dp.moduleVersion.id
  126. targetFile << " " + version.group + " " + version.name + " " + version.version + "\n"
  127. }
  128. // Copy to the build directory so it's accessible during tests
  129. java.nio.file.Files.copy(targetFile.toPath(),
  130. sourceSets.main.output.classesDir.toPath().resolve('com').resolve('dmdirc').resolve('version.config'),
  131. java.nio.file.StandardCopyOption.REPLACE_EXISTING);
  132. }
  133. jar.dependsOn createVersionConfig
  134. test.dependsOn createVersionConfig
  135. jar {
  136. from("$buildDir/version.config") {
  137. into 'com/dmdirc/'
  138. }
  139. from { configurations.bundle.collect { it.isDirectory() ? it : zipTree(it) } } {
  140. exclude 'META-INF/**'
  141. }
  142. manifest {
  143. attributes 'Main-Class': 'com.dmdirc.Main'
  144. }
  145. }
  146. buildscript {
  147. repositories {
  148. mavenCentral()
  149. maven {
  150. url 'http://nexus.dmdirc.com/nexus/content/repositories/thirdparty/'
  151. }
  152. }
  153. dependencies {
  154. classpath group: 'com.github.shanemcc', name: 'jgit-describe', version: '0.5'
  155. classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '2.3.1.+'
  156. }
  157. }
  158. task wrapper(type: Wrapper) {
  159. gradleVersion = '2.1'
  160. }