Skip to content
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

chore: re-enable deps validation #442

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
38 changes: 0 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -251,41 +251,3 @@ tasks.distTar {
compression = Compression.GZIP
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}

tasks.register('validateDependencies') {
doLast {
def dependencyVersions = [:]
def conflictsFound = false

subprojects { subproject ->
println "Module: ${subproject.name}"
def runtimeClasspath = subproject.sourceSets.main.runtimeClasspath
runtimeClasspath.each { file ->

def fileName = file.name
def matcher = fileName =~ /(.+)-(\d+\.\d+\.\d+(-.+)?)(\..+)/

if (matcher) {
def artifactId = matcher[0][1]
def version = matcher[0][2]

if (dependencyVersions.containsKey(artifactId)) {
if (dependencyVersions[artifactId] != version) {
println "Conflict found for $artifactId: ${dependencyVersions[artifactId]} vs $version"
conflictsFound = true
}
} else {
dependencyVersions[artifactId] = version
}
}
}
}

assert !conflictsFound : "Dependency conflicts found!"
}
}

// TODO fix GCP dependency issues
//tasks.named("check") {
// dependsOn(tasks.named("validateDependencies"))
//}
2 changes: 2 additions & 0 deletions storage/azure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ dependencies {

implementation platform("com.azure:azure-sdk-bom:$azureSdkVersion")
implementation ("com.azure:azure-identity") {
exclude group: "com.fasterxml.jackson.core"
exclude group: "org.slf4j"
}
implementation ("com.azure:azure-storage-blob") {
exclude group: "com.fasterxml.jackson.core"
exclude group: "org.slf4j"
}

Expand Down
51 changes: 51 additions & 0 deletions storage/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,54 @@
* limitations under the License.
*/

subprojects { subproject ->
tasks.register("validateDeps") {
doLast {
// Storage module deps versions
def depVersions = [:]
def runtimeClasspath = subproject.sourceSets.main.runtimeClasspath

runtimeClasspath.each { file ->
def fileName = file.name
def matcher = fileName =~ /(.+)-(\d+\.\d+\.\d+(-.+)?)(\..+)/

if (matcher) {
def artifactId = matcher[0][1]
def version = matcher[0][2]
depVersions[artifactId] = version
}
}

// Validate transient dependencies between storage modules and core deps
def coreDeps = [project(":core"), project(":commons")]
def conflictsFound = false

coreDeps.forEach { dep ->
runtimeClasspath = dep.sourceSets.main.runtimeClasspath
runtimeClasspath.each { file ->
def matcher = file.name =~ /(.+)-(\d+\.\d+\.\d+(-.+)?)(\..+)/

if (matcher) {
def artifactId = matcher[0][1]
def version = matcher[0][2]

if (depVersions.containsKey(artifactId)) {
if (depVersions[artifactId] != version) {
println "Conflict found for $artifactId: ${depVersions[artifactId]} vs $version"
conflictsFound = true
}
} else {
depVersions[artifactId] = version
}
}
}
}

assert !conflictsFound: "Dependency conflicts found!"
}
}

tasks.named("check") {
dependsOn(tasks.named("validateDeps"))
}
}
6 changes: 5 additions & 1 deletion storage/gcs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ archivesBaseName = "storage-gcs"
dependencies {
implementation project(":storage:core")

implementation "com.google.cloud:google-cloud-storage:$gcpSdkVersion"
implementation ("com.google.cloud:google-cloud-storage:$gcpSdkVersion") {
exclude group: "com.google.errorprone"
exclude group: "org.checkerframework"
}

implementation project(":commons")

testImplementation(testFixtures(project(":storage:core")))
Expand Down
Loading