ffe301570c
Add support for downloading npm binaries including dependencies and running them in buck genrules. In npm land, transitive dependencies are generally included in the package distribution, and there are a *lot* of them. Since we aren't redistributing these binaries and they're only part of the build process, we don't have to worry too much about licensing, only that they don't have anything totally crazy. We assume packages have a certain format and we can detect the binary to run from the genrule output filename. Actually running the binary is tricky as well, since we have to extract it first. But it might be large, so we don't want to extract it on every invocation; and naive extraction to a common location (in buck-out) is racy. So we need a custom extractor scheme using atomic rename to make this work. Download bower as an npm package and use it to download bower packages. Bower packages can come from a variety of sources, usually git repositories, so we can't simply use download_file. There is additional logic in bower to read bower.json and strip out unneeded files, so I didn't want to get into reimplementing that. The tricky thing about bower is convincing it to avoid transitive dependencies so we can let Buck handle parallelism and caching. To do this, we need to read the package information from the upstream bower repository, and explicitly ignore all listed dependencies when downloading. We combine the flattened list of bower packages in a single bower_components rule. It would be nice to have deps of each bower_component so we didn't need to flatten these, but Buck genrules don't have deps so this is a nonstarter. Considering we only expect to have a single bower_components for the whole project, hopefully this is not too onerous. This change just gets us the bower_components directory. We still have some work to do to use this from Gerrit. Plus even more work to replace the gulpfile and actually package this stuff together into a compiled JS app for the war distribution. Change-Id: Id277d2d812ffcc3bce87ff00b5894bacdffc038e
12 lines
203 B
Python
12 lines
203 B
Python
python_binary(
|
|
name = 'download_bower',
|
|
main = 'download_bower.py',
|
|
visibility = ['PUBLIC'],
|
|
)
|
|
|
|
python_binary(
|
|
name = 'run_npm_binary',
|
|
main = 'run_npm_binary.py',
|
|
visibility = ['PUBLIC'],
|
|
)
|