From 80a75c52329834f4a0ef0c7e8b2b32d887e279d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Fri, 3 Mar 2023 17:15:38 +0100 Subject: [PATCH] nix: patch all Gradle configs of nodejs deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before we were patching only `build.gradle`, which is not the only type of Gradle config file. If we do not cover them all we can encounter errors about missing package because they will continue using remote repositories instead of `mavenLocal()`, to which pass Nix store path. We also need to cover `gradlePluginPortal()` to provide plugins. This is also necessary for the React Native upgrade: https://github.com/status-im/status-mobile/pull/15203 Signed-off-by: Jakub SokoĊ‚owski --- nix/deps/nodejs-patched/default.nix | 9 ++++++++- nix/pkgs/patch-maven-srcs/default.nix | 7 ++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/nix/deps/nodejs-patched/default.nix b/nix/deps/nodejs-patched/default.nix index 2cecbf1c11..88998a66b1 100644 --- a/nix/deps/nodejs-patched/default.nix +++ b/nix/deps/nodejs-patched/default.nix @@ -29,7 +29,14 @@ stdenv.mkDerivation { # maven and google central repositories with our own local directories. # This prevents the builder from downloading Maven artifacts patchGradlePhase = '' - for modBuildGradle in $(find -L ./node_modules -name build.gradle); do + gradleConfigs=$( + find -L ./node_modules \ + -name build.gradle -or \ + -name build.gradle.kts -or \ + -name settings.gradle -or \ + -name settings.gradle.kts + ) + for modBuildGradle in $gradleConfigs; do relativeToNode=''${modBuildGradle#*node_modules/} moduleName=''${relativeToNode%%/*} if [[ -L ./node_modules/$moduleName ]]; then diff --git a/nix/pkgs/patch-maven-srcs/default.nix b/nix/pkgs/patch-maven-srcs/default.nix index 3f75f440d5..7af9c7adee 100644 --- a/nix/pkgs/patch-maven-srcs/default.nix +++ b/nix/pkgs/patch-maven-srcs/default.nix @@ -16,7 +16,8 @@ writeScript "patch-maven-srcs" ('' gradleFile="$1" # Some of those find something, some don't, that's fine. - patchMavenSource "$gradleFile" 'mavenCentral()' 'mavenLocal()' - patchMavenSource "$gradleFile" 'google()' 'mavenLocal()' - patchMavenSource "$gradleFile" 'jcenter()' 'mavenLocal()' + patchMavenSource "$gradleFile" 'mavenCentral()' 'mavenLocal()' + patchMavenSource "$gradleFile" 'google()' 'mavenLocal()' + patchMavenSource "$gradleFile" 'jcenter()' 'mavenLocal()' + patchMavenSource "$gradleFile" 'gradlePluginPortal()' 'mavenLocal()' '')