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

Compat deprecated getDependencyProject usage #1106

Merged
merged 1 commit into from
Dec 13, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.jengelman.gradle.plugins.shadow.internal

import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.model.ObjectFactory
import org.gradle.api.plugins.JavaPlugin
Expand Down Expand Up @@ -34,3 +35,15 @@ internal fun ConfigurableFileCollection.conventionCompat(vararg paths: Any): Con
this
}
}

/**
* TODO: this could be removed after bumping the min Gradle requirement to 8.11 or above.
*/
internal fun ProjectDependency.dependencyProjectCompat(project: Project): Project {
return if (GradleVersion.current() >= GradleVersion.version("8.11")) {
project.project(path)
} else {
@Suppress("DEPRECATION")
dependencyProject
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal class UnusedTracker private constructor(
apiDependencies.forEach { dep ->
when (dep) {
is ProjectDependency -> {
apiJars.addAll(getApiJarsFromProject(dep.dependencyProject))
apiJars.addAll(getApiJarsFromProject(dep.dependencyProjectCompat(project)))
addJar(runtimeConfiguration, dep, apiJars)
}
is SelfResolvingDependency -> {
Expand Down
Loading