Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

build.gradle 2.3KB

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