* npm_binary (download tarball packaged npm apps)
* bower_archive (download a zip file, to be put in WORKSPACE)
* bower_component (defining a bower library, with dependency )
* bower_component_bundle (zipping up libraries together)
* js_component (insert plain js file into bower component bundle)
* bower2bazel.py: run bower to find dependencies, generate a .bzl to
define archives and define components
Tested:
python tools/js/bower2bazel.py -w lib/js/bower_archives.bzl -b \
lib/js/bower_components.bzl
bazel build polygerrit-ui:components
unzip -v bazel-bin/polygerrit-ui/components.zip > /tmp/baz
buck build polygerrit-ui:polygerrit_components
unzip -v buck-out/gen/polygerrit-ui/polygerrit_components/polygerrit_components.bower_components.zip > /tmp/buck
diff /tmp/buck /tmp/baz
The diff corresponds to newer file versions pinned through bower2bazel.
Change-Id: I4f33914d4853bcf8afe78b4719d0e0e83b139031
35 lines
774 B
Python
35 lines
774 B
Python
|
|
load("//tools/bzl:js.bzl", "bower_component_bundle")
|
|
load('//tools/bzl:genrule2.bzl', 'genrule2')
|
|
|
|
bower_component_bundle(
|
|
name = "components",
|
|
deps = [
|
|
'//lib/js:es6-promise',
|
|
'//lib/js:fetch',
|
|
'//lib/js:highlightjs',
|
|
'//lib/js:iron-autogrow-textarea',
|
|
'//lib/js:iron-dropdown',
|
|
'//lib/js:iron-input',
|
|
'//lib/js:iron-overlay-behavior',
|
|
'//lib/js:iron-selector',
|
|
'//lib/js:moment',
|
|
'//lib/js:page',
|
|
'//lib/js:polymer',
|
|
'//lib/js:promise-polyfill',
|
|
])
|
|
|
|
|
|
genrule2(
|
|
name = 'fonts',
|
|
cmd = ' && '.join([
|
|
'cd $$TMP; for file in $(SRCS); do unzip -q $$ROOT/$$file; done',
|
|
'zip -q $$ROOT/$@ *',
|
|
]),
|
|
srcs = [
|
|
'//lib/fonts:sourcecodepro.zip',
|
|
],
|
|
out = 'fonts.zip',
|
|
visibility = ['//visibility:public'],
|
|
)
|