blob: e407854b536df25daa1927eee1e07f3217605f76 [file] [log] [blame]
Shawn Pearcefd6bb9f2013-05-08 14:14:24 -07001# Copyright (C) 2013 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15BROWSERS = [
16 'chrome',
17 'firefox',
18 'gecko1_8',
19 'safari',
20 'msie', 'ie6', 'ie8', 'ie9',
21]
22ALIASES = {
23 'chrome': 'safari',
24 'firefox': 'gecko1_8',
25 'msie': 'ie9',
26}
27MODULE = 'com.google.gerrit.GerritGwtUI'
28
29DEBUG_OPTS = [
30 '-style', 'PRETTY',
31 '-optimize', '0',
32]
33
Shawn Pearce8f1c7fd2013-05-10 14:01:43 -070034APP_DEPS = [':ui_module']
Shawn Pearcefd6bb9f2013-05-08 14:14:24 -070035
36def gwt_user_agent_permutations(
37 name,
38 module_name,
39 module_target,
40 compiler_opts = [],
41 deps = [],
42 browsers = [],
43 visibility = []):
44 for ua in browsers:
45 impl = ua
46 if ua in ALIASES:
47 impl = ALIASES[ua]
48 xml = ''.join([
49 "<module rename-to='%s'>" % module_name,
50 "<inherits name='%s'/>" % module_target,
51 "<set-property name='user.agent' value='%s'/>" % impl,
52 "<set-property name='locale' value='default'/>",
53 "</module>",
54 ])
Shawn Pearce11d27c82013-07-24 08:09:31 -070055 gwt = '%s_%s.gwt.xml' % (module_target.replace('.', '/'), ua)
56 jar = '%s_%s.gwtxml.jar' % (name, ua)
Shawn Pearcefd6bb9f2013-05-08 14:14:24 -070057 genrule(
58 name = '%s_%s_gwtxml_gen' % (name, ua),
Shawn Pearce11d27c82013-07-24 08:09:31 -070059 cmd = 'cd $TMP;' +
60 ('mkdir -p $(dirname %s);' % gwt) +
61 ('echo "%s">%s;' % (xml, gwt)) +
62 'zip -qr $OUT .',
63 out = jar,
Shawn Pearcefd6bb9f2013-05-08 14:14:24 -070064 )
Shawn Pearce11d27c82013-07-24 08:09:31 -070065 prebuilt_jar(
Shawn Pearcefd6bb9f2013-05-08 14:14:24 -070066 name = '%s_%s_gwtxml_lib' % (name, ua),
Shawn Pearce11d27c82013-07-24 08:09:31 -070067 binary_jar = genfile(jar),
Shawn Pearcefd6bb9f2013-05-08 14:14:24 -070068 deps = [':%s_%s_gwtxml_gen' % (name, ua)],
69 )
70 gwt_application(
71 name = '%s_%s' % (name, ua),
72 module_target = module_target + '_' + ua,
73 compiler_opts = compiler_opts,
74 deps = deps + [':%s_%s_gwtxml_lib' % (name, ua)],
75 visibility = visibility,
76 )
77