Commit 28b969a8 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

fetch_all.py: Tweaks to make license overriding easier

* Make --ignore-licenses skip download step
* Show id package missing license rather than name
* Show URL of failed downloads

Bug: None
Change-Id: I47415a0f79e3b825f6a4eac60dec5fd12fb7449a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040749Reviewed-by: default avatarSam Maier <smaier@chromium.org>
Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738969}
parent 08a824e4
......@@ -82,6 +82,7 @@ class BuildConfigGenerator extends DefaultTask {
@TaskAction
void main() {
skipLicenses = skipLicenses || project.hasProperty("skipLicenses")
def graph = new ChromiumDepGraph(project: project, skipLicenses: skipLicenses)
def normalisedRepoPath = normalisePath(repositoryPath)
def rootDirPath = normalisePath(".")
......@@ -125,7 +126,7 @@ class BuildConfigGenerator extends DefaultTask {
downloadFile(dependency.id, dependency.licenseUrl, destFile)
if (destFile.text.contains("<html")) {
throw new RuntimeException("Found HTML in LICENSE file. Please add an "
+ "override to ChromiumDepGraph.groovy for ${dependency.name}.")
+ "override to ChromiumDepGraph.groovy for ${dependency.id}.")
}
}
}
......@@ -527,7 +528,11 @@ class BuildConfigGenerator extends DefaultTask {
static void downloadFile(String id, String sourceUrl, File destinationFile) {
destinationFile.withOutputStream { out ->
out << connectAndFollowRedirects(id, sourceUrl).getInputStream()
try {
out << connectAndFollowRedirects(id, sourceUrl).getInputStream()
} catch (Exception e) {
throw new RuntimeException("Failed to fetch license for " + id + " url: " + sourceUrl, e)
}
}
}
......
......@@ -447,6 +447,8 @@ def main():
]
if args.debug:
gradle_cmd.append('--debug')
if args.ignore_licenses:
gradle_cmd.append('-PskipLicenses=true')
RunCommand(gradle_cmd, print_stdout=args.debug)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment