nix: fix handling POMs without JARs

Otherwise we can get a failure like this:
```
Regenerating Nix files...
Found 40 sub-projects...
Found 609 direct dependencies...
Found 889 dependency URLs...
 ! Failed to fetch: https://repo.maven.apache.org/maven2/org/ow2/asm/asm-bom/9.5/asm-bom-9.5.jar
```
When using `make nix-update-gradle`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-05-05 11:36:49 +02:00
parent 6c5350573d
commit f03e11c877
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
1 changed files with 6 additions and 2 deletions

View File

@ -46,7 +46,7 @@ function fetch_and_template_file() {
OBJ_URL="${REPO_URL}/${PKG_PATH}/${FILENAME}"
if ! OBJ_NIX_FETCH_OUT=$(nix_fetch "${OBJ_URL}"); then
echo " ! Failed to fetch: ${OBJ_URL}" >&2
exit 1
return 1
fi
OBJ_NAME="${FILENAME}"
@ -58,6 +58,10 @@ function fetch_and_template_file() {
}"
}
function fetch_and_template_file_no_fail() {
fetch_and_template_file "${1}" 2>/dev/null || true
}
if [[ -z "${1}" ]]; then
echo "Required POM URL argument not given!" >&2
exit 1
@ -111,7 +115,7 @@ echo -ne "
}"
# Some deps are just POMs, in which case there is no JAR to fetch.
[[ "${OBJ_TYPE}" == "" ]] && fetch_and_template_file "${PKG_NAME}.jar"
[[ "${OBJ_TYPE}" == "" ]] && fetch_and_template_file_no_fail "${PKG_NAME}.jar"
[[ "${OBJ_TYPE}" == "jar" ]] && fetch_and_template_file "${PKG_NAME}.jar"
[[ "${OBJ_TYPE}" == "bundle" ]] && fetch_and_template_file "${PKG_NAME}.jar"
[[ "${OBJ_TYPE}" =~ aar* ]] && fetch_and_template_file "${PKG_NAME}.aar"