Newer
Older
dub_jkp / test / issue2262-exact-cached-version-match.sh
@Sönke Ludwig Sönke Ludwig on 10 Jul 2022 1 KB Add test for #2262.
  1. #!/usr/bin/env bash
  2.  
  3. . $(dirname ${BASH_SOURCE[0]})/common.sh
  4.  
  5. PACK_PATH="$CURR_DIR"/issue2262-exact-cached-version-match
  6.  
  7. # make sure that there are no left-over selections files
  8. rm -f $PACK_PATH/dub.selections.json
  9.  
  10. # make sure that there are no cached versions of the dependency
  11. dub remove gitcompatibledubpackage@* -n || true
  12.  
  13. # build normally, should select 1.0.4
  14. if ! ${DUB} build --root $PACK_PATH | grep "gitcompatibledubpackage 1\.0\.4:"; then
  15. die $LINENO 'The initial build failed.'
  16. fi
  17. dub remove gitcompatibledubpackage@* -n || true
  18.  
  19. # build with git dependency to a specific commit
  20. cat > $PACK_PATH/dub.selections.json << EOF
  21. {
  22. "fileVersion": 1,
  23. "versions": {
  24. "gitcompatibledubpackage": {
  25. "repository": "git+https://github.com/dlang-community/gitcompatibledubpackage.git",
  26. "version": "ccb31bf6a655437176ec02e04c2305a8c7c90d67"
  27. }
  28. }
  29. }
  30. EOF
  31. if ! ${DUB} build --root $PACK_PATH | grep "gitcompatibledubpackage 1\.0\.4+commit\.2\.gccb31bf:"; then
  32. die $LINENO 'The build with a specific commit failed.'
  33. fi
  34.  
  35. # select 1.0.4 again
  36. cat > $PACK_PATH/dub.selections.json << EOF
  37. {
  38. "fileVersion": 1,
  39. "versions": {
  40. "gitcompatibledubpackage": "1.0.4"
  41. }
  42. }
  43. EOF
  44. if ! ${DUB} build --root $PACK_PATH | grep "gitcompatibledubpackage 1\.0\.4:"; then
  45. die $LINENO 'The second 1.0.4 build failed.'
  46. fi
  47.  
  48. # clean up
  49. rm -f $PACK_PATH/dub.selections.json