Skip to content

Commit 13388bb

Browse files
devPalacioJay Palaciohandstandsam
authored
Migrate all build.gradle to version catalog and use plugin block. (#436)
* version catalog migration; * add version catalog to examples and remove plugins from classpath * address code review comments * move version bump info to seperate branch * add publish plugin to :examples * Added dependency guard * Enabled Dependency Guard for Example App * Added dependency guard github action. Co-authored-by: Jay Palacio <[email protected]> Co-authored-by: Sam Edwards <[email protected]>
1 parent da82863 commit 13388bb

File tree

12 files changed

+191
-62
lines changed

12 files changed

+191
-62
lines changed

.github/workflows/ci-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ jobs:
5050
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
5151
run: ./generate-ci-auth-file
5252

53+
- name: Dependency Guard
54+
run: ./gradlew dependencyGuard
55+
5356
- name: Check
5457
run: ./gradlew check
5558

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can also download the Java SDK JAR and and its required dependencies directl
4141

4242
## Dropbox for Java tutorial
4343

44-
A good way to start using the Java SDK is to follow this quick tutorial. Just make sure you have the the Java SDK [installed](#setup) first!
44+
A good way to start using the Java SDK is to follow this quick tutorial. Just make sure you have the Java SDK [installed](#setup) first!
4545

4646
### Register a Dropbox API app
4747

build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
buildscript {
23
repositories {
34
google()
@@ -6,15 +7,17 @@ buildscript {
67
}
78

89
dependencies {
9-
classpath 'com.github.ben-manes:gradle-versions-plugin:0.27.0'
1010
classpath files('gradle/dropbox-pem-converter-plugin')
11-
classpath 'gradle.plugin.com.github.blindpirate:gradle-legacy-osgi-plugin:0.0.6'
12-
classpath "com.vanniktech:gradle-maven-publish-plugin:0.18.0"
1311
classpath(dropboxJavaSdkLibs.android.gradle.plugin)
1412
classpath(dropboxJavaSdkLibs.kotlin.gradle.plugin)
1513
}
1614
}
1715

16+
plugins {
17+
alias(dropboxJavaSdkLibs.plugins.maven.publish.plugin) apply false
18+
alias(dropboxJavaSdkLibs.plugins.gradle.version.plugin) apply false
19+
alias(dropboxJavaSdkLibs.plugins.dependency.guard)
20+
}
1821

1922
allprojects {
2023
repositories {
@@ -28,3 +31,7 @@ allprojects {
2831
}
2932
}
3033
}
34+
35+
dependencyGuard {
36+
configuration("classpath")
37+
}

dependencies/classpath.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
androidx.databinding:databinding-common:7.2.2
22
androidx.databinding:databinding-compiler-common:7.2.2
3-
biz.aQute.bnd:biz.aQute.bndlib:5.2.0
43
com.android.databinding:baseLibrary:7.2.2
54
com.android.tools.analytics-library:crash:30.2.2
65
com.android.tools.analytics-library:protos:30.2.2
@@ -38,6 +37,7 @@ com.android.tools:sdk-common:30.2.2
3837
com.android.tools:sdklib:30.2.2
3938
com.android:signflinger:7.2.2
4039
com.android:zipflinger:7.2.2
40+
com.dropbox.dependency-guard:com.dropbox.dependency-guard.gradle.plugin:0.3.2
4141
com.dropbox.dependency-guard:dependency-guard:0.3.2
4242
com.fasterxml.jackson.core:jackson-annotations:2.11.1
4343
com.fasterxml.jackson.core:jackson-core:2.11.1
@@ -46,7 +46,8 @@ com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.1
4646
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.11.1
4747
com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1
4848
com.fasterxml.woodstox:woodstox-core:6.2.1
49-
com.github.ben-manes:gradle-versions-plugin:0.27.0
49+
com.github.ben-manes.versions:com.github.ben-manes.versions.gradle.plugin:0.42.0
50+
com.github.ben-manes:gradle-versions-plugin:0.42.0
5051
com.github.gundy:semver4j:0.16.4
5152
com.google.android:annotations:4.1.1.4
5253
com.google.api.grpc:proto-google-common-protos:1.12.0
@@ -77,13 +78,14 @@ com.squareup:javawriter:2.5.0
7778
com.sun.activation:javax.activation:1.2.0
7879
com.sun.istack:istack-commons-runtime:3.0.8
7980
com.sun.xml.fastinfoset:FastInfoset:1.2.16
80-
com.thoughtworks.xstream:xstream:1.4.10
81+
com.thoughtworks.xstream:xstream:1.4.17
82+
com.vanniktech.maven.publish:com.vanniktech.maven.publish.gradle.plugin:0.18.0
8183
com.vanniktech:gradle-maven-publish-plugin:0.18.0
8284
commons-codec:commons-codec:1.11
8385
commons-io:commons-io:2.4
8486
commons-logging:commons-logging:1.2
8587
de.undercouch:gradle-download-task:4.1.1
86-
gradle.plugin.com.github.blindpirate:gradle-legacy-osgi-plugin:0.0.6
88+
io.github.x-stream:mxparser:1.2.1
8789
io.grpc:grpc-api:1.21.1
8890
io.grpc:grpc-context:1.21.1
8991
io.grpc:grpc-core:1.21.1
@@ -169,4 +171,3 @@ org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2
169171
xerces:xercesImpl:2.12.0
170172
xml-apis:xml-apis:1.4.01
171173
xmlpull:xmlpull:1.1.3.1
172-
xpp3:xpp3_min:1.1.4c

dropbox-sdk-android/build.gradle

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
plugins {
22
id 'org.jetbrains.kotlinx.binary-compatibility-validator' version '0.11.1'
3+
alias(dropboxJavaSdkLibs.plugins.maven.publish.plugin)
4+
alias(dropboxJavaSdkLibs.plugins.gradle.version.plugin)
5+
id 'com.android.library'
6+
id 'org.jetbrains.kotlin.android'
7+
alias(dropboxJavaSdkLibs.plugins.dependency.guard)
38
}
4-
apply plugin: "com.android.library"
5-
apply plugin: "org.jetbrains.kotlin.android"
6-
apply plugin: 'com.vanniktech.maven.publish'
79

810
android {
911
compileSdk 33
@@ -17,7 +19,10 @@ android {
1719
}
1820
}
1921

20-
2122
dependencies {
2223
api(project(path: ":dropbox-sdk-java", configuration: "withoutOsgi"))
23-
}
24+
}
25+
26+
dependencyGuard {
27+
configuration("releaseRuntimeClasspath")
28+
}

dropbox-sdk-java/build.gradle

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
apply plugin: 'java-library'
2-
apply plugin: 'com.github.blindpirate.osgi'
3-
apply plugin: 'com.github.ben-manes.versions' // dependencyUpdates task
4-
apply plugin: 'com.vanniktech.maven.publish'
1+
plugins {
2+
id 'java-library'
3+
id "com.github.blindpirate.osgi" version "0.0.6"
4+
alias(dropboxJavaSdkLibs.plugins.gradle.version.plugin)
5+
alias(dropboxJavaSdkLibs.plugins.maven.publish.plugin)
6+
alias(dropboxJavaSdkLibs.plugins.dependency.guard)
7+
}
8+
59

610
sourceCompatibility = JavaVersion.VERSION_11
711
targetCompatibility = JavaVersion.VERSION_11
@@ -16,12 +20,12 @@ ext {
1620
dependencies {
1721
// Important: Jackson 2.8+ will be free to use JDK7 features and no longer guarantees JDK6
1822
// compatibility
19-
api 'com.fasterxml.jackson.core:jackson-core:2.7.9'
23+
api(dropboxJavaSdkLibs.jackson.core)
2024

21-
compileOnly 'javax.servlet:servlet-api:2.5'
22-
compileOnly 'com.squareup.okhttp:okhttp:2.7.5' // support both v2 and v3 to avoid
23-
compileOnly 'com.squareup.okhttp3:okhttp:4.0.0' // method count bloat
24-
compileOnly 'com.google.appengine:appengine-api-1.0-sdk:1.9.38'
25+
compileOnly(dropboxJavaSdkLibs.servlet.api)
26+
compileOnly(dropboxJavaSdkLibs.okhttp2) // support both v2 and v3 to avoid
27+
compileOnly(dropboxJavaSdkLibs.okhttp3) // method count bloat
28+
compileOnly(dropboxJavaSdkLibs.appengine.api)
2529

2630
testImplementation 'org.testng:testng:6.9.10'
2731
testImplementation 'org.mockito:mockito-core:1.10.19'
@@ -226,3 +230,8 @@ dependencyUpdates.resolutionStrategy = {
226230
}
227231

228232
apply from: 'stone.gradle'
233+
234+
dependencyGuard {
235+
configuration("runtimeClasspath")
236+
configuration("compileClasspath")
237+
}

examples/android/build.gradle

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android'
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
alias(dropboxJavaSdkLibs.plugins.dependency.guard)
5+
}
36

47
android {
58
compileSdkVersion 33
@@ -58,24 +61,24 @@ android {
5861
dependencies {
5962
implementation(project(":dropbox-sdk-android"))
6063

61-
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.21"
62-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.3'
64+
implementation(dropboxJavaSdkLibs.kotlin.stdlib)
65+
implementation(dropboxJavaSdkLibs.kotlin.coroutines)
6366

64-
implementation 'androidx.appcompat:appcompat:1.4.2'
65-
implementation 'androidx.recyclerview:recyclerview:1.2.1'
66-
implementation 'androidx.core:core-ktx:1.8.0'
67-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
68-
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
69-
implementation 'com.google.android.material:material:1.6.1'
67+
implementation(dropboxJavaSdkLibs.androidx.appcompat)
68+
implementation(dropboxJavaSdkLibs.androidx.recyclerview)
69+
implementation(dropboxJavaSdkLibs.androidx.core.ktx)
70+
implementation(dropboxJavaSdkLibs.androidx.constraintlayout)
71+
implementation(dropboxJavaSdkLibs.androidx.lifecycle.runtime.ktx)
72+
implementation(dropboxJavaSdkLibs.android.material)
7073

71-
implementation 'com.github.bumptech.glide:glide:4.12.0'
74+
implementation(dropboxJavaSdkLibs.glide)
7275

73-
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
76+
implementation(dropboxJavaSdkLibs.okhttp3)
7477

75-
testImplementation 'junit:junit:4.13.2'
78+
testImplementation(dropboxJavaSdkLibs.test.junit)
7679

77-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
78-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
80+
androidTestImplementation(dropboxJavaSdkLibs.androidx.test.junit)
81+
androidTestImplementation(dropboxJavaSdkLibs.androidx.test.espresso.core)
7982
}
8083

8184
def getLocalProperties() {
@@ -84,4 +87,8 @@ def getLocalProperties() {
8487
props.load(new FileInputStream(file('local.properties')))
8588
}
8689
return props
87-
}
90+
}
91+
92+
dependencyGuard {
93+
configuration("releaseRuntimeClasspath")
94+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
androidx.activity:activity:1.2.4
2+
androidx.annotation:annotation-experimental:1.1.0
3+
androidx.annotation:annotation:1.3.0
4+
androidx.appcompat:appcompat-resources:1.4.2
5+
androidx.appcompat:appcompat:1.4.2
6+
androidx.arch.core:core-common:2.1.0
7+
androidx.arch.core:core-runtime:2.1.0
8+
androidx.cardview:cardview:1.0.0
9+
androidx.collection:collection:1.1.0
10+
androidx.concurrent:concurrent-futures:1.0.0
11+
androidx.constraintlayout:constraintlayout-core:1.0.4
12+
androidx.constraintlayout:constraintlayout:2.1.4
13+
androidx.coordinatorlayout:coordinatorlayout:1.1.0
14+
androidx.core:core-ktx:1.8.0
15+
androidx.core:core:1.8.0
16+
androidx.cursoradapter:cursoradapter:1.0.0
17+
androidx.customview:customview:1.1.0
18+
androidx.documentfile:documentfile:1.0.0
19+
androidx.drawerlayout:drawerlayout:1.1.1
20+
androidx.dynamicanimation:dynamicanimation:1.0.0
21+
androidx.emoji2:emoji2-views-helper:1.0.0
22+
androidx.emoji2:emoji2:1.0.0
23+
androidx.exifinterface:exifinterface:1.2.0
24+
androidx.fragment:fragment:1.3.6
25+
androidx.interpolator:interpolator:1.0.0
26+
androidx.legacy:legacy-support-core-utils:1.0.0
27+
androidx.lifecycle:lifecycle-common:2.5.1
28+
androidx.lifecycle:lifecycle-livedata-core:2.3.1
29+
androidx.lifecycle:lifecycle-livedata:2.0.0
30+
androidx.lifecycle:lifecycle-process:2.4.0
31+
androidx.lifecycle:lifecycle-runtime-ktx:2.5.1
32+
androidx.lifecycle:lifecycle-runtime:2.5.1
33+
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1
34+
androidx.lifecycle:lifecycle-viewmodel:2.3.1
35+
androidx.loader:loader:1.0.0
36+
androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
37+
androidx.print:print:1.0.0
38+
androidx.recyclerview:recyclerview:1.2.1
39+
androidx.resourceinspection:resourceinspection-annotation:1.0.0
40+
androidx.savedstate:savedstate:1.1.0
41+
androidx.startup:startup-runtime:1.0.0
42+
androidx.tracing:tracing:1.0.0
43+
androidx.transition:transition:1.2.0
44+
androidx.vectordrawable:vectordrawable-animated:1.1.0
45+
androidx.vectordrawable:vectordrawable:1.1.0
46+
androidx.versionedparcelable:versionedparcelable:1.1.1
47+
androidx.viewpager2:viewpager2:1.0.0
48+
androidx.viewpager:viewpager:1.0.0
49+
com.fasterxml.jackson.core:jackson-core:2.7.9
50+
com.github.bumptech.glide:annotations:4.12.0
51+
com.github.bumptech.glide:disklrucache:4.12.0
52+
com.github.bumptech.glide:gifdecoder:4.12.0
53+
com.github.bumptech.glide:glide:4.12.0
54+
com.google.android.material:material:1.6.1
55+
com.google.guava:listenablefuture:1.0
56+
com.squareup.okhttp3:okhttp:4.0.0
57+
com.squareup.okio:okio:2.2.2
58+
org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21
59+
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21
60+
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21
61+
org.jetbrains.kotlin:kotlin-stdlib:1.6.21
62+
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4
63+
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4
64+
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4
65+
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4
66+
org.jetbrains:annotations:13.0

examples/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ buildscript {
22
repositories {
33
google()
44
mavenCentral()
5-
maven { url 'https://plugins.gradle.org/m2/' }
5+
gradlePluginPortal()
66
}
77
dependencies {
88
classpath "com.android.tools.build:gradle:7.2.1"
9-
classpath 'com.github.ben-manes:gradle-versions-plugin:0.27.0'
109
classpath files('../gradle/dropbox-pem-converter-plugin')
11-
classpath 'gradle.plugin.com.github.blindpirate:gradle-legacy-osgi-plugin:0.0.6'
12-
classpath "com.vanniktech:gradle-maven-publish-plugin:0.18.0"
1310
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
1411
}
1512
}
1613

14+
plugins {
15+
alias(dropboxJavaSdkLibs.plugins.maven.publish.plugin) apply false
16+
}
17+
1718
allprojects {
1819
repositories {
1920
google()

examples/settings.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ include ':dropbox-sdk-android'
1515

1616
project(":dropbox-sdk-android").projectDir = file("../dropbox-sdk-android")
1717
project(":dropbox-sdk-java").projectDir = file("../dropbox-sdk-java")
18+
19+
dependencyResolutionManagement {
20+
versionCatalogs {
21+
dropboxJavaSdkLibs {
22+
from(files("../gradle/dropboxJavaSdkLibs.versions.toml"))
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)