fetch-gradle-dependencies 1.1 KB

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. set -e
  3. # Bug 28117: setting LC_ALL=C is causing wget to fail downloading some URLs
  4. unset LC_ALL
  5. cd "[% dest_dir %]"
  6. m2dir="$(mktemp -d)"
  7. [% USE artifacts = datafile(c('basedir') _ '/projects/' _ project _ '/gradle-dependencies-list.txt', delim = '|') %]
  8. [% FOREACH artifact = artifacts %]
  9. artifact_path=$(echo "[% artifact.url %]" | sed 's|^https://[^/]\+/||')
  10. artifact_filename=$(basename "$artifact_path")
  11. artifact_dirname=$(dirname "$artifact_path")
  12. [% GET c("urlget", { filename => 'downloaded_file', URL => artifact.url}); %]
  13. # .pom files may be modified after a version is published, therefore verify
  14. # the hash only if the file name does not end with '.pom'.
  15. if ! echo "$artifact_filename" | grep -q '\.pom$'; then
  16. echo "[% artifact.sha256sum %] downloaded_file" | sha256sum -c
  17. fi
  18. mkdir -p "$m2dir/$artifact_dirname"
  19. mv -f downloaded_file "$m2dir/$artifact_dirname/$artifact_filename"
  20. [% END -%]
  21. echo "Finished downloading gradle dependencies"
  22. mkdir -p "[% dest_dir %]"
  23. mv -f "$m2dir" "[% dest_dir %]/gradle-dependencies-[% c("var/gradle_dependencies_version") %]"