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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. // shaded, but not relocated
  14. compile project(':sonar-check-api')
  15. shadow 'org.codehaus.staxmate:staxmate'
  16. shadow 'org.codehaus.woodstox:stax2-api'
  17. shadow 'org.codehaus.woodstox:woodstox-core-lgpl'
  18. compileOnly 'ch.qos.logback:logback-classic'
  19. compileOnly 'com.google.code.findbugs:jsr305'
  20. compileOnly 'javax.servlet:javax.servlet-api'
  21. compileOnly 'junit:junit'
  22. compileOnly 'org.slf4j:slf4j-api'
  23. testCompile 'com.google.guava:guava'
  24. testCompile 'com.tngtech.java:junit-dataprovider'
  25. testCompile 'org.assertj:assertj-core'
  26. testCompile 'org.mockito:mockito-core'
  27. testCompile project(':sonar-plugin-api-impl')
  28. }
  29. sourceSets {
  30. // Make the compileOnly dependencies available when compiling/running tests
  31. test.compileClasspath += configurations.compileOnly + configurations.shadow
  32. test.runtimeClasspath += configurations.compileOnly + configurations.shadow
  33. }
  34. def on3Digits(version) {
  35. def projectversion3digits = version - ~/-\w+/
  36. projectversion3digits = projectversion3digits.tokenize('.').plus(0).take(3).join('.')
  37. }
  38. import org.apache.tools.ant.filters.ReplaceTokens
  39. processResources {
  40. filter ReplaceTokens, tokens: [
  41. // The build version is composed of 4 fields, including the semantic version and the build number provided by Travis.
  42. 'project.buildVersion': project.version.endsWith('SNAPSHOT') ? project.version : on3Digits(project.version) + '.' + System.getProperty("buildNumber"),
  43. 'project.version.3digits': project.version.endsWith('SNAPSHOT') ? project.version : on3Digits(project.version)
  44. ]
  45. }
  46. shadowJar {
  47. configurations = [project.configurations.default]
  48. relocate('com.google', 'org.sonar.api.internal.google')
  49. relocate('org.apache.commons', 'org.sonar.api.internal.apachecommons')
  50. }
  51. // only interested in shadowJar
  52. jar.enabled = false
  53. artifactoryPublish.skip = false
  54. publishing {
  55. publications {
  56. mavenJava(MavenPublication) {
  57. artifact source: shadowJar, classifier: null
  58. if (release) {
  59. artifact sourcesJar
  60. artifact javadocJar
  61. }
  62. }
  63. }
  64. }