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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import org.mdonoughe.JGitDescribeTask
  2. def jgit = new org.mdonoughe.JGitDescribeTask()
  3. jgit.setDir(new File("$projectDir", '.git'))
  4. project.version = jgit.getDescription() + '-SNAPSHOT'
  5. apply plugin: 'java'
  6. apply plugin: 'maven-publish'
  7. group = 'com.dmdirc'
  8. sourceSets {
  9. main {
  10. java.srcDirs = ['src']
  11. resources.srcDirs = ['res']
  12. }
  13. test {
  14. java.srcDirs = ['test']
  15. resources.srcDirs = ['test-res']
  16. }
  17. }
  18. sourceCompatibility = 1.8
  19. targetCompatibility = 1.8
  20. repositories.mavenCentral()
  21. dependencies {
  22. compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
  23. testCompile group: 'junit', name: 'junit', version: '4.11'
  24. testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
  25. testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0'
  26. }
  27. publishing {
  28. publications {
  29. mavenJava(MavenPublication) {
  30. from components.java
  31. }
  32. }
  33. repositories {
  34. maven {
  35. name 'snapshots'
  36. url 'http://artifactory.dmdirc.com/artifactory/repo'
  37. }
  38. }
  39. }
  40. task wrapper(type: Wrapper) {
  41. gradleVersion = '2.2.1'
  42. }
  43. task getCredentials << {
  44. def target = file('nexus-teamcity.gradle')
  45. if (!target.exists()) {
  46. new URL('http://www.dmdirc.com/private/nexus-teamcity.gradle').withInputStream{
  47. i -> target.withOutputStream { it << i }
  48. }
  49. }
  50. apply from: 'nexus-teamcity.gradle'
  51. project.publishing.repositories[0].credentials {
  52. username "$nexusUser"
  53. password "$nexusPass"
  54. }
  55. }
  56. task publishSnapshot(dependsOn: ['getCredentials', 'publishMavenJavaPublicationToSnapshotsRepository']) << {
  57. }
  58. buildscript {
  59. repositories {
  60. mavenCentral()
  61. maven {
  62. url 'http://artifactory.dmdirc.com/artifactory/repo'
  63. }
  64. }
  65. dependencies {
  66. classpath group: 'com.github.shanemcc', name: 'jgit-describe', version: '0.5'
  67. classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '2.3.1.+'
  68. }
  69. }