Simplify CodeMirror build by splitting out addons

The addon list is very repetitive with 'addon/' at the start of each
name.  Split these out into their own list of files and append them
after the other JavaScript in the build rule.

As GWT manages the CodeMirror CSS and JS resources with strong names
the internal names "cm4.{js,css}" only exist between the Buck build
system and the GWT compiler. Drop the major version number, as it
provides no value and complicates upgrades.

Change-Id: Ie0def2fee3a2109a2da21af6b3ce7495006c239e
This commit is contained in:
Shawn Pearce 2014-12-31 12:01:17 -05:00
parent b9b931af8b
commit 3a52cede92
3 changed files with 19 additions and 14 deletions

View File

@ -23,10 +23,10 @@ import com.google.gwt.resources.client.ExternalTextResource;
interface Lib extends ClientBundle {
static final Lib I = GWT.create(Lib.class);
@Source("cm4.css")
@Source("cm.css")
ExternalTextResource css();
@Source("cm4.js")
@Source("cm.js")
@DoNotEmbed
DataResource js();
}

View File

@ -28,7 +28,7 @@ genrule(
for n in CM_CSS + CM_THEMES]
),
deps = [':zip'],
out = 'cm4.css',
out = 'cm.css',
)
genrule(
@ -38,17 +38,19 @@ genrule(
'unzip -p $(location :zip) %s/LICENSE >>$OUT' % TOP,
"echo '*/' >>$OUT",
] +
['unzip -p $(location :zip) %s/%s >>$OUT' % (TOP, n) for n in CM_JS]
['unzip -p $(location :zip) %s/%s >>$OUT' % (TOP, n) for n in CM_JS] +
['unzip -p $(location :zip) %s/addon/%s >>$OUT' % (TOP, n)
for n in CM_ADDONS]
),
deps = [':zip'],
out = 'cm4-verbose.js',
out = 'cm-verbose.js',
)
js_minify(
name = 'js',
generated = [':cm-verbose'],
compiler_args = CLOSURE_COMPILER_ARGS,
out = 'cm4.js'
out = 'cm.js'
)
for n in CM_MODES:

View File

@ -17,14 +17,17 @@ CM_JS = [
'lib/codemirror.js',
'mode/meta.js',
'keymap/vim.js',
'addon/dialog/dialog.js',
'addon/scroll/simplescrollbars.js',
'addon/search/searchcursor.js',
'addon/search/search.js',
'addon/selection/mark-selection.js',
'addon/edit/trailingspace.js',
'addon/mode/overlay.js',
'addon/mode/simple.js',
]
CM_ADDONS = [
'dialog/dialog.js',
'edit/trailingspace.js',
'scroll/simplescrollbars.js',
'search/searchcursor.js',
'search/search.js',
'selection/mark-selection.js',
'mode/overlay.js',
'mode/simple.js',
]
CM_MODES = [