Script to compare the current scaladoc with the parent commit's doc#4765
Script to compare the current scaladoc with the parent commit's doc#4765SethTisue merged 2 commits intoscala:2.11.xfrom
Conversation
|
|
|
Here's a few ways we could go on Issue 2,
I'm happy to go with the option to make the script a bit more portable. |
fafa299 to
9373058
Compare
56299ed to
38c7067
Compare
Tested on Ubuntu 14.04.3 LTS. SUMMARY 1. Use `set -e` to ensure ant failure bails script. 2. Make best effort to display scaladoc build diff. 3. Quiet output from git checkout. 4. Prefer plumbing over porcelain when getting hashes. 5. Use short hashes to enhance output readability. 6. Use branch name when available. 7. Ensure scaladoc copies are clean. 8. Remove redundant use of scaladoc-compare. 9. Improve message formatting. 10. Use $(...) instead of backticks for more legible code. 11. Pause after reporting missing old file. 12. Report missing new files. DETAILS 1. Use `set -e` to ensure an ant failure bails the script. Turn off before diff because diff returns an error code when the compared files differ, which is expected to be seen. 2. Make best effort to display scaladoc build diff preferring graphical clients. opendiff is a Mac OS X command that opens a graphical diff display, meld is a graphical client for Ubuntu and other distros. On Ubuntu fallback to gvimdiff which will display graphically if possible otherwise in the console. Ultimately default to diff. Command detection taken from, http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script 3. Quiet output from git checkout to avoid detached head warning. The user does not need to see the detached head warning when running this. 4. Prefer plumbing over porcelain to avoid 'not found' error when getting SHA1s. Calling get-scala-commit-sha errors out on Ubuntu 14.04.3 with Bash 4.3.11 with these messages, tools/get-scala-commit-sha: 11: tools/get-scala-commit-sha: [[: not found tools/get-scala-commit-sha: 17: tools/get-scala-commit-sha: Bad substitution 5. Use short hashes to enhance output readability. 6. Use branch name when available. If the branch name is not used when the working directory is restored after checkout out the parent commit we will be in a detached HEAD state. Make a best effort to avoid that. 7. Ensure scaladoc copies are clean. Remove previous copy of scaladoc to ensure consistent behaviour on runs past the first. 8. Remove use of scaladoc-compare because the equivalent functionality is provided when iterating the new files. 9. Improve message formatting. 10. Use $(...) instead of backticks for more legible code. 11. Pause after reporting missing old file. Without this pause it was easy to miss the message when we had this sequence of differences, * differing files * missing file * differing files 12. Report missing new files. Along with reporting new files with no corresponding old file report the complementary scenario.
38c7067 to
006c0a4
Compare
|
Review by @som-snytt, @jsuereth, @SethTisue. @SethTisue - please take off This has been tested on Ubuntu but not on Mac OS X, so there is a chance an defect has been introduced on OS X. Can anyone test this? This would be enough for a test, 1️⃣ Pull down PR You should be greeted by, 1️⃣ A diff of the scaladoc build output Thanks! |
|
this is cool. it worked for me on Mac OS X. |
|
I haven't had a chance to try the goodness yet, but I did wonder if we're assuming |
|
Good point. I'll test with |
|
@SethTisue The reason this was on-hold was to test the idea of using Please consider merging. |
|
ping @SethTisue |
Script to compare the current scaladoc with the parent commit's doc
|
thanks Janek! sorry for the delays. |
This commit was extracted from #4760 to make that PR less diverse.
👌 LGTM on Ubuntu.
Activity Log
This script does not work for me yet. Ideally this would also be tested by others on different UNIXes.
Please pull, test locally and provide comments or patches.
♨️ TODO
issue 1. (46f717f)issue 2. (8380096)issue 3.issue 4. (fafa299)issue 5. (0315e78)Ubuntu 14.04.3 LTS.OSX- Help welcomed! 🍺 🍺 🍺 🍺git diffinstead ofdisplaydiff🗻 Deferred
Known Issues
none
Fixed Issues
✅ Issue 1
OS: Ubuntu 14.04.3 LTS
not found&Bad substitutionerrors,✅ Issue 2
OS: Ubuntu 14.04.3 LTS
The script uses
opendiffwhich is not present by default on this OS. At the very least the script should preflight the existence of all required commands if there is any reasonable chance they will not be present.Solution: Check for these commands in order and use the first found,
✅ Issue 3
OS: Ubuntu 14.04.3 LTS
ScalaDoc
$ ant docs&$ ant docs.libdoes not build for @janekdb. Discussion on https://groups.google.com/forum/#!topic/scala-internals/VMzPo_tHL00Solution:
ant clean build✅ Issue 4
OS: Ubuntu 14.04.3 LTS
The script uses
openwhich is specific to Mac OS X.Solution: Check for these commands in order and use the first found,
open: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/open.1.html
✅ Issue 5
When the working directory is restored with
git checkout $shathe repo ends in a detached head state. Look for a way to restore the starting branch if possible.This can be used
When on a branch it exits normally with the branch name, if on a detached head there is an error status code and then the short
SHA1can be captured instead.✅ Issue 6
OS: Ubuntu 14.04.3 LTS
Invoke
scaladoc-comparewithbashinstead ofshto avoid bad substitution error,