mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-10 16:56:31 +00:00
Jakub Sokołowski
80a75c5232
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 <jakub@status.im>
24 lines
797 B
Nix
24 lines
797 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()'
|
|
patchMavenSource "$gradleFile" 'gradlePluginPortal()' 'mavenLocal()'
|
|
'')
|