Buck: Turn off Codemirror obfuscation in non release build
In I24790e84 I activated Closure Compiler tool chain to minify JS code. In retrospective, it was wrong, of course, to unconditionally activate the obfuscation, even in developer mode. As the consequence, devs have hard time to troubleshoot Codemirror integration problems. Not to mention, that the minifcation takes tons of time and not needed on dev build. Also note, that every single language mode file is compiled. In Ia9964735 I already disabled cast checking only in release mode. Use the same differentiation and disable Codemirror obfuscation in non release build. Test Plan: 1. `buck build gerrit` should include non obfuscated Codemirror code 2. `buck build release` should include obfuscated Codemirror code Change-Id: I05d925c94a3c0368366e9d3ad109cf84492810fc
This commit is contained in:
parent
419983454c
commit
7b11d6ad30
@ -19,25 +19,29 @@ gwt_user_agent_permutations(
|
||||
visibility = ['//:'],
|
||||
)
|
||||
|
||||
gwt_module(
|
||||
name = 'ui_module',
|
||||
srcs = glob(['src/main/java/**/*.java']),
|
||||
gwt_xml = 'src/main/java/%s.gwt.xml' % MODULE.replace('.', '/'),
|
||||
resources = glob(['src/main/java/**/*']),
|
||||
deps = [
|
||||
':silk_icons',
|
||||
'//gerrit-gwtui-common:diffy_logo',
|
||||
'//gerrit-gwtui-common:client',
|
||||
'//gerrit-gwtexpui:CSS',
|
||||
'//lib/codemirror:codemirror',
|
||||
'//lib/gwt:user',
|
||||
],
|
||||
visibility = [
|
||||
'//tools/eclipse:classpath',
|
||||
'//Documentation:licenses.txt',
|
||||
'//Documentation:js_licenses.txt',
|
||||
],
|
||||
)
|
||||
def gen_ui_module(name, suffix = ""):
|
||||
gwt_module(
|
||||
name = name + suffix,
|
||||
srcs = glob(['src/main/java/**/*.java']),
|
||||
gwt_xml = 'src/main/java/%s.gwt.xml' % MODULE.replace('.', '/'),
|
||||
resources = glob(['src/main/java/**/*']),
|
||||
deps = [
|
||||
':silk_icons',
|
||||
'//gerrit-gwtui-common:diffy_logo',
|
||||
'//gerrit-gwtui-common:client',
|
||||
'//gerrit-gwtexpui:CSS',
|
||||
'//lib/codemirror:codemirror' + suffix,
|
||||
'//lib/gwt:user',
|
||||
],
|
||||
visibility = [
|
||||
'//tools/eclipse:classpath',
|
||||
'//Documentation:licenses.txt',
|
||||
'//Documentation:js_licenses.txt',
|
||||
],
|
||||
)
|
||||
|
||||
gen_ui_module(name = 'ui_module')
|
||||
gen_ui_module(name = 'ui_module', suffix = '_r')
|
||||
|
||||
java_library(
|
||||
name = 'silk_icons',
|
||||
|
@ -32,6 +32,7 @@ def gwt_genrule(module, deps, suffix = ""):
|
||||
dbg = 'ui_dbg' + suffix
|
||||
opt = 'ui_opt' + suffix
|
||||
soyc = 'ui_soyc' + suffix
|
||||
module_dep = ':ui_module' + suffix
|
||||
args = GWT_COMPILER_ARGS_RELEASE_MODE if suffix == "_r" else GWT_COMPILER_ARGS
|
||||
|
||||
genrule(
|
||||
@ -51,7 +52,7 @@ def gwt_genrule(module, deps, suffix = ""):
|
||||
gwt_binary(
|
||||
name = opt,
|
||||
modules = [module],
|
||||
module_deps = [':ui_module'],
|
||||
module_deps = [module_dep],
|
||||
deps = deps + ([':' + dbg] if CPU_COUNT < 8 else []),
|
||||
local_workers = CPU_COUNT,
|
||||
strict = True,
|
||||
@ -64,7 +65,7 @@ def gwt_genrule(module, deps, suffix = ""):
|
||||
modules = [module],
|
||||
style = 'PRETTY',
|
||||
optimize = 0,
|
||||
module_deps = [':ui_module'],
|
||||
module_deps = [module_dep],
|
||||
deps = deps,
|
||||
local_workers = CPU_COUNT,
|
||||
strict = True,
|
||||
@ -76,7 +77,7 @@ def gwt_genrule(module, deps, suffix = ""):
|
||||
gwt_binary(
|
||||
name = soyc,
|
||||
modules = [module],
|
||||
module_deps = [':ui_module'],
|
||||
module_deps = [module_dep],
|
||||
deps = deps + [':' + dbg],
|
||||
local_workers = CPU_COUNT,
|
||||
strict = True,
|
||||
|
@ -89,6 +89,16 @@ for n in CM_MODES:
|
||||
out = 'mode_%s.js' % n,
|
||||
)
|
||||
|
||||
prebuilt_jar(
|
||||
name = 'codemirror_r',
|
||||
binary_jar = ':jar_r',
|
||||
deps = [
|
||||
':jar_r',
|
||||
'//lib:LICENSE-codemirror',
|
||||
],
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
prebuilt_jar(
|
||||
name = 'codemirror',
|
||||
binary_jar = ':jar',
|
||||
@ -99,19 +109,20 @@ prebuilt_jar(
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'jar',
|
||||
cmd = ';'.join([
|
||||
'cd $TMP',
|
||||
'mkdir -p net/codemirror/{lib,mode,theme}',
|
||||
'cp $(location :css) net/codemirror/lib',
|
||||
'cp $(location :js) net/codemirror/lib']
|
||||
+ ['cp $(location :mode_%s_js) net/codemirror/mode/%s.js' % (n, n)
|
||||
for n in CM_MODES]
|
||||
+ ['cp $(location :theme_%s) net/codemirror/theme/%s.css' % (n, n)
|
||||
for n in CM_THEMES]
|
||||
+ ['zip -qr $OUT net/codemirror/{lib,mode,theme}']),
|
||||
out = 'codemirror.jar',
|
||||
for suffix, cm, mode_suffix in [('_r', ':js', '_js'), ('', ':cm-verbose', '_src')]:
|
||||
genrule(
|
||||
name = 'jar' + suffix,
|
||||
cmd = ';'.join([
|
||||
'cd $TMP',
|
||||
'mkdir -p net/codemirror/{lib,mode,theme}',
|
||||
'cp $(location :css) net/codemirror/lib',
|
||||
'cp $(location %s) net/codemirror/lib/cm.js' % cm]
|
||||
+ ['cp $(location :mode_%s%s) net/codemirror/mode/%s.js' % (n, mode_suffix, n)
|
||||
for n in CM_MODES]
|
||||
+ ['cp $(location :theme_%s) net/codemirror/theme/%s.css' % (n, n)
|
||||
for n in CM_THEMES]
|
||||
+ ['zip -qr $OUT net/codemirror/{lib,mode,theme}']),
|
||||
out = 'codemirror%s.jar' % suffix,
|
||||
)
|
||||
|
||||
genrule(
|
||||
|
Loading…
x
Reference in New Issue
Block a user