Advertisement
Guest User

gradle

a guest
Jan 28th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.15 KB | None | 0 0
  1. plugins {
  2. id 'com.github.kt3k.coveralls' version '2.6.3'
  3. }
  4.  
  5. apply plugin: 'checkstyle'
  6. apply plugin: 'jacoco'
  7. apply plugin: 'java'
  8. apply plugin: 'maven'
  9. apply plugin: 'signing'
  10. apply plugin: 'eclipse'
  11.  
  12. sourceCompatibility = 1.7
  13.  
  14. group = 'com.box'
  15. archivesBaseName = 'box-java-sdk'
  16. version = '2.26.0'
  17.  
  18. repositories {
  19. mavenCentral()
  20. }
  21.  
  22. sourceSets {
  23. example {
  24. java {
  25. compileClasspath += main.output
  26. runtimeClasspath += main.runtimeClasspath
  27. }
  28. }
  29. }
  30.  
  31. dependencies {
  32. compile 'com.eclipsesource.minimal-json:minimal-json:0.9.1'
  33. compile 'org.bitbucket.b_c:jose4j:0.5.5'
  34. compile 'org.bouncycastle:bcprov-jdk15on:1.60'
  35. compile 'org.bouncycastle:bcpkix-jdk15on:1.60'
  36. testCompile 'junit:junit:4.11'
  37. testCompile 'org.hamcrest:hamcrest-library:1.3'
  38. testCompile 'com.github.tomakehurst:wiremock:2.17.0'
  39. testCompile 'org.mockito:mockito-core:1.9.5'
  40. testCompile 'org.slf4j:slf4j-api:1.7.7'
  41. testCompile 'org.slf4j:slf4j-nop:1.7.7'
  42. exampleCompile 'com.eclipsesource.minimal-json:minimal-json:0.9.1'
  43. checkstyle 'com.puppycrawl.tools:checkstyle:5.9'
  44. }
  45.  
  46. compileJava {
  47. sourceCompatibility = JavaVersion.VERSION_1_10
  48. targetCompatibility = JavaVersion.VERSION_1_10
  49. }
  50.  
  51.  
  52. javadoc {
  53. options.windowTitle 'Box Java SDK'
  54. options.noQualifiers 'all'
  55. options.stylesheetFile file('doc/css/javadoc.css')
  56. options.noTree true
  57. options.noIndex true
  58. options.noHelp true
  59. options.noDeprecatedList true
  60. options.noNavBar true
  61. options.encoding 'utf-8'
  62. options.docEncoding 'utf-8'
  63. options.charSet 'utf-8'
  64. options.linkSource true
  65. options.links 'https://docs.oracle.com/javase/8/docs/api/'
  66. }
  67.  
  68. checkstyleMain { classpath += configurations.compile }
  69. checkstyleTest { classpath += configurations.compile }
  70.  
  71. task runExample(type: JavaExec, dependsOn: 'exampleClasses') {
  72. classpath = sourceSets.example.runtimeClasspath
  73. main = 'com.box.sdk.example.Main'
  74. }
  75.  
  76. task runCreateAppUser(type: JavaExec, dependsOn: 'exampleClasses') {
  77. classpath = sourceSets.example.runtimeClasspath
  78. main = 'com.box.sdk.example.CreateAppUser'
  79. }
  80.  
  81. task runAccessAsAppUser(type: JavaExec, dependsOn: 'exampleClasses') {
  82. classpath = sourceSets.example.runtimeClasspath
  83. main = 'com.box.sdk.example.AccessAsAppUser'
  84. }
  85.  
  86. task runBatchExample(type: JavaExec, dependsOn: 'exampleClasses') {
  87. classpath = sourceSets.example.runtimeClasspath
  88. main = 'com.box.sdk.example.BatchRequestExample'
  89. }
  90.  
  91. task javadocJar(type: Jar) {
  92. classifier = 'javadoc'
  93. from javadoc
  94. }
  95.  
  96. task sourcesJar(type: Jar) {
  97. classifier = 'sources'
  98. from sourceSets.main.allSource
  99. }
  100.  
  101. task integrationTest(type: Test) {
  102. description 'Runs the integration tests.'
  103. group 'Verification'
  104. testLogging.showStandardStreams = true
  105. useJUnit {
  106. includeCategories 'com.box.sdk.IntegrationTest'
  107.  
  108. }
  109. }
  110.  
  111. task integrationTestDebug(type: Test) {
  112. description 'Runs the integration tests.'
  113. group 'Verification'
  114. testLogging.showStandardStreams = true
  115. useJUnit {
  116. includeCategories 'com.box.sdk.IntegrationTestDebug'
  117.  
  118. }
  119. }
  120.  
  121. task integrationTestJWT(type: Test) {
  122. description 'Runs the JWT based integration tests.'
  123. group 'Verification'
  124. testLogging.showStandardStreams = true
  125. useJUnit {
  126. includeCategories 'com.box.sdk.IntegrationTestJWT'
  127.  
  128. }
  129. }
  130.  
  131. jacoco {
  132. reportsDir = file("$buildDir/reports/jacoco")
  133. }
  134.  
  135. jacocoTestReport {
  136. reports {
  137. xml.enabled = true // coveralls plugin depends on xml format report
  138. html.enabled = true
  139. }
  140. }
  141. //jacocoTestReport.dependsOn(check)
  142.  
  143. tasks.withType(JavaCompile) {
  144. options.compilerArgs << '-Xlint:all'
  145.  
  146. if (project.hasProperty('bootClasspath')) {
  147. options.bootClasspath = bootClasspath
  148. }
  149. }
  150.  
  151. tasks.withType(Test) {
  152. testLogging {
  153. exceptionFormat = 'full'
  154. }
  155.  
  156. jacoco {
  157. append = true
  158. destinationFile = file("$buildDir/jacoco/test.exec")
  159. }
  160.  
  161. outputs.upToDateWhen { false }
  162. }
  163.  
  164. artifacts {
  165. archives sourcesJar, javadocJar
  166. }
  167.  
  168. test {
  169. useJUnit {
  170. excludeCategories 'com.box.sdk.IntegrationTest'
  171. excludeCategories 'com.box.sdk.IntegrationTestDebug'
  172. excludeCategories 'com.box.sdk.IntegrationTestJWT'
  173. }
  174. }
  175.  
  176. signing {
  177. required { !version.endsWith('SNAPSHOT') && gradle.taskGraph.hasTask('uploadArchives') }
  178. sign configurations.archives
  179. }
  180.  
  181. uploadArchives {
  182. repositories {
  183. mavenDeployer {
  184. beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
  185.  
  186. if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
  187. repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
  188. authentication(userName: ossrhUsername, password: ossrhPassword)
  189. }
  190.  
  191. snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
  192. authentication(userName: ossrhUsername, password: ossrhPassword)
  193. }
  194. }
  195.  
  196. pom.project {
  197. name 'Box Java SDK'
  198. packaging 'jar'
  199. description 'The Box SDK for Java.'
  200. url 'http://opensource.box.com/box-java-sdk/'
  201.  
  202. scm {
  203. connection 'scm:git:https://github.com/box/box-java-sdk.git'
  204. developerConnection 'scm:git:https://github.com/box/box-java-sdk.git'
  205. url 'https://github.com/box/box-java-sdk'
  206. }
  207.  
  208. licenses {
  209. license {
  210. name 'The Apache License, Version 2.0'
  211. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  212. }
  213. }
  214.  
  215. developers {
  216. developer {
  217. id 'gcurtis'
  218. name 'Greg Curtis'
  219. email 'gcurtis@box.com'
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement