Skip to content

Fix GcvConsumable configuration creation for Gradle 9+ compatibility#1520

Open
xJetRy wants to merge 2 commits intopalantir:developfrom
xJetRy:fix/ensure-gcv-consumable-early-setup
Open

Fix GcvConsumable configuration creation for Gradle 9+ compatibility#1520
xJetRy wants to merge 2 commits intopalantir:developfrom
xJetRy:fix/ensure-gcv-consumable-early-setup

Conversation

@xJetRy
Copy link

@xJetRy xJetRy commented Dec 3, 2025

Summary

  • Adds ensureBaseGcvConsumable method to pre-create GcvConsumable configurations during Java plugin setup
  • Updates recursivelyCopyProjectDependenciesWithScope to reuse existing configurations and update their extendsFrom relationship
  • Makes configurations visible in Gradle 9+ since setVisible(false) prevents variant selection discovery in newer Gradle versions

Changes

The early configuration creation ensures that variant-based project dependencies can properly resolve to GcvConsumable configurations via Gradle's variant selection mechanism. This is necessary because:

  1. In Gradle 9+, setVisible(false) prevents configurations from being discovered by variant selection from other projects
  2. Inherited project dependencies (like api(project(":foo"))) need to resolve to GcvConsumable configurations via variant selection
  3. Pre-creating configurations during plugin setup ensures they're available before afterEvaluate when dependencies are processed

@palantirtech
Copy link
Member

Thanks for your interest in palantir/gradle-consistent-versions, @xJetRy! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@changelog-app
Copy link

changelog-app bot commented Dec 3, 2025

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Fix GcvConsumable configuration creation for Gradle 9+ compatibility

Check the box to generate changelog(s)

  • Generate changelog entry

This change addresses configuration visibility issues in Gradle 9+ by:

1. Adding `ensureBaseGcvConsumable` method that pre-creates GcvConsumable
   configurations during Java plugin setup, before afterEvaluate
2. Updating `recursivelyCopyProjectDependenciesWithScope` to reuse existing
   configurations and update their extendsFrom relationship
3. Making configurations visible in Gradle 9+ since setVisible(false)
   prevents variant selection discovery in newer Gradle versions

The early configuration creation ensures that variant-based project
dependencies can properly resolve to GcvConsumable configurations via
Gradle's variant selection mechanism.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@xJetRy xJetRy force-pushed the fix/ensure-gcv-consumable-early-setup branch from c10584a to 315d926 Compare December 4, 2025 10:50
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.

2 participants