Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f800d2e
docs: Added example usage for getting versions with specified fields.
antusus Dec 1, 2021
9d40faf
chore: Version number is a Long value
antusus Dec 8, 2021
e6bdfa7
docs: Updated documentation of retention policies for new parameters
lukaszsocha2 Dec 17, 2021
62d6d67
docs: small changes in retention example
antusus Dec 17, 2021
080b66d
chore: updated anchors for shared links
antusus Jan 3, 2022
f1c4f49
chore: change `getFileVersionsUnderRetention` example
antusus Jan 11, 2022
859be20
chore: Update events.md doc to show what we can filter by String type…
antusus Jan 11, 2022
e4e50bc
chore: events.md fix formatting
antusus Jan 11, 2022
540afde
build: Upgrading to Gradle 7.3.3
antusus Jan 12, 2022
e0d5a2a
chore: fixed checkstyle tasks
antusus Jan 12, 2022
a83786c
chore: Add constraint to prevent from changing bouncycatle libraries …
antusus Jan 13, 2022
86ae195
chore: add local repo for testing
antusus Jan 13, 2022
e8fed06
chore: switch to use gpg agent
antusus Jan 18, 2022
a54a9c9
chore: switch to use gpg agent 4
antusus Jan 18, 2022
122ca71
Merge branch 'main' into kb/sdk-1894_gradle_upgrade
antusus Jan 18, 2022
45223b6
chore: switch to use gpg agent 5
antusus Jan 19, 2022
0297ad1
chore: switch to use gpg agent 6
antusus Jan 19, 2022
0667741
chore: switch to use gpg agent 7
antusus Jan 19, 2022
5dc4f31
chore: remove local repository
antusus Jan 19, 2022
ed5832a
build: upgrade org.mockito:mockito-core:4.2.0
antusus Jan 19, 2022
510fd63
chore: added missing @Deprecated
antusus Jan 20, 2022
455bf99
chore: Cleanup
antusus Jan 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 119 additions & 110 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
plugins {
id 'com.github.nbaztec.coveralls-jacoco' version '1.2.13'
id "com.github.nbaztec.coveralls-jacoco" version "1.2.14"
id "checkstyle"
id "jacoco"
id "java"
id "maven-publish"
id "signing"
id "eclipse"
id "idea"
}

apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'eclipse'
apply plugin: 'idea'

sourceCompatibility = 1.8

group = 'com.box'
archivesBaseName = 'box-java-sdk'
version = '3.0.0'
group = "com.box"
archivesBaseName = "box-java-sdk"
version = "3.0.0"

java {
withJavadocJar()
withSourcesJar()
}

repositories {
mavenCentral()
Expand All @@ -38,27 +42,34 @@ sourceSets {
}

configurations {
intTestImplementation.extendsFrom implementation
intTestRuntimeOnly.extendsFrom runtimeOnly
testsCommonImplementation.extendsFrom(implementation)
testImplementation.extendsFrom(testsCommonImplementation)
intTestImplementation.extendsFrom(testsCommonImplementation)
intTestRuntimeOnly.extendsFrom(runtimeOnly)
}

dependencies {
compile 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
compile 'org.bitbucket.b_c:jose4j:0.7.9'
// Do not update to latest version, as v1.57 is needed for FIPS compliance purposes
compile 'org.bouncycastle:bcprov-jdk15on:1.57'
// Do not update to latest version, as v1.57 is needed for FIPS compliance purposes
compile 'org.bouncycastle:bcpkix-jdk15on:1.57'
testCompile 'junit:junit:4.13.2'
testCompile 'org.hamcrest:hamcrest-library:2.2'
testCompile 'com.github.tomakehurst:wiremock:2.27.2'
testCompile 'org.mockito:mockito-core:4.1.0'
testCompile 'org.slf4j:slf4j-nop:1.7.32'
exampleCompile 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
checkstyle 'com.puppycrawl.tools:checkstyle:6.19'
intTestImplementation 'junit:junit:4.13.2'
intTestImplementation 'org.hamcrest:hamcrest-library:2.2'
intTestImplementation 'org.mockito:mockito-core:4.1.0'
implementation "com.eclipsesource.minimal-json:minimal-json:0.9.5"
implementation "org.bitbucket.b_c:jose4j:0.7.9"
implementation("org.bouncycastle:bcprov-jdk15on") {
version {
strictly("1.57")
}
because "v1.57 is compatible with org.bouncycastle:bc-fips:1.0.2.1 which is needed for FIPS compliance purposes"
}
implementation("org.bouncycastle:bcpkix-jdk15on") {
version {
strictly("1.57")
}
because "v1.57 is compatible with org.bouncycastle:bc-fips:1.0.2.1 which is needed for FIPS compliance purposes"
}
testsCommonImplementation "junit:junit:4.13.2"
testsCommonImplementation "org.hamcrest:hamcrest-library:2.2"
testsCommonImplementation "org.mockito:mockito-core:4.2.0"
testImplementation "com.github.tomakehurst:wiremock:2.27.2"
testImplementation "org.slf4j:slf4j-nop:1.7.32"
exampleImplementation "com.eclipsesource.minimal-json:minimal-json:0.9.5"
checkstyle "com.puppycrawl.tools:checkstyle:6.19"
}

compileJava {
Expand All @@ -67,163 +78,161 @@ compileJava {
}

javadoc {
options.windowTitle 'Box Java SDK'
options.noQualifiers 'all'
options.stylesheetFile file('doc/css/javadoc.css')
options.windowTitle "Box Java SDK"
options.noQualifiers "all"
options.stylesheetFile file("doc/css/javadoc.css")
options.noTree true
options.noIndex true
options.noHelp true
options.noDeprecatedList true
options.noNavBar true
options.encoding 'utf-8'
options.docEncoding 'utf-8'
options.charSet 'utf-8'
options.encoding "utf-8"
options.docEncoding "utf-8"
options.charSet "utf-8"
options.linkSource true
options.links 'https://docs.oracle.com/javase/8/docs/api/'
options.links "https://docs.oracle.com/javase/8/docs/api/"
}

checkstyleMain { classpath += configurations.compile }
checkstyleTest { classpath += configurations.compile }

task runExample(type: JavaExec, dependsOn: 'exampleClasses') {
task runExample(type: JavaExec, dependsOn: "exampleClasses") {
classpath = sourceSets.example.runtimeClasspath
main = 'com.box.sdk.example.Main'
mainClass = "com.box.sdk.example.Main"
}

task runCreateAppUser(type: JavaExec, dependsOn: 'exampleClasses') {
task runCreateAppUser(type: JavaExec, dependsOn: "exampleClasses") {
classpath = sourceSets.example.runtimeClasspath
main = 'com.box.sdk.example.CreateAppUser'
mainClass = "com.box.sdk.example.CreateAppUser"
}

task runAccessAsAppUser(type: JavaExec, dependsOn: 'exampleClasses') {
task runAccessAsAppUser(type: JavaExec, dependsOn: "exampleClasses") {
classpath = sourceSets.example.runtimeClasspath
main = 'com.box.sdk.example.AccessAsAppUser'
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
mainClass = "com.box.sdk.example.AccessAsAppUser"
}

task integrationTest(type: Test) {
description 'Runs the integration tests.'
group 'Verification'
description = "Runs the integration tests."
group = "Verification"
testLogging.showStandardStreams = true
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
}

//TODO: enable JWT tests
//task integrationTestJWT(type: Test) {
// description 'Runs the JWT based integration tests.'
// group 'Verification'
// description "Runs the JWT based integration tests."
// group "Verification"
// testLogging.showStandardStreams = true
// useJUnit {
// includeCategories 'com.box.sdk.IntegrationTestJWT'
// includeCategories "com.box.sdk.IntegrationTestJWT"
// }
//}

jacoco {
reportsDir = file("$buildDir/reports/jacoco")
reportsDirectory = file("$buildDir/reports/jacoco")
}

jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
xml.required = true // coveralls plugin depends on xml format report
html.required = true
}
}

tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:all'
options.compilerArgs << "-Xlint:all"

if (project.hasProperty('bootClasspath')) {
options.bootClasspath = bootClasspath
if (project.hasProperty("bootClasspath")) {
String bootClasspathString = project.property("bootClasspath")
String[] bootClasspath = bootClasspathString.split(File.pathSeparator)
options.bootstrapClasspath = files(bootClasspath)
}
}

tasks.withType(Test) {
testLogging {
exceptionFormat = 'full'
exceptionFormat = "full"
}

jacoco {
append = true
destinationFile = file("$buildDir/jacoco/test.exec")
}

outputs.upToDateWhen { false }
}

tasks.withType(GenerateModuleMetadata) {
enabled = false
}

artifacts {
archives sourcesJar, javadocJar
}

test {
useJUnit {
excludeCategories 'com.box.sdk.IntegrationTestJWT'
excludeCategories "com.box.sdk.IntegrationTestJWT"
}
}

signing {
required { !version.endsWith('SNAPSHOT') && gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
}

pom.project {
name 'Box Java SDK'
packaging 'jar'
description 'The Box SDK for Java.'
url 'http://opensource.box.com/box-java-sdk/'

scm {
connection 'scm:git:https://github.com/box/box-java-sdk.git'
developerConnection 'scm:git:https://github.com/box/box-java-sdk.git'
url 'https://github.com/box/box-java-sdk'
}

publishing {
publications {
boxJavaSdk(MavenPublication) {
from components.java
pom {
artifactId = project.getArchivesBaseName()
name = "Box Java SDK"
description = "The Box SDK for Java."
url = "https://opensource.box.com/box-java-sdk/"
packaging = "jar"
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

developers {
developer {
id 'gcurtis'
name 'Greg Curtis'
email 'gcurtis@box.com'
id = "box"
name = "Box"
email = "sdks@box.com"
}
}
scm {
connection = "scm:git:https://github.com/box/box-java-sdk.git"
developerConnection = "scm:git:https://github.com/box/box-java-sdk.git"
url = "https://github.com/box/box-java-sdk"
}
}
}
}

repositories {
maven {
name = "sonatype"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
if (project.hasProperty("ossrhUsername") && project.hasProperty("ossrhPassword")) {
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}

signing {
required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("publish") }
// we are switching to gpg-agent and not using Java-based implementation because of
// org.bouncycastle:bc-fips:1.0.2.1 libray preset in our Docker machines which is
// not comaptible with Gradle implementation
useGpgCmd()
sign publishing.publications.boxJavaSdk
}

idea {
module {
sourceDirs -= file('src/intTest/java')
testSourceDirs += file('src/intTest/java')
sourceDirs -= file("src/intTest/java")
testSourceDirs += file("src/intTest/java")
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Dec 14 13:15:46 CET 2021
#Tue Jan 11 17:10:51 CET 2022
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class BoxDeveloperEditionAPIConnection extends BoxAPIConnection {
private final String privateKey;
private final String privateKeyPassword;
private BackoffCounter backoffCounter;
private IAccessTokenCache accessTokenCache;
private final IAccessTokenCache accessTokenCache;

/**
* Disabling an invalid constructor for Box Developer Edition.
Expand Down Expand Up @@ -375,6 +375,7 @@ public static BoxDeveloperEditionAPIConnection getAppUserConnection(String userI
* @return a new instance of BoxAPIConnection.
* @deprecated use {@link BoxDeveloperEditionAPIConnection#getUserConnection(String, BoxConfig, IAccessTokenCache)}
*/
@Deprecated
public static BoxDeveloperEditionAPIConnection getUserConnection(String userId, BoxConfig boxConfig) {
return getAppUserConnection(userId, boxConfig.getClientId(), boxConfig.getClientSecret(),
boxConfig.getJWTEncryptionPreferences());
Expand Down