{"id":16351365,"url":"https://github.com/autonomousapps/gradle-issue-variant-attribute-desugaring","last_synced_at":"2025-11-13T05:30:17.363Z","repository":{"id":247848399,"uuid":"827013874","full_name":"autonomousapps/gradle-issue-variant-attribute-desugaring","owner":"autonomousapps","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-10T21:08:27.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-16T02:29:27.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/autonomousapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-10T21:01:33.000Z","updated_at":"2024-07-10T21:08:29.000Z","dependencies_parsed_at":"2024-07-11T00:32:52.300Z","dependency_job_id":"2ca00219-3570-4f75-a74f-364f335b4d2e","html_url":"https://github.com/autonomousapps/gradle-issue-variant-attribute-desugaring","commit_stats":null,"previous_names":["autonomousapps/gradle-issue-variant-attribute-desugaring"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomousapps%2Fgradle-issue-variant-attribute-desugaring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomousapps%2Fgradle-issue-variant-attribute-desugaring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomousapps%2Fgradle-issue-variant-attribute-desugaring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomousapps%2Fgradle-issue-variant-attribute-desugaring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autonomousapps","download_url":"https://codeload.github.com/autonomousapps/gradle-issue-variant-attribute-desugaring/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239605126,"owners_count":19666996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T01:09:13.534Z","updated_at":"2025-11-13T05:30:17.259Z","avatar_url":"https://github.com/autonomousapps.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Variant Attribute desugaring/rehydrating issue\n\n## Gradle issue\n\nhttps://github.com/gradle/gradle/issues/29872\n\nReproduces `Multiple incompatible variants` error.\n\n## Steps to reproduce\n\n1. Publish the producer to a local repo. We want to resolve this as an external module.\n```\n./gradlew producer:publishMavenPublicationToLocalRepository\n```\n\n2. Reproduce failure state:\n```\n./gradlew consumer:test\n```\n\n3. Reproduce success with workaround applied:\n```\n./gradlew consumer:test -PapplyWorkaround\n```\n\n## What?\n\nApparently Gradle desugars strongly-typed variant attributes to `String`-typed attributes. Later,\nwhen doing dependency resolution, it is supposed to \"rehydrate\" the `String`-typed attributes to the\nstrong types, but there was a case where this wasn't happening, leading to an issue where an\n`AttributeCompatibilityRule\u003cStrongType\u003e` associated with a schema wasn't being called. A workaround\nfor this is to also add a `AttributeCompatibilityRule\u003cString\u003e` that reproduces the behavior of the\n`StrongType` version. The code in this repo demonstrates this issue, as well as the workaround.\n\nThis issue is now fixed with https://github.com/gradle/gradle/pull/29738, but I'm filing this issue\nanyway as both documentation of that issue, and more general documentation about the use-case\nfor using variant attributes in this particular way.\n\nThe brief summary (which I'll expand on later in blog form) is that we are migrating from a polyrepo\nsetup to a monorepo, which means previously unpublished modules will now be directly accessible to\neach other as local project dependencies. For this reason and others, we want to define strict\ndependency rules and let the Gradle dependency resolution engine enforce them. We stumbled across \nthis issue because a migrated project with test fixtures was being consumed by a non-migrated \nproject that wanted to use those test fixtures, leading to two variants of the producer in the \ndependency graph (both the test-fixtures variant and the main variant). The consumer didn't know\nthese two variants were mutually compatible because the compatibility rule wasn't being called,\nbecause of the issue with desugaring/rehydrating. We implemented a workaround exactly as seen in\nthis reproducer. We can also confirm that the PR linked above and targeted for Gradle 8.10 resolves\nthis issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomousapps%2Fgradle-issue-variant-attribute-desugaring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautonomousapps%2Fgradle-issue-variant-attribute-desugaring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomousapps%2Fgradle-issue-variant-attribute-desugaring/lists"}