Skip to content

Commit 80a75c5

Browse files
committed
nix: patch all Gradle configs of nodejs deps
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: #15203 Signed-off-by: Jakub Sokołowski <[email protected]>
1 parent 20a0cc0 commit 80a75c5

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

nix/deps/nodejs-patched/default.nix

+8-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ stdenv.mkDerivation {
2929
# maven and google central repositories with our own local directories.
3030
# This prevents the builder from downloading Maven artifacts
3131
patchGradlePhase = ''
32-
for modBuildGradle in $(find -L ./node_modules -name build.gradle); do
32+
gradleConfigs=$(
33+
find -L ./node_modules \
34+
-name build.gradle -or \
35+
-name build.gradle.kts -or \
36+
-name settings.gradle -or \
37+
-name settings.gradle.kts
38+
)
39+
for modBuildGradle in $gradleConfigs; do
3340
relativeToNode=''${modBuildGradle#*node_modules/}
3441
moduleName=''${relativeToNode%%/*}
3542
if [[ -L ./node_modules/$moduleName ]]; then

nix/pkgs/patch-maven-srcs/default.nix

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ writeScript "patch-maven-srcs" (''
1616
gradleFile="$1"
1717
1818
# Some of those find something, some don't, that's fine.
19-
patchMavenSource "$gradleFile" 'mavenCentral()' 'mavenLocal()'
20-
patchMavenSource "$gradleFile" 'google()' 'mavenLocal()'
21-
patchMavenSource "$gradleFile" 'jcenter()' 'mavenLocal()'
19+
patchMavenSource "$gradleFile" 'mavenCentral()' 'mavenLocal()'
20+
patchMavenSource "$gradleFile" 'google()' 'mavenLocal()'
21+
patchMavenSource "$gradleFile" 'jcenter()' 'mavenLocal()'
22+
patchMavenSource "$gradleFile" 'gradlePluginPortal()' 'mavenLocal()'
2223
'')

0 commit comments

Comments
 (0)