| 1 | #!/bin/bash -ex |
| 2 | |
| 3 | # Separate core packages from those that depend on the whole library being built. |
| 4 | core=$(go list ./... | grep -Ev 'avo/(examples|tests)') |
| 5 | post=$(go list ./... | grep -E 'avo/(examples|tests)') |
| 6 | |
| 7 | # Install avogen (for bootstrapping). |
| 8 | go install ./internal/cmd/avogen |
| 9 | |
| 10 | # Attempt to delete generated files, to prove we can recreate them. |
| 11 | grep -RE '^// Code generated.*DO NOT EDIT\.$' . | grep -v download | cut -d: -f1 | grep -v '.md$' | xargs rm -v |
| 12 | |
| 13 | # Generate once. |
| 14 | go generate -v -x ${core} |
| 15 | |
| 16 | # If the instruction database has changed, may need to repeat. |
| 17 | go install ./internal/cmd/avogen |
| 18 | go generate -v -x ${core} |
| 19 | |
| 20 | # Generate dependent packages. |
| 21 | go generate -v -x ${post} |
| 22 | |
| 23 | # Regenerate documentation. |
| 24 | ./script/doc |