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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. def jgit = new org.mdonoughe.JGitDescribeTask()
  2. jgit.dir = new File(projectDir, '.git')
  3. project.version = jgit.getDescription() + '-SNAPSHOT'
  4. group = 'com.dmdirc'
  5. apply plugin: 'maven-publish'
  6. apply plugin: 'java'
  7. apply plugin: 'findbugs'
  8. apply plugin: 'pmd'
  9. configurations {
  10. bundle
  11. plugin
  12. compile {
  13. extendsFrom bundle
  14. }
  15. }
  16. configurations.all {
  17. resolutionStrategy.cacheDynamicVersionsFor 2, 'minutes'
  18. resolutionStrategy.cacheChangingModulesFor 2, 'minutes'
  19. }
  20. dependencies {
  21. compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
  22. compile group: 'com.squareup.dagger', name: 'dagger-compiler', version: '1.2.1'
  23. bundle group: 'com.squareup.dagger', name: 'dagger', version: '1.2.1'
  24. bundle group: 'com.esotericsoftware.yamlbeans', name: 'yamlbeans', version: '1.08'
  25. bundle group: 'com.brsanthu', name: 'migbase64', version: '2.2'
  26. bundle group: 'net.kencochrane.raven', name: 'raven', version: '5.0.1'
  27. bundle group: 'com.google.guava', name:'guava', version: '18.0'
  28. bundle group: 'net.engio', name: 'mbassador', version: '1.2.0'
  29. bundle group: 'com.dmdirc', name: 'util', version: '+', changing: true
  30. bundle group: 'com.dmdirc.parser', name: 'common', version: '+', changing: true
  31. plugin group: 'com.dmdirc', name: 'ui_swing', version: '+', changing: true
  32. plugin group: 'com.dmdirc', name: 'parser_irc', version: '+', changing: true
  33. plugin group: 'com.dmdirc', name: 'tabcompleter_bash', version: '+', changing: true
  34. plugin group: 'com.dmdirc', name: 'tabcompleter_mirc', version: '+', changing: true
  35. testCompile group: 'junit', name: 'junit', version: '4.11'
  36. testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
  37. testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0'
  38. }
  39. publishing {
  40. publications {
  41. mavenJava(MavenPublication) {
  42. groupId 'com.dmdirc'
  43. artifactId 'client'
  44. artifact jar
  45. }
  46. }
  47. repositories {
  48. maven {
  49. name 'snapshots'
  50. url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
  51. }
  52. }
  53. }
  54. sourceSets {
  55. main {
  56. java {
  57. srcDir 'src'
  58. }
  59. resources {
  60. srcDir 'res'
  61. }
  62. }
  63. test {
  64. java {
  65. srcDir 'test'
  66. }
  67. resources {
  68. srcDir 'test-res'
  69. }
  70. }
  71. }
  72. sourceCompatibility = 1.7
  73. targetCompatibility = 1.7
  74. repositories {
  75. mavenCentral()
  76. maven {
  77. url 'http://nexus.dmdirc.com/nexus/content/repositories/thirdparty/'
  78. }
  79. maven {
  80. url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
  81. }
  82. }
  83. pmd {
  84. ruleSets = []
  85. ruleSetFiles = files("$rootDir/etc/pmd/full.xml")
  86. }
  87. tasks.withType(FindBugs) {
  88. reports {
  89. html.enabled = true
  90. xml.enabled = false
  91. }
  92. }
  93. findbugs {
  94. reportLevel = 'low'
  95. effort = 'max'
  96. ignoreFailures = true
  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. }