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
diff --git a/gerrit-gwtui/src/main/java/net/codemirror/lib/Lib.java b/gerrit-gwtui/src/main/java/net/codemirror/lib/Lib.java
index 2259467..874d186 100644
--- a/gerrit-gwtui/src/main/java/net/codemirror/lib/Lib.java
+++ b/gerrit-gwtui/src/main/java/net/codemirror/lib/Lib.java
@@ -23,10 +23,10 @@
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();
}
diff --git a/lib/codemirror/BUCK b/lib/codemirror/BUCK
index 213fbe3..8015c5a 100644
--- a/lib/codemirror/BUCK
+++ b/lib/codemirror/BUCK
@@ -28,7 +28,7 @@
for n in CM_CSS + CM_THEMES]
),
deps = [':zip'],
- out = 'cm4.css',
+ out = 'cm.css',
)
genrule(
@@ -38,17 +38,19 @@
'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:
diff --git a/lib/codemirror/cm.defs b/lib/codemirror/cm.defs
index 77f5e7c..66ed164 100644
--- a/lib/codemirror/cm.defs
+++ b/lib/codemirror/cm.defs
@@ -17,14 +17,17 @@
'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 = [