d7b40c70fe
DisableCastChecking option was first added in I5dc633d5b. Since Issue 3389, that caused breakage of all Google products for many weeks, this option is added again in the development build to prevent such severe regressions in future. Because the generated javascript code is bigger with cast checks, this option is still added in release mode. Side effect of this change is that the plugins that expose GWT module are compiled without DisableCastChecking option in Gerrit tree mode. Standalone bucklets driven build mode is not affected by this change. Another side effect, that 'soyc' target for "compiler story" was duplicated and the corresponding release mode with DisableCastChecking is also provided with alias 'soyc_r'. TEST PLAN: $ buck build gerrit should pass only -XdisableClassMetadata option to GWT compiler. Whereas $ buck build release should pass both -XdisableClassMetadata -XdisableCastChecking options. Bug: Issue 3389 Change-Id: Ia99647357e7bff889137d4855e9c0059e6c6a4f3
140 lines
3.7 KiB
Plaintext
140 lines
3.7 KiB
Plaintext
# Copyright (C) 2013 The Android Open Source Project
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
from multiprocessing import cpu_count
|
|
|
|
BROWSERS = [
|
|
'chrome',
|
|
'firefox',
|
|
'gecko1_8',
|
|
'safari',
|
|
'msie', 'ie8', 'ie9',
|
|
]
|
|
ALIASES = {
|
|
'chrome': 'safari',
|
|
'firefox': 'gecko1_8',
|
|
'msie': 'ie9',
|
|
}
|
|
MODULE = 'com.google.gerrit.GerritGwtUI'
|
|
CPU_COUNT = cpu_count()
|
|
|
|
def gwt_genrule(module, deps, suffix = ""):
|
|
dbg = 'ui_dbg' + suffix
|
|
opt = 'ui_opt' + suffix
|
|
soyc = 'ui_soyc' + suffix
|
|
args = GWT_COMPILER_ARGS_RELEASE_MODE if suffix == "_r" else GWT_COMPILER_ARGS
|
|
|
|
genrule(
|
|
name = 'ui_optdbg' + suffix,
|
|
cmd = 'cd $TMP;' +
|
|
'unzip -q $(location :%s);' % dbg +
|
|
'mv' +
|
|
' gerrit_ui/gerrit_ui.nocache.js' +
|
|
' gerrit_ui/dbg_gerrit_ui.nocache.js;' +
|
|
'unzip -qo $(location :%s);' % opt +
|
|
'mkdir -p \$(dirname $OUT);' +
|
|
'zip -qr $OUT .',
|
|
out = 'ui_optdbg' + suffix + '.zip',
|
|
visibility = ['PUBLIC'],
|
|
)
|
|
|
|
gwt_binary(
|
|
name = opt,
|
|
modules = [module],
|
|
module_deps = [':ui_module'],
|
|
deps = deps + ([':' + dbg] if CPU_COUNT < 8 else []),
|
|
local_workers = CPU_COUNT,
|
|
strict = True,
|
|
experimental_args = args,
|
|
vm_args = GWT_JVM_ARGS,
|
|
)
|
|
|
|
gwt_binary(
|
|
name = dbg,
|
|
modules = [module],
|
|
style = 'PRETTY',
|
|
optimize = 0,
|
|
module_deps = [':ui_module'],
|
|
deps = deps,
|
|
local_workers = CPU_COUNT,
|
|
strict = True,
|
|
experimental_args = args,
|
|
vm_args = GWT_JVM_ARGS,
|
|
visibility = ['//:eclipse'],
|
|
)
|
|
|
|
gwt_binary(
|
|
name = soyc,
|
|
modules = [module],
|
|
module_deps = [':ui_module'],
|
|
deps = deps + [':' + dbg],
|
|
local_workers = CPU_COUNT,
|
|
strict = True,
|
|
experimental_args = args + ['-compileReport'],
|
|
vm_args = GWT_JVM_ARGS,
|
|
)
|
|
|
|
def gwt_user_agent_permutations(
|
|
name,
|
|
module_name,
|
|
modules,
|
|
style = 'PRETTY',
|
|
optimize = 0,
|
|
draft_compile = True,
|
|
module_deps = [],
|
|
deps = [],
|
|
browsers = BROWSERS,
|
|
visibility = []):
|
|
for ua in browsers:
|
|
impl = ua
|
|
if ua in ALIASES:
|
|
impl = ALIASES[ua]
|
|
xml = ''.join([
|
|
"<module rename-to='%s'>" % module_name,
|
|
"<inherits name='%s'/>" % modules[0],
|
|
"<set-property name='user.agent' value='%s'/>" % impl,
|
|
"<set-property name='locale' value='default'/>",
|
|
"</module>",
|
|
])
|
|
gwt = '%s_%s.gwt.xml' % (modules[0].replace('.', '/'), ua)
|
|
gwt_name = '%s_%s' % (name, ua)
|
|
jar = '%s.gwtxml.jar' % (gwt_name)
|
|
|
|
genrule(
|
|
name = '%s_gwtxml_gen' % gwt_name,
|
|
cmd = 'cd $TMP;' +
|
|
('mkdir -p \$(dirname %s);' % gwt) +
|
|
('echo "%s">%s;' % (xml, gwt)) +
|
|
'zip -qr $OUT .',
|
|
out = jar,
|
|
)
|
|
prebuilt_jar(
|
|
name = '%s_gwtxml_lib' % gwt_name,
|
|
binary_jar = ':%s_gwtxml_gen' % gwt_name,
|
|
gwt_jar = ':%s_gwtxml_gen' % gwt_name,
|
|
)
|
|
gwt_binary(
|
|
name = gwt_name,
|
|
modules = [modules[0] + '_' + ua],
|
|
style = style,
|
|
optimize = optimize,
|
|
draft_compile = draft_compile,
|
|
module_deps = module_deps + [':%s_gwtxml_lib' % gwt_name],
|
|
deps = deps,
|
|
local_workers = CPU_COUNT,
|
|
strict = True,
|
|
experimental_args = GWT_COMPILER_ARGS,
|
|
vm_args = GWT_JVM_ARGS,
|
|
visibility = visibility,
|
|
)
|