Skip to content

Commit 92040d5

Browse files
lesserwhirlsEric Bergstromscribe
authored
Modern gradle (#596)
* Starting to modernize * Treat empty xml elements as nil valued * Upgrade to latest mockito-core * Upgrade to latest hamcrest * Remove bintray publishing configs. * Migrate to gradle kotlin DSL * Upgrade to gradle 7.5.1 * Remove star imports * Handle temp directory cleanup * Use File.deleteOnExit() instead of FileUtils.deleteDirectory() from commons-io Co-authored-by: Eric Bergstrom <[email protected]> Co-authored-by: Eric <[email protected]>
1 parent 0dabffd commit 92040d5

28 files changed

+665
-590
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*.txt text
22

3+
# Override default behavior: BAT files always have CRLF line endings.
4+
*.bat text eol=crlf

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,11 @@ Update the version of the SDK before creating a new release. The format is `<maj
9898
`<major>.<minor>` numbers must match the version of BP. The `<patch>` is an incrementing number that increments with
9999
each SDK release for a given major/minor release.
100100

101-
The build number is specified in the `build.gradle` file:
101+
The build number is specified in the `buildSrc/src/main/kotlin/ds3-java-sdk-library-convention.gradle.kts` file:
102102

103103
```
104-
allprojects {
105-
group = 'com.spectralogic.ds3'
106-
version = '5.4.0'
107-
}
104+
group = "com.spectralogic.ds3"
105+
version = "5.4.1"
108106
```
109107

110108
When a release is created in github, it is automatically published on [jitpack.io](https://jitpack.io/#SpectraLogic/ds3_java_sdk).

SETUP.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ If using Eclipse:
1515

1616
If using Intellij:
1717
* Open Intellij and select `Import Project`
18-
* Find the `build.gradle` file contained at the root of the project and select it
18+
* Find the `settings.gradle.kts` file contained at the root of the project and select it
1919
* Accept the defaults

build.gradle

-101
This file was deleted.

settings.gradle buildSrc/build.gradle.kts

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* ******************************************************************************
3-
* Copyright 2014-2019 Spectra Logic Corporation. All Rights Reserved.
3+
* Copyright 2002 Spectra Logic Corporation. All Rights Reserved.
44
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
55
* this file except in compliance with the License. A copy of the License is located at
66
*
@@ -13,5 +13,10 @@
1313
* ****************************************************************************
1414
*/
1515

16-
include 'ds3-sdk-integration', 'ds3-sdk', 'ds3-sdk-samples', 'ds3-interfaces', 'ds3-metadata', 'ds3-utils'
17-
rootProject.name = 'ds3-java-sdk'
16+
plugins {
17+
`kotlin-dsl`
18+
}
19+
20+
repositories {
21+
mavenCentral()
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2002 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
plugins {
17+
`java`
18+
}
19+
20+
java {
21+
toolchain {
22+
languageVersion.set(JavaLanguageVersion.of(8))
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* ******************************************************************************
3-
* Copyright 2014-2019 Spectra Logic Corporation. All Rights Reserved.
3+
* Copyright 2002 Spectra Logic Corporation. All Rights Reserved.
44
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
55
* this file except in compliance with the License. A copy of the License is located at
66
*
@@ -13,10 +13,15 @@
1313
* ****************************************************************************
1414
*/
1515

16-
apply plugin: 'application'
16+
plugins {
17+
`java-library`
18+
}
1719

18-
mainClassName = 'com.spectralogic.ds3client.samples.PartialObjectGetExample'
20+
group = "com.spectralogic.ds3"
21+
version = "5.4.1"
1922

20-
dependencies {
21-
compile "org.slf4j:slf4j-simple:$slf4jVersion"
23+
java {
24+
toolchain {
25+
languageVersion.set(JavaLanguageVersion.of(8))
26+
}
2227
}

ds3-interfaces/build.gradle ds3-interfaces/build.gradle.kts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* ******************************************************************************
3-
* Copyright 2014-2019 Spectra Logic Corporation. All Rights Reserved.
3+
* Copyright 2002 Spectra Logic Corporation. All Rights Reserved.
44
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
55
* this file except in compliance with the License. A copy of the License is located at
66
*
@@ -13,4 +13,6 @@
1313
* ****************************************************************************
1414
*/
1515

16-
apply from: "$rootDir/gradle/scripts/publish.gradle"
16+
plugins {
17+
`ds3-java-sdk-library-convention`
18+
}

ds3-metadata/build.gradle

-51
This file was deleted.

ds3-metadata/build.gradle.kts

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2002 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
// bug in IntelliJ in which `libs` shows up as not being accessible
17+
// see https://youtrack.jetbrains.com/issue/KTIJ-19369
18+
@Suppress("DSL_SCOPE_VIOLATION")
19+
plugins {
20+
`ds3-java-sdk-library-convention`
21+
alias(libs.plugins.shadowPlugin)
22+
}
23+
24+
dependencies {
25+
api(project(":ds3-interfaces"))
26+
27+
implementation(project(":ds3-utils"))
28+
29+
implementation(libs.guava)
30+
implementation(libs.jna)
31+
implementation(libs.jnaPlatform)
32+
implementation(libs.slf4jApi)
33+
34+
testImplementation(libs.commonsIo)
35+
testImplementation(libs.commonsLang)
36+
testImplementation(libs.httpclient)
37+
testImplementation(libs.junit)
38+
39+
testRuntimeOnly(libs.slf4jSimple)
40+
}
41+
42+
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
43+
relocate("org.apache", "ds3metafatjar.org.apache")
44+
relocate("com.google", "ds3metafatjar.com.google")
45+
relocate("com.sun.jna", "ds3metafatjar.net.java.dev.jna")
46+
relocate("org.jetbrains", "ds3metafatjar.org.jetbrains")
47+
relocate("org.intellij", "ds3metafatjar.org.intellij")
48+
relocate("org.codehaus", "ds3metafatjar.org.codehaus")
49+
dependencies {
50+
exclude(project(":ds3-interfaces")) // this is being excluded since it must be used with the sdk, which already has this dependency included
51+
exclude(project(":ds3-utils")) // this is being excluded since it must be used with the sdk, which already has this dependency included
52+
exclude(dependency(libs.slf4jApi.get().toString()))
53+
exclude(dependency(libs.slf4jSimple.get().toString()))
54+
exclude(dependency(libs.hamcrest.get().toString()))
55+
exclude(dependency(libs.mockitoCore.get().toString()))
56+
exclude(dependency(libs.junit.get().toString()))
57+
exclude(dependency(libs.commonsLang.get().toString()))
58+
}
59+
dependsOn(tasks.jar)
60+
}

ds3-sdk-integration/build.gradle.kts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2002 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
plugins {
17+
`ds3-java-sdk-internal-convention`
18+
}
19+
20+
dependencies {
21+
implementation(project(":ds3-utils"))
22+
implementation(project(":ds3-sdk"))
23+
24+
implementation(libs.commonsIo)
25+
implementation(libs.guava)
26+
implementation(libs.slf4jApi)
27+
implementation(libs.hamcrest)
28+
implementation(libs.junit)
29+
30+
testImplementation(project(":ds3-metadata"))
31+
32+
testImplementation(libs.httpclient)
33+
testImplementation(libs.commonsLang)
34+
}

0 commit comments

Comments
 (0)