Skip to content

Starting to modernize Gradle #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
37 changes: 17 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
*/

buildscript {
ext.kotlin_version = '1.2.70'
ext.kotlin_version = '1.6.10'

repositories {
mavenCentral()
jcenter()
}

dependencies {
Expand All @@ -41,10 +40,8 @@ allprojects {

subprojects {
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'findbugs'

sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
Expand All @@ -53,49 +50,49 @@ subprojects {
}

dependencies {
compile "org.slf4j:slf4j-api:$slf4jVersion"
testCompile ("org.mockito:mockito-core:$mockitoVersion") {
implementation "org.slf4j:slf4j-api:$slf4jVersion"
testImplementation ("org.mockito:mockito-core:$mockitoVersion") {
exclude group: 'org.hamcrest'
}

testCompile "junit:junit:$junitVersion"
testCompile "org.slf4j:slf4j-simple:$slf4jVersion"
testImplementation "junit:junit:$junitVersion"
testImplementation "org.slf4j:slf4j-simple:$slf4jVersion"
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.7'
}

project(':ds3-sdk') {
dependencies {
compile project(':ds3-interfaces')
compile project(':ds3-utils')
implementation project(':ds3-interfaces')
implementation project(':ds3-utils')
}
}

project(':ds3-metadata') {
dependencies {
compile project(':ds3-interfaces')
compile project(':ds3-utils')
implementation project(':ds3-interfaces')
implementation project(':ds3-utils')
}
}

project(':ds3-sdk-integration') {
dependencies {
compile project(':ds3-sdk')
compile project(':ds3-metadata')
implementation project(':ds3-sdk')
implementation project(':ds3-interfaces')
implementation project(':ds3-metadata')
implementation project(':ds3-utils')
}
}

project(':ds3-sdk-samples') {
dependencies {
compile project(':ds3-sdk')
implementation project(':ds3-sdk')
implementation project(':ds3-interfaces')
implementation project(':ds3-utils')
}
}

project(':ds3-utils') {
dependencies {
compile project(':ds3-interfaces')
implementation project(':ds3-interfaces')
}
}
12 changes: 7 additions & 5 deletions ds3-metadata/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ artifacts {
}

dependencies {
compile group: 'net.java.dev.jna', name: 'jna-platform', version: "$jnaVersion"
compile group: 'net.java.dev.jna', name: 'jna', version: "$jnaVersion"
compile "commons-io:commons-io:$commonsioVersion"
compile "org.apache.httpcomponents:httpclient:$httpclientVersion"
implementation group: 'net.java.dev.jna', name: 'jna-platform', version: "$jnaVersion"
implementation group: 'net.java.dev.jna', name: 'jna', version: "$jnaVersion"
implementation "commons-io:commons-io:$commonsioVersion"
implementation "org.apache.httpcomponents:httpclient:$httpclientVersion"
implementation "com.google.guava:guava:$guavaVersion"

testCompile group: 'org.apache.commons', name: 'commons-lang3', version: "$commonslangVersion"

testImplementation group: 'org.apache.commons', name: 'commons-lang3', version: "$commonslangVersion"
}
11 changes: 7 additions & 4 deletions ds3-sdk-integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
*/

dependencies {
compile "commons-codec:commons-codec:$commonscodecVersion"
compile "junit:junit:$junitVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
testCompile group: 'org.apache.commons', name: 'commons-lang3', version: "$commonslangVersion"
implementation "commons-io:commons-io:$commonsioVersion"
implementation "commons-codec:commons-codec:$commonscodecVersion"
implementation "org.apache.httpcomponents:httpclient:$httpclientVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "junit:junit:$junitVersion"
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
testImplementation group: 'org.apache.commons', name: 'commons-lang3', version: "$commonslangVersion"
}

3 changes: 2 additions & 1 deletion ds3-sdk-samples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ apply plugin: 'application'
mainClassName = 'com.spectralogic.ds3client.samples.PartialObjectGetExample'

dependencies {
compile "org.slf4j:slf4j-simple:$slf4jVersion"
implementation "org.slf4j:slf4j-simple:$slf4jVersion"
implementation "com.google.guava:guava:$guavaVersion"
}
29 changes: 15 additions & 14 deletions ds3-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ task genConfigProperties {
}
}

task zip(type: Zip) {
from configurations.runtime.allArtifacts.files
from configurations.runtime
into (project.name + "-" + project.version)
}
//task zip(type: Zip) {
// from configurations.runtime.allArtifacts.files
// from configurations.runtime
// into (project.name + "-" + project.version)
//}

zip.dependsOn jar
//zip.dependsOn jar

jar {
from sourceSets.main.allJava
Expand All @@ -85,12 +85,13 @@ jar.dependsOn genConfigProperties
shadowJar.dependsOn genConfigProperties

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.apache.httpcomponents:httpclient:$httpclientVersion"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jacksonVersion"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion"
compile "com.google.guava:guava:$guavaVersion"
compile 'org.codehaus.woodstox:woodstox-core-asl:4.4.1'
compile 'com.google.code.findbugs:annotations:3.0.1'
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "commons-io:commons-io:$commonsioVersion"
implementation "org.apache.httpcomponents:httpclient:$httpclientVersion"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jacksonVersion"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation 'org.codehaus.woodstox:woodstox-core-asl:4.4.1'
implementation 'com.google.code.findbugs:annotations:3.0.1'
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
import com.spectralogic.ds3client.networking.ConnectionDetails;
import com.spectralogic.ds3client.networking.FailedRequestException;
import com.spectralogic.ds3client.utils.ByteArraySeekableByteChannel;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.Mockito;

import java.io.IOException;
Expand Down Expand Up @@ -109,7 +109,7 @@ public SeekableByteChannel buildChannel(final String key) throws IOException {
public void testReadObjectsWithFailedGet() throws IOException, ParseException {
final Ds3Client ds3Client = mock(Ds3Client.class);

Mockito.when(ds3Client.newForNode(Matchers.any())).thenReturn(ds3Client);
Mockito.when(ds3Client.newForNode(any())).thenReturn(ds3Client);

final GetBulkJobSpectraS3Response buildBulkGetResponse = buildBulkGetResponse();
Mockito.when(ds3Client.getBulkJobSpectraS3(hasChunkOrdering(JobChunkClientProcessingOrderGuarantee.NONE))).thenReturn(buildBulkGetResponse);
Expand Down Expand Up @@ -144,7 +144,7 @@ public void testWriteObjects() throws IOException, ParseException {
final Ds3Client ds3Client = buildDs3ClientForBulk();

final PutBulkJobSpectraS3Response bulkPutResponse = buildBulkPutResponse();
Mockito.when(ds3Client.putBulkJobSpectraS3(Matchers.any(PutBulkJobSpectraS3Request.class))).thenReturn(bulkPutResponse);
Mockito.when(ds3Client.putBulkJobSpectraS3(any(PutBulkJobSpectraS3Request.class))).thenReturn(bulkPutResponse);

final AllocateJobChunkSpectraS3Response allocateResponse1 = buildAllocateResponse1();
final AllocateJobChunkSpectraS3Response allocateResponse2 = buildAllocateResponse2();
Expand Down Expand Up @@ -204,11 +204,11 @@ public void testWriteObjectsWithFailedPut() throws IOException, ParseException {
final ConnectionDetails details = mock(ConnectionDetails.class);
Mockito.when(details.getEndpoint()).thenReturn("localhost");

Mockito.when(ds3Client.newForNode(Matchers.any())).thenReturn(ds3Client);
Mockito.when(ds3Client.newForNode(any())).thenReturn(ds3Client);
Mockito.when(ds3Client.getConnectionDetails()).thenReturn(details);

final PutBulkJobSpectraS3Response buildBulkPutResponse = buildBulkPutResponse();
Mockito.when(ds3Client.putBulkJobSpectraS3(Matchers.any(PutBulkJobSpectraS3Request.class))).thenReturn(buildBulkPutResponse);
Mockito.when(ds3Client.putBulkJobSpectraS3(any(PutBulkJobSpectraS3Request.class))).thenReturn(buildBulkPutResponse);

final AllocateJobChunkSpectraS3Response allocateResponse2 = buildAllocateResponse2();
final AllocateJobChunkSpectraS3Response allocateResponse3 = buildAllocateResponse3();
Expand Down Expand Up @@ -296,7 +296,7 @@ public void testRecoverWriteJob() throws IOException, JobRecoveryException, Pars
final Ds3Client ds3Client = buildDs3ClientForBulk();

final ModifyJobSpectraS3Response modifyWriteJobResponse = buildModifyWriteJobResponse();
Mockito.when(ds3Client.modifyJobSpectraS3(Matchers.any(ModifyJobSpectraS3Request.class))).thenReturn(modifyWriteJobResponse);
Mockito.when(ds3Client.modifyJobSpectraS3(any(ModifyJobSpectraS3Request.class))).thenReturn(modifyWriteJobResponse);

final Job job = Ds3ClientHelpers.wrap(ds3Client).recoverWriteJob(jobId);
assertThat(job.getJobId(), is(jobId));
Expand All @@ -308,7 +308,7 @@ public void testRecoverWriteJobThrowsJobRecoveryExceptionForWrongRequestType() t
final Ds3Client ds3Client = buildDs3ClientForBulk();

final ModifyJobSpectraS3Response modifyReadJobResponse = buildModifyReadJobResponse();
Mockito.when(ds3Client.modifyJobSpectraS3(Matchers.any(ModifyJobSpectraS3Request.class))).thenReturn(modifyReadJobResponse);
Mockito.when(ds3Client.modifyJobSpectraS3(any(ModifyJobSpectraS3Request.class))).thenReturn(modifyReadJobResponse);

Ds3ClientHelpers.wrap(ds3Client).recoverWriteJob(jobId);
}
Expand All @@ -318,7 +318,7 @@ public void testRecoverReadJob() throws IOException, JobRecoveryException, Parse
final Ds3Client ds3Client = buildDs3ClientForBulk();

final ModifyJobSpectraS3Response modifyReadJobResponse = buildModifyReadJobResponse();
Mockito.when(ds3Client.modifyJobSpectraS3(Matchers.any(ModifyJobSpectraS3Request.class))).thenReturn(modifyReadJobResponse);
Mockito.when(ds3Client.modifyJobSpectraS3(any(ModifyJobSpectraS3Request.class))).thenReturn(modifyReadJobResponse);

final Job job = Ds3ClientHelpers.wrap(ds3Client).recoverReadJob(jobId);
assertThat(job.getJobId(), is(jobId));
Expand All @@ -330,7 +330,7 @@ public void testRecoverReadJobThrowsJobRecoveryExceptionForWrongRequestType() th
final Ds3Client ds3Client = buildDs3ClientForBulk();

final ModifyJobSpectraS3Response modifyWriteJobResponse = buildModifyWriteJobResponse();
Mockito.when(ds3Client.modifyJobSpectraS3(Matchers.any(ModifyJobSpectraS3Request.class))).thenReturn(modifyWriteJobResponse);
Mockito.when(ds3Client.modifyJobSpectraS3(any(ModifyJobSpectraS3Request.class))).thenReturn(modifyWriteJobResponse);

Ds3ClientHelpers.wrap(ds3Client).recoverReadJob(jobId);
}
Expand Down Expand Up @@ -424,7 +424,7 @@ private static Ds3Client buildDs3ClientForBulk() throws IOException,
.thenReturn(jobChunksResponse2)
.thenReturn(jobChunksResponse3);

Mockito.when(ds3Client.newForNode(Matchers.any())).thenReturn(ds3Client);
Mockito.when(ds3Client.newForNode(any())).thenReturn(ds3Client);
Mockito.when(ds3Client.getConnectionDetails()).thenReturn(details);
return ds3Client;
}
Expand Down Expand Up @@ -613,7 +613,7 @@ public void testWriteObjectsWithRetryAfter() throws IOException, ParseException

final PutBulkJobSpectraS3Response bulkPutResponse = buildBulkPutResponse();
Mockito.when(ds3Client
.putBulkJobSpectraS3(Matchers.any(PutBulkJobSpectraS3Request.class)))
.putBulkJobSpectraS3(any(PutBulkJobSpectraS3Request.class)))
.thenReturn(bulkPutResponse);

final AllocateJobChunkSpectraS3Response allocateResponse1 = buildAllocateResponse1();
Expand Down Expand Up @@ -675,22 +675,22 @@ public SeekableByteChannel buildChannel(final String key) throws IOException {
public void testEnsureBucketExistsRace() throws IOException {
final Ds3Client ds3Client = mock(Ds3Client.class);
final HeadBucketResponse response = buildHeadBucketResponse(HeadBucketResponse.Status.DOESNTEXIST);
Mockito.when(ds3Client.headBucket(Matchers.any(HeadBucketRequest.class))).thenReturn(response);
Mockito.when(ds3Client.putBucket(Matchers.any(PutBucketRequest.class)))
Mockito.when(ds3Client.headBucket(any(HeadBucketRequest.class))).thenReturn(response);
Mockito.when(ds3Client.putBucket(any(PutBucketRequest.class)))
.thenThrow(new FailedRequestException(ImmutableList.of(202, 409), 409, new Error(), "Conflict", "5"));

final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(ds3Client);

helpers.ensureBucketExists("fake_bucket"); // if this throws an exception, then this test should fail
verify(ds3Client, atLeastOnce()).putBucket(Matchers.any(PutBucketRequest.class));
verify(ds3Client, atLeastOnce()).putBucket(any(PutBucketRequest.class));
}

@Test(expected = FailedRequestException.class)
public void testEnsureBucketExistsReturnsError() throws IOException {
final Ds3Client ds3Client = mock(Ds3Client.class);
final HeadBucketResponse response = buildHeadBucketResponse(HeadBucketResponse.Status.DOESNTEXIST);
Mockito.when(ds3Client.headBucket(Matchers.any(HeadBucketRequest.class))).thenReturn(response);
Mockito.when(ds3Client.putBucket(Matchers.any(PutBucketRequest.class)))
Mockito.when(ds3Client.headBucket(any(HeadBucketRequest.class))).thenReturn(response);
Mockito.when(ds3Client.putBucket(any(PutBucketRequest.class)))
.thenThrow(new FailedRequestException(ImmutableList.of(202, 409, 500), 500, new Error(), "Error", "5"));

final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(ds3Client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import static org.mockito.Matchers.argThat;


public final class RequestMatchers {
public static GetBulkJobSpectraS3Request hasChunkOrdering(final JobChunkClientProcessingOrderGuarantee chunkOrdering) {
return argThat(new TypeSafeMatcher<GetBulkJobSpectraS3Request>() {
Expand Down
6 changes: 3 additions & 3 deletions ds3-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
apply from: "$rootDir/gradle/scripts/publish.gradle"

dependencies {
compile "commons-codec:commons-codec:$commonscodecVersion"
compile "commons-io:commons-io:$commonsioVersion"
compile "com.google.guava:guava:$guavaVersion"
implementation "commons-codec:commons-codec:$commonscodecVersion"
implementation "commons-io:commons-io:$commonsioVersion"
implementation "com.google.guava:guava:$guavaVersion"
}
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
# *****************************************************************************
#

commonscodecVersion=1.10
commonsioVersion=2.4
commonslangVersion=3.6
guavaVersion=23.0
commonscodecVersion=1.15
commonsioVersion=2.11.0
commonslangVersion=3.12.0
guavaVersion=31.1-jre
hamcrestVersion=1.3
httpclientVersion=4.5.3
jacksonVersion=2.9.0
jnaVersion=4.2.2
httpclientVersion=4.5.13
jacksonVersion=2.13.3
jnaVersion=4.5.1
junitVersion=4.12
mockitoVersion=1.10.+
slf4jVersion=1.7.25
slf4jVersion=1.7.36
44 changes: 21 additions & 23 deletions gradle/scripts/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,24 @@
* ****************************************************************************
*/

apply plugin: 'com.jfrog.bintray'

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')

configurations = ['archives']

//dryRun = true
//publish = true

pkg {
name = "$project.name"
repo = "ds3"
userOrg = "spectralogic"
websiteUrl = "https://github.com/SpectraLogic/ds3_java_sdk"
vcsUrl = "https://github.com/SpectraLogic/ds3_java_sdk.git"
licenses = ['Apache-2.0']
version {
name = "$project.version"
}
}
}
//bintray {
// user = System.getenv('BINTRAY_USER')
// key = System.getenv('BINTRAY_KEY')
//
// configurations = ['archives']
//
// //dryRun = true
// //publish = true
//
// pkg {
// name = "$project.name"
// repo = "ds3"
// userOrg = "spectralogic"
// websiteUrl = "https://github.com/SpectraLogic/ds3_java_sdk"
// vcsUrl = "https://github.com/SpectraLogic/ds3_java_sdk.git"
// licenses = ['Apache-2.0']
// version {
// name = "$project.version"
// }
// }
//}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading