Files
moonlight-android/nix-deps-fixup.gradle
Oleks d9dedf6f19 Add Nix flake: devShell + hermetic nonRoot debug APK build
- flake.nix: devShells.default (JDK 17 + Android SDK 34 / NDK 27.0.12077973 + Gradle)
  and packages.moonlight-android (assembleNonRootDebug via gradle mitmCache)
- deps.json: offline Maven lockfile (195 artifacts)
- nix-deps-fixup.gradle: skip androidTest variant ambiguity during dep capture
- README: Building with Nix section
2026-05-29 15:07:50 +03:00

22 lines
923 B
Groovy

// 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) }
}
}
}