From f03e11c87720bb1dae67b944f49602ab15812f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Fri, 5 May 2023 11:36:49 +0200 Subject: [PATCH] nix: fix handling POMs without JARs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- nix/deps/gradle/url2json.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nix/deps/gradle/url2json.sh b/nix/deps/gradle/url2json.sh index d7f1c75095..d89fafc9f9 100755 --- a/nix/deps/gradle/url2json.sh +++ b/nix/deps/gradle/url2json.sh @@ -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"