41 Commits

Author SHA1 Message Date
Han-Wen Nienhuys
afdd224496 update web-component-tester to 5.0.0.
Change-Id: I8e4b409574cd0b660f290213fdec26f8d2e7411c
2017-02-01 13:33:56 +01:00
Han-Wen Nienhuys
3dede1653a bower2bazel: don't specify versions for non-seed packages.
The 'seed' packages are the ones whose versions are set by us in
WORKSPACE. We should not set the versions for the rest of the packages
in the bower input JSON, so bower can suggest the right versions to
use.

Change-Id: I9b75f16655d049e2064726862980a339c91dd534
2017-02-01 13:33:55 +01:00
David Ostrovsky
fdbfcad77d Remove Buck based build
Bug: Issue 5302
Change-Id: I6e860446ef30ff0ad1c7c49fc0e39d39d921820b
2017-01-23 12:44:58 +00:00
Han-Wen Nienhuys
42ea853037 bazel: remove code to sniff license field in bower.json.
Instead, use a hard-coded map of licenses.

Hardcode a false dependency on diff-match-patch to avoid a diff for
the Apache2.0 license.

Tested:
  bazel build Documentation:js_licenses.txt
  buck build Documentation:js_licenses.txt
  diff -u  buck-out/gen/Documentation/js_licenses.txt/js_licenses.txt \
    bazel-genfiles/Documentation/js_licenses.txt
 diff shows only diffs for added [[header]] anchors.

Change-Id: I7886e1fadec900cf854a1b3b7c538b83d66af7a4
2016-12-20 15:44:52 +01:00
David Pursehouse
2d08500516 Format .bzl files with Bazel Buildifier
Change-Id: I3ab30565e5ac110a18cbe3d34f76307801c30373
2016-12-11 19:00:21 +09:00
David Ostrovsky
fa18907d7f Bazel: Reformat build files
Reformat the Bazel build files with the buildifier tool [1].

The style is different for Bazel files. Most notably, indentation level
is 4 spaces instead of 2, and " is used instead of '.

[1] https://github.com/bazelbuild/buildifier

Change-Id: I95c0c6f11b6d76572797853b4ebb5cee5ebd3c98
2016-12-07 11:33:07 +00:00
Han-Wen Nienhuys
246f928887 bazel: update bower packages.
Change-Id: I1672018089db8df90f52416f532436b387c242cb
2016-11-03 13:01:39 +01:00
Han-Wen Nienhuys
29cced5e29 bazel: remove 'out' attribute from genrule2, and use throughout.
This centralizes the OSX mktemp solution.

Change-Id: Iaab18450146b649245b36865bedc5d7b50d1aa07
2016-11-02 13:54:10 +01:00
Han-Wen Nienhuys
3254ec7492 bazel: generate polygerrit_ui.zip.
Tested:
  verified that polygerrit-ui/app:polygerrit_ui zip contain same files
  for bazel and buck.

Change-Id: I5fb1abbc6e68a593d6af0b7b1811608eb11f7e4c
2016-10-24 11:19:20 +02:00
ekempin
d062fc8236 Merge "bazel: add rules for vulcanize & crisper, and use them in //polygerrit-ui/app." 2016-10-11 13:05:43 +00:00
Han-Wen Nienhuys
36502628b7 bazel: add rules for vulcanize & crisper, and use them in //polygerrit-ui/app.
Change-Id: Icaa15889f9963464897742c5003bbf0b15c56ffd
2016-10-06 14:01:05 +02:00
Paladox
84b4555b11 Update polymer/polymer to 1.7.0
Release notes at https://github.com/Polymer/polymer/releases

Change-Id: I5d519a7277295f6ee22c65d7e50001c3891f4374
2016-10-05 15:30:20 +00:00
Han-Wen Nienhuys
28e7a6d3fe bazel: bower support
* 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
2016-09-29 13:18:19 +02:00
Paladox none
f27498bd78 Update es6-promise polyfill to 3.3.0
Per https://gerrit-review.googlesource.com/#/c/86130/4/lib/js/BUCK

by @Andrew Bonventre

Change-Id: I6f4b6d16074ee0f2d948519cae81bed423b76db2
2016-09-13 22:19:23 +00:00
Paladox
914cf06b27 Add es6-promise for Internet Explorer
Plus it is required by the fetch polyfill, see
https://github.com/github/fetch#installation

Also see https://github.com/github/fetch/issues/114

This fixes the undefined Promise error in internet explorer 11, due to
Promises not being supported in Internet explorer and other browsers.

See http://caniuse.com/#feat=promises

Bug: Issue 4308
Change-Id: I93df9c89a9a98059292038dffe1655c3f4d503c5
2016-09-13 15:14:32 +00:00
David Pursehouse
77d19a6ef2 Update crisper to 2.0.2 and vulcanize to 1.14.8
Bug: Issue 4512
Change-Id: Ibebb2509c5e844e7a72d521a042b449343c83e7d
2016-09-07 00:53:28 +00:00
Wyatt Allen
650c529276 Syntax highlighting
Introduces the gr-syntax-layer element. This element works as an
annotation layer that is configured with the diff and asynchronously
computes/applies syntax for the diff.

Introduces a custom build of Highlight.js which gr-syntax-layer makes
use of. Building the script is documented in
scripts/vendor/highlight/building.md.

The layer is connected to the annotation pipeline in gr-diff-builder as
the lowest layer and syntax processing is triggered only after a diff
has been completely rendered.

A number of styles are added to the gr-diff element for syntax markers.
Tests added for gr-syntax-layer.

Bug: Issue 3916
Change-Id: Ic33e40f4fe39dfce1a62de133cfaf32be5e3f25a
2016-07-25 13:47:30 -07:00
Andrew Bonventre
35341cd324 Update Polymer components
Change-Id: Id24f539786f1aca596813816edb512ac94d774af
2016-05-23 16:33:40 -04:00
Andrew Bonventre
3c88e386b5 Delete iron-ajax
Bug: Issue 3988
Change-Id: I7d1bd4269437b4393d769c06199c5b2cba68b066
2016-05-04 19:09:34 +00:00
Urs Wolfer
0f537c7bbc Add support for running (single) tests with 'run-server.sh'
- include 'web-component-tester' bower dependency as test-dependency
- remove special handling for serving folder 'bower_components'
- add support for passing parameters from 'run-server.sh' to 'server.go'

Change-Id: Ia74b3013e07b6304a4df568b081254909749efc5
2016-03-30 20:01:33 +02:00
Urs Wolfer
0282f27e62 Update Polymer elements and deps to latest versions
Change-Id: I5ad9cb5e704f6526dc372a8a0eaf7cbb6b4b43da
2016-03-30 19:54:08 +02:00
Urs Wolfer
4b8a5165ec Update page.js to 1.7.1
This release contains a fix to make it work with shadow DOM.

Change-Id: I3baa356827f0ce1c014d73b14514b60313edf7c8
2016-03-20 17:19:18 +01:00
Viktar Donich
290fcb6125 Recognize time format preferences.
Bug: Issue 3779
Change-Id: I94d9e8f7a6e688d49be6c22c43b0240ca6768894
2016-03-15 15:22:39 -07:00
Andrew Bonventre
f871b59a5b Update Polymer elements and deps to latest versions
Change-Id: If22d7b610cdbffcfcc9ae74983dc14cf8649b150
2016-03-11 12:35:48 -05:00
Andrew Bonventre
724b4e1a90 Add fetch polyfill for use in all supported browsers
Additionally fix a bug in bower2buck.py where it would
bail when a license is not specified in a Bower package
info response.

[1] http://caniuse.com/#feat=fetch
[2] http://github.github.io/fetch/

Change-Id: Ibf754aab98bab6e34b7a9fb5d6c9801bb612f5d5
2016-03-03 23:49:18 -05:00
Andrew Bonventre
15f796c7a4 [Diff view] Implement n/p and shift-n/p for jumping around
+ Also update iron-test-helpers to 1.1.5 to be able to use
  modifiers in fake key events.

Bug: Issue 3925
Change-Id: I41ce2efe0b5df63a2a637e0942a97e9dafc432f9
2016-02-26 11:38:39 -05:00
Andrew Bonventre
79a4f79ee8 Update Polymer to 1.2.4
Also pulls in an updated webcomponentjs (0.7.20) and
polymerelements/test-fixture (1.1.0)

Change-Id: I666d58582884b05231b2db8d16b79ab1c9a5bcf8
2016-02-19 17:21:13 +00:00
Andrew Bonventre
c3ef3e4dc1 Draft comments initial implementation
This implements basic functionality for draft CRUD operations.

There are a few things that are TBD:
+ Layout edge cases within the diff view.
+ Reply/Done actions in threads.
+ Not allowing the user to add drafts if logged out.
+ I’m sure a few more things...

Feature: Issue 3649
Change-Id: Ia7419eecee5d5b20e73e17241990d7a7ffede0e8
2015-12-09 12:32:37 -05:00
Dave Borowitz
d8a42b3c2a PolyGerrit: Run crisper after vulcanizing
This makes the app CSP compliant[1] by splitting out JS from HTML.

[1] http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful

Change-Id: Ifec20c0d7ebcaab6df905a16c3621ecffb80ae98
2015-12-04 13:27:45 -05:00
Dave Borowitz
dc7cff2b84 Fix lib/js/BUCK to work with bower2buck
web-animations is weird because it can be referred to either as
'web-animations' or 'web-animations/web-animations-js'. Manually
entering it as the former confuses bower2buck when it's referred to
elsewhere as the latter.

Run bower2buck to normalize the current contents.

Band-aid the situation for now, and jot down some of my ideas for
fixing when I find the time.

Change-Id: I64ae3c376df7b83008462c663de4a3998749c365
2015-12-03 13:49:40 -05:00
Andrew Bonventre
b07c0d2d6d Add an account dropdown menu
So that the user can see which account they're using, switch
accounts, and logout.

Feature: Issue 3693

Change-Id: I08ff42653f78c4a2c496d1a329d3eb26318ca32d
2015-12-02 16:44:42 -05:00
Andrew Bonventre
547b8ab9d0 Some keyboard shortcuts for change list/change view/diff
This implements the minimum required keyboard shortcuts for
the MVP. All other changes are made to support these
shortcuts working properly.

The reasoning behind moving to iron-a11y-keys-behavior is
that the iron-a11y-keys element didn't support [ and ] as
keyboard shortcuts (oddly).

Feature: Issue 3647

Change-Id: I6473a962811c19f78ba4f6829e644d7b3cbeffc7
2015-12-01 14:17:10 -05:00
Dave Borowitz
770d62e87f Improve bower2buck instructions
Instead of requiring a target, default to //polygerrit-ui/...; this
package and subpackages have several bower_components rules, and
using all of them is most likely to produce all the existing rules in
lib/js/BUCK.

Rewrite instructions in lib/js/BUCK so they are more copy-and-
pasteable. Add instructions to the generated new BUCK file on how to
merge with an existing BUCK file.

Normalize the existing package names so there's less delta on each
diff.

Change-Id: I5f46d4d06d6aaacf40c9a7771eec6e85710093e1
2015-12-01 17:57:13 +00:00
Dave Borowitz
c89f64cc7c Run PolyGerrit tests with Buck
Since Buck has no native support for web tests, wrap the tests in a
Python shim that calls wct. As in other Polymer cases, we need to
prepare a set of inputs and create a directory containing exactly what
wct expects to be there. Buck exposes resources to python_tests using
the pkg_resources API, which is cumbersome to use, and easier just to
ship around zip files as we do elsewhere.

Unlike other npm binaries we've encountered, the web-component-tester
module has numerous native dependencies, up to and including Selenium.
Rather than get in the game of distributing platform-specific
binaries, punt and require `wct` to be on the user's $PATH for now.

Tests are currently excluded in .buckconfig but can be run directly
with either:

  buck test //polygerrit-ui/app:polygerrit_tests
  buck test --include web

Change-Id: Ia314213925ac27ff271374a96ed539fb2acf0187
2015-11-25 11:14:05 -05:00
Dave Borowitz
5da89cf34c Add bower2buck script to convert bower deps to Buck rules
This script merges dependencies of a bower_components rule into a
synthetic bower.json, then runs bower install to evaluate the version
rules and install packages locally. It walks through the downloaded
.bower.json files to produce new bower_component rules to put back in
lib/js/BUCK.

Change-Id: Iaea0b0a54ca4305ce40accf5924cd12fbf07b0d8
2015-11-25 10:12:29 -05:00
Dave Borowitz
0cb928cd53 download_bower.py: Fix hash_dir
We were passing the wrong directory name, resulting in hashing a
nonexistent directory and all components having the same SHA-1.
Unfortunately os.walk succeeds silently in this case.

Move hash_dir and hash_file to util so they can be used by other
scripts. (Migration of existing hashfile implementations will come
later.)

Restructure the main function to look a little more like the logic in
download_file.py, where we download to the cached location first and
then copy it after.

Fix all the broken SHA-1s in lib/js/BUCK.

Change-Id: I58bc62f84b62169bf18695a6a6704c989036c4f6
2015-11-25 10:10:09 -05:00
Dave Borowitz
c913a9bc7b Support deps for bower_component rules
Combine bower components by unzipping their bower_components
directories including transitive dependencies over each other.

Change-Id: Ib1792ba0b17999b7df60babf6ce6a59c292c3eca
2015-11-23 08:57:58 -05:00
David Ostrovsky
be81e1f4b5 Vulcanize PolyGerrit in Buck build
Change-Id: Ie9baded31746a307bb257b69deeef41665821e9d
2015-11-18 15:26:39 -05:00
Andrew Bonventre
ab0f6a82c1 [PolyGerrit] Basic diff view with tests
This covers proper rendering at this point.

Issue 3648
Change-Id: I4c22595ca7ed8f5d98034e68b48942e34b5eb6bb
2015-11-16 14:36:15 -05:00
David Ostrovsky
f6f0b1ffaf Update PolyGerrit dependencies
Iron-ajax 1.0.9 added `json-prefix` attribute handling that we need for
vulcanized PolyGerrit to work.

Change-Id: I7ffb545f1d54faab1fdd54088311d48c45f2f129
2015-11-12 19:01:11 -08:00
Dave Borowitz
ffe301570c Build bower_components with buck
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
2015-11-12 19:01:53 -05:00