// Workaround for the nixpkgs Gradle mitm-cache hook. // // The hook's `nixDownloadDeps` task force-resolves every resolvable configuration // to record all dependencies. AGP's androidTest/test classpaths reference the app // project itself and cannot disambiguate its published variants, so resolving them // throws a "cannot choose between the following variants of project :app" error and // aborts dependency capture. // // The hermetic build target is `assembleNonRootDebug`, which never compiles tests, // so we mark every test configuration as non-resolvable. `nixDownloadDeps` filters // on `canBeResolved`, so these are simply skipped, and the real build does not touch // them either. gradle.projectsLoaded { rootProject.allprojects { proj -> proj.afterEvaluate { proj.configurations .matching { it.name.toLowerCase().contains("test") } .all { it.setCanBeResolved(false) } } } }