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

Fix: Uses Provider<ResolvedComponentResult> as input to Task #70

Merged
merged 2 commits into from
Jan 23, 2023

Conversation

handstandsam
Copy link
Collaborator

@handstandsam handstandsam commented Jan 23, 2023

Following documentation on config cache https://docs.gradle.org/current/userguide/configuration_cache.html

Hopefully fixes #67 and #68


Chose to drop support for Gradle 7.3.x. resolutionRoot was unavailable prior to Gradle 7.4.
Screen Shot 2023-01-23 at 10 14 32 AM

@@ -10,7 +10,6 @@ class GradleVersionArgumentsProvider : ArgumentsProvider {

override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> = Stream
.of(
ParameterizedPluginArgs(gradleVersion = GradleVersion.version("7.3.3"), withConfigurationCache = false),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test fails for 7.3 because resolutionRoot is not available in this version.

internal const val DEPENDENCY_GUARD_TASK_NAME = "dependencyGuard"

internal const val DEPENDENCY_GUARD_BASELINE_TASK_NAME = "dependencyGuardBaseline"
}

override fun apply(target: Project) {
val extension = target.extensions.create(
DEPENDENCY_GUARD_TASK_NAME,
DEPENDENCY_GUARD_EXTENSION_NAME,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not required in this diff, but is zero risk and slightly more explicit.

appendLine("")
val availableConfigNames = availableConfigurations
.filter { isClasspathConfig(it) }
} else {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were using the return at the end of the if block, but if/else reads better IMO as this is an exahaustive if/else

@@ -19,8 +20,8 @@ internal val Project.projectConfigurations: ConfigurationContainer
configurations
}

internal fun ConfigurationContainer.getResolvedComponentResult(name: String): ResolvedComponentResult = this
internal fun ConfigurationContainer.getResolvedComponentResult(name: String): Provider<ResolvedComponentResult> = this
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using recommended pattern in Config Cache Documentation: https://docs.gradle.org/current/userguide/configuration_cache.html
Screen Shot 2023-01-23 at 10 17 39 AM

@@ -57,7 +58,7 @@ internal abstract class DependencyGuardListTask : DefaultTask() {
abstract val projectPath: Property<String>

@get:Input
abstract val monitoredConfigurationsMap: MapProperty<DependencyGuardConfiguration, ResolvedComponentResult>
abstract val monitoredConfigurationsMap: MapProperty<DependencyGuardConfiguration, Provider<ResolvedComponentResult>>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using recommended pattern in Config Cache Documentation: https://docs.gradle.org/current/userguide/configuration_cache.html
Screen Shot 2023-01-23 at 10 17 39 AM

@handstandsam handstandsam merged commit 8ba7e5f into main Jan 23, 2023
@handstandsam handstandsam deleted the 0.4.0-fix branch March 13, 2023 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue after 0.4.0 Release
1 participant