Serve fonts for local PolyGerrit development

Packs fonts the same way bower_components are packed, with a 'fonts'
folder inside fonts.zip.

Also removes deprecated OpenSans fonts from build files.

Bug: Issue 4893
Change-Id: I7fc11d6e689c7d5b1d68d09e94ee7aaba91ded9b
This commit is contained in:
Viktar Donich
2016-11-07 11:49:52 -08:00
parent 20988e1e40
commit 5389538038
9 changed files with 6 additions and 38 deletions

View File

@@ -87,6 +87,8 @@ public abstract class ResourceServlet extends HttpServlet {
.put("tif", "image/tiff")
.put("tiff", "image/tiff")
.put("txt", "text/plain")
.put("woff", "font/woff")
.put("woff2", "font/woff2")
.build();
protected static String contentType(String name) {

View File

@@ -11,20 +11,3 @@ genrule(
license = 'OFL1.1',
visibility = ['PUBLIC'],
)
# Open Sans at Revision 53a5266 and converted using a Google woff file
# converter (same one that Google Fonts uses).
# https://github.com/google/fonts/tree/master/apache/opensans
genrule(
name = 'opensans',
cmd = 'zip -rq $OUT .',
srcs = [
'OpenSans-Bold.woff',
'OpenSans-Bold.woff2',
'OpenSans-Regular.woff',
'OpenSans-Regular.woff2'
],
out = 'opensans.zip',
license = 'Apache2.0',
visibility = ['PUBLIC'],
)

View File

@@ -11,21 +11,3 @@ filegroup(
data = [ "//lib:LICENSE-OFL1.1" ],
visibility = ['//visibility:public'],
)
# Open Sans at Revision 53a5266 and converted using a Google woff file
# converter (same one that Google Fonts uses).
# https://github.com/google/fonts/tree/master/apache/opensans
genrule2(
name = 'opensans',
cmd = 'zip -rq $@ $(SRCS)',
srcs = [
'OpenSans-Bold.woff',
'OpenSans-Bold.woff2',
'OpenSans-Regular.woff',
'OpenSans-Regular.woff2'
],
outs = [ 'opensans.zip' ],
# TODO(hanwen): license.
# license = 'Apache2.0',
visibility = ['//visibility:public'],
)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -22,8 +22,9 @@ genrule(
name = 'fonts',
cmd = ' && '.join([
'cd $TMP',
'for file in $SRCS; do unzip -q $file; done',
'zip -q $OUT *',
'mkdir fonts',
'for file in $SRCS; do echo `pwd` > /tmp/log.log; unzip -qd fonts/ $file; done',
'zip -qr $OUT fonts',
]),
srcs = [
'//lib/fonts:sourcecodepro',

View File

@@ -43,7 +43,7 @@ genrule(
'cd $TMP/polygerrit_ui',
'mkdir -p {fonts,elements}',
' && '.join(JS_LIBS_MKDIR_CMDS),
'unzip -qd fonts $(location //polygerrit-ui:fonts)',
'unzip -qd . $(location //polygerrit-ui:fonts)',
'unzip -qd elements $(location :gr-app)',
'cp -rp $SRCDIR/* .',
' && '.join(JS_LIBS_UNZIP_CMDS),