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 && \
|
|
|
|
substituteInPlace $1 --replace "$2" "$3" 2>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
'')
|