mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 19:44:47 +00:00
Jakub Sokołowski
0bec573eb3
Before in order to create `deps.nodejs-patched` the `deps.gradle` would also have to be downloaded in order to patch `build.gradle` files with path to the Gradle dependencies in Nix store. It turns out just replacting lines referencing `mavenCentral()`, `google()`, and `jcenter()` in `repositories` block is enough to make Gradle properly fetch dependencies from repo provided via the command line `-Dmaven.repo.local='${deps.gradle}` option. This should reduce the required size for shells that don't use Gradle. Signed-off-by: Jakub Sokołowski <jakub@status.im>
23 lines
708 B
Nix
23 lines
708 B
Nix
# 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.
|
|
patchMavenSource "$gradleFile" 'mavenCentral()' 'mavenLocal()'
|
|
patchMavenSource "$gradleFile" 'google()' 'mavenLocal()'
|
|
patchMavenSource "$gradleFile" 'jcenter()' 'mavenLocal()'
|
|
'')
|