nix: fortify the nix-update-gradle process

This fixes two issues with the `nix-update-gradle` target:

* It now fails when a JAR is missing which used to be ignored.
* It ignores dependencies that have no JARs, like Eclipse plugins.

This makes the process more robust, since we can see something is
missing right away, and a developer may re-run the process to take
account of possible temporary networking failures or rate limiting.

It also slims down the size of the `deps.json` by removing dependencies
which contribute no actual JARs or AARs to the build process.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-05-17 18:13:51 +02:00
parent 7991bbe958
commit 372942ba8a
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
3 changed files with 38 additions and 55 deletions

View File

@ -10842,16 +10842,16 @@
},
{
"path": "org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24",
"path": "org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0",
"host": "https://repo.maven.apache.org/maven2",
"type": "jar",
"pom": {
"sha1": "288f4a74efd0cea03e1d59272271f07d598b88d6",
"sha256": "1rifia2i52qgzsiqibrxkhlcwhnrvmk7mbwdvjy15vgxfmm7y1hi"
"sha1": "de5faec837d872a1712aa89242845216118a9405",
"sha256": "0p2742ga3ganms5i4pgqm4j1dl9dijx7c6nnxgdkrvpxfch7kjbr"
},
"jar": {
"sha1": "b4ac9780b37cb1b736eae9fbcef27609b7c911ef",
"sha256": "1d397qlp72rf03nz340rpdgh5s5k688mj2h5sh5gnsnh2a5p9vl3"
"sha1": "cf43b5391de623b36fe066a21127baef82c64022",
"sha256": "1kmr5c3p1rfk4zsfph0arpi7diykn87x20sdz5d7gqj04mwp9lbn"
}
},
@ -10929,16 +10929,6 @@
}
},
{
"path": "org/codehaus/plexus/plexus/4.0/plexus-4.0",
"host": "https://repo.maven.apache.org/maven2",
"type": "pom",
"pom": {
"sha1": "cdbb31ee91973d16e8f8b0bda51ed4211e7a9f57",
"sha256": "0skz6bhznd7gc2m79w848njgfj0dcvs50bmfbnjdd46cgwnnj6qa"
}
},
{
"path": "org/codehaus/plexus/plexus/5.1/plexus-5.1",
"host": "https://repo.maven.apache.org/maven2",
@ -11132,42 +11122,22 @@
},
{
"path": "org/eclipse/sisu/org.eclipse.sisu.inject/0.3.5/org.eclipse.sisu.inject-0.3.5",
"host": "https://repo.maven.apache.org/maven2",
"type": "eclipse-plugin",
"pom": {
"sha1": "3722f112fe5752bbb677eeae0ff379848902df2c",
"sha256": "0wbdd487hcp5qi738646l87xlmb7ymsq8vbi0j3gsbr4nir6k5y2"
}
},
{
"path": "org/eclipse/sisu/org.eclipse.sisu.plexus/0.3.5/org.eclipse.sisu.plexus-0.3.5",
"host": "https://repo.maven.apache.org/maven2",
"type": "eclipse-plugin",
"pom": {
"sha1": "e462a9a33f45e2f44460eb67611708791a8e9640",
"sha256": "1lw35mnqgdz2v9x5s5ijykysqwi1diks2irll55afn42sz4j6rbq"
}
},
{
"path": "org/eclipse/sisu/sisu-inject/0.3.5/sisu-inject-0.3.5",
"path": "org/eclipse/sisu/sisu-inject/0.9.0.M1/sisu-inject-0.9.0.M1",
"host": "https://repo.maven.apache.org/maven2",
"type": "pom",
"pom": {
"sha1": "37191778332db19b604649f562b3aa4aaa84063b",
"sha256": "1pgmymb4a3f0gkv4w58rh98a48wg1pj57f21kqgzyvcgkjmyqcjz"
"sha1": "87aef8c45bcb81d0d5a60878ae5dcc32b59b9be6",
"sha256": "003byd2sxpf9ckhif91g5bw29y6jn5hixj8w59i69xwfxxcvdg8m"
}
},
{
"path": "org/eclipse/sisu/sisu-plexus/0.3.5/sisu-plexus-0.3.5",
"path": "org/eclipse/sisu/sisu-plexus/0.9.0.M1/sisu-plexus-0.9.0.M1",
"host": "https://repo.maven.apache.org/maven2",
"type": "pom",
"pom": {
"sha1": "2bfdf50eb1fcf53bf56114cf988f5ad5ddb34e4d",
"sha256": "1pmrj6kp9j65kk9f3q4z2d0ws8riqp5w76niv30ax6fqxw10kfkf"
"sha1": "2724f3ab98bc94392b674358b18759f88e5482d6",
"sha256": "0gmi7b3wjpcdc5dvj21k7a69hg5x8pbf5j3c8ifh5cmx4jj7n6nj"
}
},
@ -12672,12 +12642,12 @@
},
{
"path": "org/junit/junit-bom/5.8.2/junit-bom-5.8.2",
"path": "org/junit/junit-bom/5.9.0-M1/junit-bom-5.9.0-M1",
"host": "https://repo.maven.apache.org/maven2",
"type": "pom",
"pom": {
"sha1": "90eab8a5a400f15b8e1cb6e65af0ceb616f23bba",
"sha256": "1ql6yb1zqznlzn26vl9zplvz2qqj57d24qip91pcbqwfkv56jq43"
"sha1": "713c5d49ce56b50cb83ad1902b17e98e4b2e68fe",
"sha256": "1ybmmhq2hsqbi6j1b45d743vif9kfdc0hyd6slm5jqgws65xi0jq"
}
},

View File

@ -813,7 +813,7 @@ https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.0.4/plex
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.18/plexus-utils-3.0.18.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.4.1/plexus-utils-3.4.1.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/2.0.2/plexus-2.0.2.pom
@ -821,7 +821,6 @@ https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/2.0.6/plexus-2.0
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/2.0.7/plexus-2.0.7.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.3.1/plexus-3.3.1.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.3.2/plexus-3.3.2.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/4.0/plexus-4.0.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/5.1/plexus-5.1.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/6.5/plexus-6.5.pom
https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/8/plexus-8.pom
@ -838,10 +837,10 @@ https://repo.maven.apache.org/maven2/org/eclipse/ee4j/project/1.0.7/project-1.0.
https://repo.maven.apache.org/maven2/org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2.pom
https://repo.maven.apache.org/maven2/org/eclipse/jdt/core/compiler/ecj/4.4/ecj-4.4.pom
https://repo.maven.apache.org/maven2/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.pom
https://repo.maven.apache.org/maven2/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.5/org.eclipse.sisu.inject-0.3.5.pom
https://repo.maven.apache.org/maven2/org/eclipse/sisu/org.eclipse.sisu.plexus/0.3.5/org.eclipse.sisu.plexus-0.3.5.pom
https://repo.maven.apache.org/maven2/org/eclipse/sisu/sisu-inject/0.3.5/sisu-inject-0.3.5.pom
https://repo.maven.apache.org/maven2/org/eclipse/sisu/sisu-plexus/0.3.5/sisu-plexus-0.3.5.pom
https://repo.maven.apache.org/maven2/org/eclipse/sisu/org.eclipse.sisu.inject/0.9.0.M1/org.eclipse.sisu.inject-0.9.0.M1.pom
https://repo.maven.apache.org/maven2/org/eclipse/sisu/org.eclipse.sisu.plexus/0.9.0.M1/org.eclipse.sisu.plexus-0.9.0.M1.pom
https://repo.maven.apache.org/maven2/org/eclipse/sisu/sisu-inject/0.9.0.M1/sisu-inject-0.9.0.M1.pom
https://repo.maven.apache.org/maven2/org/eclipse/sisu/sisu-plexus/0.9.0.M1/sisu-plexus-0.9.0.M1.pom
https://repo.maven.apache.org/maven2/org/glassfish/jaxb/jaxb-bom/2.2.11/jaxb-bom-2.2.11.pom
https://repo.maven.apache.org/maven2/org/glassfish/jaxb/jaxb-bom/4.0.0-M4/jaxb-bom-4.0.0-M4.pom
https://repo.maven.apache.org/maven2/org/glassfish/jaxb/jaxb-core/2.2.11/jaxb-core-2.2.11.pom
@ -952,7 +951,7 @@ https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trov
https://repo.maven.apache.org/maven2/org/junit/junit-bom/5.7.0/junit-bom-5.7.0.pom
https://repo.maven.apache.org/maven2/org/junit/junit-bom/5.7.1/junit-bom-5.7.1.pom
https://repo.maven.apache.org/maven2/org/junit/junit-bom/5.7.2/junit-bom-5.7.2.pom
https://repo.maven.apache.org/maven2/org/junit/junit-bom/5.8.2/junit-bom-5.8.2.pom
https://repo.maven.apache.org/maven2/org/junit/junit-bom/5.9.0-M1/junit-bom-5.9.0-M1.pom
https://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.pom
https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.pom
https://repo.maven.apache.org/maven2/org/jvnet/staxex/stax-ex/1.7.7/stax-ex-1.7.7.pom

View File

@ -66,16 +66,30 @@ POM_SHA256=$(get_nix_sha "${POM_NIX_FETCH_OUT}")
POM_SHA1=$(get_sha1 "${POM_PATH}")
# Identify packaging type, JAR, AAR, or just POM.
OBJ_TYPE=$(grep -oP '<packaging>\K[^<]+' "${POM_PATH}")
OBJ_TYPE_RAW=$(grep -oP '<packaging>\K[^<]+' "${POM_PATH}")
# Bundle is a JAR made using maven-bundle-plugin.
case "${OBJ_TYPE}" in
case "${OBJ_TYPE_RAW}" in
''|'bundle') OBJ_TYPE=jar;;
'aar.asc') OBJ_TYPE=aar;;
*) OBJ_TYPE="${OBJ_TYPE_RAW}"
esac
# Some dependencies have only a POM file.
# Some deps are Eclipse plugins, and we don't need those.
if [[ "${OBJ_TYPE}" == "eclipse-plugin" ]]; then
exit 0
fi
# Some deps are just POMs, in which case there is no JAR to fetch.
if [[ "${OBJ_TYPE}" != "pom" ]]; then
OBJ_NIX_FETCH_OUT=$(nix_fetch "${OBJ_REL_URL}.${OBJ_TYPE}")
if [[ ${?} -eq 0 ]]; then
# If type was a JAR or other, not getting one is an error.
if [[ ${?} -ne 0 ]]; then
# POMs without packaging type defined can still include JARs.
if [[ "${OBJ_TYPE_RAW}" != "" ]]; then
echo " ! Failed to fetch: ${OBJ_REL_URL}.${OBJ_TYPE}" >&2
exit 1
fi
else
OBJ_PATH=$(get_nix_path "${OBJ_NIX_FETCH_OUT}")
OBJ_SHA256=$(get_nix_sha "${OBJ_NIX_FETCH_OUT}")
OBJ_SHA1=$(get_sha1 "${OBJ_PATH}")