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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. sonarqube {
  2. properties {
  3. property 'sonar.projectName', "${projectTitle} :: Plugin API"
  4. }
  5. }
  6. apply plugin: 'com.github.johnrengelman.shadow'
  7. dependencies {
  8. // please keep the list grouped by configuration and ordered by name
  9. compile 'commons-codec:commons-codec'
  10. compile 'commons-io:commons-io'
  11. compile 'commons-lang:commons-lang'
  12. compile 'com.google.code.gson:gson'
  13. compile 'com.google.guava:guava'
  14. // shaded, but not relocated
  15. compile project(':sonar-check-api')
  16. shadow 'org.codehaus.staxmate:staxmate'
  17. shadow 'org.codehaus.woodstox:stax2-api'
  18. shadow 'org.codehaus.woodstox:woodstox-core-lgpl'
  19. compileOnly 'ch.qos.logback:logback-classic'
  20. compileOnly 'ch.qos.logback:logback-core'
  21. compileOnly 'com.google.code.findbugs:jsr305'
  22. compileOnly 'javax.servlet:javax.servlet-api'
  23. compileOnly 'junit:junit'
  24. compileOnly 'org.slf4j:slf4j-api'
  25. testCompile 'com.tngtech.java:junit-dataprovider'
  26. testCompile 'org.assertj:assertj-core'
  27. testCompile 'org.mockito:mockito-core'
  28. testCompile project(':sonar-testing-harness')
  29. }
  30. sourceSets {
  31. // Make the compileOnly dependencies available when compiling/running tests
  32. test.compileClasspath += configurations.compileOnly + configurations.shadow
  33. test.runtimeClasspath += configurations.compileOnly + configurations.shadow
  34. }
  35. def on3Digits(version) {
  36. def projectversion3digits = version - ~/-\w+/
  37. projectversion3digits = projectversion3digits.tokenize('.').plus(0).take(3).join('.')
  38. }
  39. import org.apache.tools.ant.filters.ReplaceTokens
  40. processResources {
  41. filter ReplaceTokens, tokens: [
  42. // The build version is composed of 4 fields, including the semantic version and the build number provided by Travis.
  43. 'project.buildVersion': project.version.endsWith('SNAPSHOT') ? project.version : on3Digits(project.version) + '.' + System.getProperty("buildNumber"),
  44. 'project.version.3digits': project.version.endsWith('SNAPSHOT') ? project.version : on3Digits(project.version)
  45. ]
  46. }
  47. shadowJar {
  48. configurations = [project.configurations.default]
  49. relocate('com.google', 'org.sonar.api.internal.google')
  50. relocate('org.apache.commons', 'org.sonar.api.internal.apachecommons')
  51. dependencies {
  52. exclude(dependency('org.codehaus.woodstox:woodstox-core-lgpl'))
  53. exclude(dependency('org.codehaus.woodstox:stax2-api'))
  54. exclude(dependency('org.codehaus.staxmate:staxmate'))
  55. }
  56. }
  57. artifactoryPublish.skip = false
  58. publishing {
  59. publications {
  60. mavenJava(MavenPublication) {
  61. artifact source: shadowJar, classifier: null
  62. if (release) {
  63. artifact sourcesJar
  64. artifact javadocJar
  65. }
  66. }
  67. }
  68. }