-
Notifications
You must be signed in to change notification settings - Fork 615
Reduce flakiness of license fetcher. #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2a3f010
to
2ecbdc4
Compare
buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/license/RemoteLicenseFetcher.groovy
Show resolved
Hide resolved
buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/license/RemoteLicenseFetcher.groovy
Show resolved
Hide resolved
String get() { | ||
APACHE_2_LICENSE_URI.toURL().getText() | ||
String processDocument(Document doc) { | ||
// TODO(vkryachko, allisonbm92): This fails silently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the TODO to not fail silently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, why do you return an empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've expanded details in the comments and removed the empty string.
|
||
TEXT_FORMATTER.getPlainText(doc.select('body > table > tbody > tr:nth-child(2) > td:nth-child(2) > table > tbody > tr:nth-child(3) > td > en > blockquote')) | ||
String processDocument(Document doc) { | ||
return TEXT_FORMATTER.getPlainText(doc.select("body > table > tbody > tr:nth-child(2) > td:nth-child(2) > table > tbody > tr:nth-child(3) > td > en > blockquote").get(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep line length <100 characters?
@Override | ||
URI getServiceUri() { | ||
GNU_CLASSPATH_LICENSE_URI | ||
// TODO(allisonbm92, vkryachko): This does not fetch the actual license! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put the missing work in this TODO? Why doesn't it fetch the actual license?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This commit is a simple fix to reduce the flakiness of downloading licenses. The fetcher will now try up to three times and will insert a small delay between each attempt. This delay will only affect builds that would otherwise fail.
2ecbdc4
to
9cae897
Compare
My fix in #484 changed the way the Apache license was handled, and all whitespace was stripped from this popular license. Essentially, the original code fetched it directly with the URL class while the other licenses were fetched with Jsoup. This commit restores this behavior. This has the unfortunate side-effect of re-introducing boilerplate code, but it's the most cost-effective solution for now.
My fix in #484 changed the way the Apache license was handled, and all whitespace was stripped from this popular license. Essentially, the original code fetched it directly with the URL class while the other licenses were fetched with Jsoup. This commit restores this behavior. This has the unfortunate side-effect of re-introducing boilerplate code, but it's the most cost-effective solution for now.
This commit is a simple fix to reduce the flakiness of downloading
licenses. The fetcher will now try up to three times and will insert a
small delay between each attempt. This delay will only affect builds
that would otherwise fail.