2020-05-07 10:21:39 +00:00
|
|
|
# This script patches build.gradle files in node_modules to use
|
|
|
|
# our local version of Maven dependencies instead of fetching them.
|
|
|
|
|
|
|
|
{ stdenv, writeScript, runtimeShell }:
|
|
|
|
|
|
|
|
writeScript "patch-maven-srcs" (''
|
|
|
|
#!${runtimeShell}
|
|
|
|
# Source setup.sh for substituteInPlace
|
|
|
|
source ${stdenv}/setup
|
|
|
|
|
|
|
|
function patchMavenSource() {
|
|
|
|
grep "$source" $1 > /dev/null && \
|
2024-09-20 09:31:42 +00:00
|
|
|
substituteInPlace $1 --replace-quiet "$2" "$3" 2>/dev/null
|
2020-05-07 10:21:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gradleFile="$1"
|
|
|
|
|
|
|
|
# Some of those find something, some don't, that's fine.
|
2023-03-03 16:15:38 +00:00
|
|
|
patchMavenSource "$gradleFile" 'mavenCentral()' 'mavenLocal()'
|
|
|
|
patchMavenSource "$gradleFile" 'google()' 'mavenLocal()'
|
|
|
|
patchMavenSource "$gradleFile" 'jcenter()' 'mavenLocal()'
|
|
|
|
patchMavenSource "$gradleFile" 'gradlePluginPortal()' 'mavenLocal()'
|
2020-05-07 10:21:39 +00:00
|
|
|
'')
|